to specify 1-dim region or range by two floats
More...
#include <Range.h>
|
| Range () |
| Constructor.
|
|
| Range (const Range &) |
| Copy constructor.
|
|
| Range (float low, float high) |
| Constructor.
|
|
virtual float | low (void) const |
| returns lower limit.
|
|
virtual float | high (void) const |
| returns higher limit.
|
|
virtual float | center (void) const |
| returns center.
|
|
virtual float | width (void) const |
| returns width.
|
|
virtual float | low (float lowIn) |
| sets lower limit.
|
|
virtual float | high (float highIn) |
| sets higher limit.
|
|
virtual Range & | set (float low, float high) |
| sets range.
|
|
virtual Range & | setByCenter (float center, float width) |
| sets range by center and width.
|
|
Range & | operator= (const Range &) |
| Copy operator.
|
|
bool | operator== (const Range &) const |
| returns true if range is the same.
|
|
bool | operator!= (const Range &) const |
| returns true if range is different.
|
|
bool | operator& (const Range &) const |
| returns true if two are overlaped each other.
|
|
bool | within (const float value) const |
| returns true if given value is within a range.
|
|
bool | within2 (const float value) const |
| returns true if given value is within a range.
|
|
bool | within (const Range &) const |
| returns true if given Range is within(included in) a range.
|
|
virtual int | dump (void) const |
| displays debug information.
|
|
to specify 1-dim region or range by two floats
Definition at line 19 of file Range.h.
◆ Range() [1/3]
Constructor.
Definition at line 16 of file Range.cxx.
16 {
17 _low = -999.;
18 _high = -999.;
19}
◆ Range() [2/3]
Range::Range |
( |
const Range & | ib | ) |
|
Copy constructor.
Definition at line 21 of file Range.cxx.
21 {
24}
virtual float high(void) const
returns higher limit.
virtual float low(void) const
returns lower limit.
◆ Range() [3/3]
Range::Range |
( |
float | low, |
|
|
float | high ) |
Constructor.
Definition at line 26 of file Range.cxx.
26 {
27 if (iHigh > iLow) {
28 _low = iLow;
29 _high = iHigh;
30 }
31 else {
32 _low = iHigh;
33 _high = iLow;
34 }
35}
◆ center()
float Range::center |
( |
void | | ) |
const |
|
inlinevirtual |
returns center.
Definition at line 129 of file Range.h.
129 {
130 return (_low + _high) / 2.;
131}
Referenced by setByCenter().
◆ dump()
int Range::dump |
( |
void | | ) |
const |
|
virtual |
displays debug information.
Definition at line 45 of file Range.cxx.
45 {
46 std::cout << _low << "~" << _high;
47 return 0;
48}
◆ high() [1/2]
float Range::high |
( |
float | highIn | ) |
|
|
inlinevirtual |
sets higher limit.
Definition at line 122 of file Range.h.
122 {
123 if (i < _low) i = _low;
124 return _high = i;
125}
◆ high() [2/2]
float Range::high |
( |
void | | ) |
const |
|
inlinevirtual |
◆ low() [1/2]
float Range::low |
( |
float | lowIn | ) |
|
|
inlinevirtual |
sets lower limit.
Definition at line 109 of file Range.h.
109 {
110 if (i > _high) i = _high;
111 return _low = i;
112}
◆ low() [2/2]
float Range::low |
( |
void | | ) |
const |
|
inlinevirtual |
◆ operator!=()
bool Range::operator!= |
( |
const Range & | a | ) |
const |
|
inline |
returns true if range is different.
Definition at line 205 of file Range.h.
205 {
206 if ((* this) == a) return false;
207 return true;
208}
◆ operator&()
bool Range::operator& |
( |
const Range & | a | ) |
const |
|
inline |
returns true if two are overlaped each other.
Definition at line 212 of file Range.h.
212 {
217 return false;
218}
bool within(const float value) const
returns true if given value is within a range.
◆ operator=()
Copy operator.
Definition at line 163 of file Range.h.
163 {
166 return * this;
167}
◆ operator==()
bool Range::operator== |
( |
const Range & | a | ) |
const |
returns true if range is the same.
Definition at line 38 of file Range.cxx.
38 {
39 if (_low != a.
low())
return false;
40 if (_high != a.
high())
return false;
41 return true;
42}
◆ set()
Range & Range::set |
( |
float | low, |
|
|
float | high ) |
|
inlinevirtual |
sets range.
Definition at line 141 of file Range.h.
141 {
142 if (iHigh > iLow) {
143 _low = iLow;
144 _high = iHigh;
145 }
146 else {
147 _low = iHigh;
148 _high = iLow;
149 }
150 return * this;
151}
◆ setByCenter()
Range & Range::setByCenter |
( |
float | center, |
|
|
float | width ) |
|
inlinevirtual |
sets range by center and width.
Definition at line 155 of file Range.h.
155 {
158 return * this;
159}
virtual float width(void) const
returns width.
virtual float center(void) const
returns center.
◆ width()
float Range::width |
( |
void | | ) |
const |
|
inlinevirtual |
returns width.
Definition at line 135 of file Range.h.
135 {
136 return (_high - _low);
137}
Referenced by setByCenter().
◆ within() [1/2]
bool Range::within |
( |
const float | value | ) |
const |
|
inline |
returns true if given value is within a range.
Definition at line 171 of file Range.h.
171 {
172 if (_low == -999. && _high == -999.) {
173 return false;
174 }
175 if (_low == -999.) {
176 if (f <= _high) return true;
177 return false;
178 }
179 if (_high == -999.) {
180 if (f >= _low) return true;
181 }
182 if (f >= _low && f <= _high) return true;
183 return false;
184}
Referenced by operator&(), and within().
◆ within() [2/2]
returns true if given Range is within(included in) a range.
Definition at line 222 of file Range.h.
222 {
224 return false;
225}
◆ within2()
bool Range::within2 |
( |
const float | value | ) |
const |
|
inline |
returns true if given value is within a range.
Definition at line 188 of file Range.h.
188 {
189 if (_low == -999. && _high == -999.) {
190 return true;
191 }
192 if (_low == -999.) {
193 if (f <= _high) return true;
194 return false;
195 }
196 if (_high == -999.) {
197 if (f >= _low) return true;
198 }
199 if (f >= _low && f <= _high) return true;
200 return false;
201}
The documentation for this class was generated from the following files: