3
|
1 /* |
|
2 |
1860
|
3 Copyright (C) 1996 John W. Eaton |
3
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
3
|
20 |
|
21 */ |
|
22 |
382
|
23 #if !defined (octave_Range_h) |
|
24 #define octave_Range_h 1 |
|
25 |
1296
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
3
|
29 |
238
|
30 class istream; |
|
31 class ostream; |
645
|
32 class Matrix; |
3
|
33 |
1860
|
34 class |
|
35 Range |
3
|
36 { |
|
37 public: |
1860
|
38 |
1528
|
39 Range (void) |
1860
|
40 : rng_base (-1), rng_limit (-1), rng_inc (-1), rng_nelem (-1) { } |
1528
|
41 |
|
42 Range (const Range& r) |
1860
|
43 : rng_base (r.rng_base), rng_limit (r.rng_limit), rng_inc (r.rng_inc), |
|
44 rng_nelem (r.rng_nelem) { } |
3
|
45 |
1528
|
46 Range (double b, double l) |
1860
|
47 : rng_base (b), rng_limit (l), rng_inc (1), |
|
48 rng_nelem (nelem_internal ()) { } |
1528
|
49 |
|
50 Range (double b, double l, double i) |
1860
|
51 : rng_base (b), rng_limit (l), rng_inc (i), |
|
52 rng_nelem (nelem_internal ()) { } |
1528
|
53 |
|
54 double base (void) const { return rng_base; } |
|
55 double limit (void) const { return rng_limit; } |
|
56 double inc (void) const { return rng_inc; } |
|
57 int nelem (void) const { return rng_nelem; } |
3
|
58 |
2383
|
59 bool all_elements_are_ints (void) const; |
|
60 |
645
|
61 Matrix matrix_value (void) const; |
|
62 |
3
|
63 double min (void) const; |
|
64 double max (void) const; |
|
65 |
208
|
66 void sort (void); |
|
67 |
1528
|
68 void set_base (double b) { rng_base = b; } |
|
69 void set_limit (double l) { rng_limit = l; } |
|
70 void set_inc (double i) { rng_inc = i; } |
|
71 |
3
|
72 friend ostream& operator << (ostream& os, const Range& r); |
|
73 friend istream& operator >> (istream& is, Range& r); |
|
74 |
|
75 void print_range (void); |
|
76 |
|
77 private: |
1860
|
78 |
208
|
79 double rng_base; |
|
80 double rng_limit; |
|
81 double rng_inc; |
1860
|
82 |
208
|
83 int rng_nelem; |
3
|
84 |
|
85 int nelem_internal (void) const; |
|
86 }; |
|
87 |
2599
|
88 extern Range operator - (const Range& r); |
|
89 |
3
|
90 #endif |
|
91 |
|
92 /* |
|
93 ;;; Local Variables: *** |
|
94 ;;; mode: C++ *** |
|
95 ;;; End: *** |
|
96 */ |