OpenMS
2.8.0
|
Base class for a simple range with minimum and maximum. More...
#include <OpenMS/KERNEL/RangeManager.h>
Public Member Functions | |
RangeBase ()=default | |
Ctor: initialize with empty range. More... | |
RangeBase (const double min, const double max) | |
void | clear () |
make the range empty, i.e. isEmpty() will be true More... | |
bool | isEmpty () const |
is the range empty (i.e. default constructed or cleared using clear())? More... | |
bool | contains (const double value) const |
is value within [min, max]? More... | |
bool | contains (const RangeBase &inner_range) const |
is the range inner_range within [min, max]? More... | |
void | extend (const RangeBase &other) |
ensure the range includes the range of other More... | |
void | extend (const double value) |
extend the range such that it includes the given value More... | |
void | scaleBy (const double factor) |
Scale the range of the dimension by a factor . A factor > 1 increases the range; factor < 1 decreases it. More... | |
void | assign (const RangeBase &rhs) |
bool | operator== (const RangeBase &rhs) const |
Accessors for min and max | |
We use accessors, to keep range consistent (i.e. ensure that min <= max) | |
void | setMin (const double min) |
sets the minimum (and the maximum, if uninitialized) More... | |
void | setMax (const double max) |
sets the maximum (and the minimum, if uninitialized) More... | |
double | getMin () const |
only useful if isEmpty() returns false More... | |
double | getMax () const |
only useful if isEmpty() returns false More... | |
Protected Attributes | |
double | min_ = std::numeric_limits<double>::max() |
double | max_ = -std::numeric_limits<double>::max() |
Base class for a simple range with minimum and maximum.
|
default |
Ctor: initialize with empty range.
|
inline |
set min and max
Exception::InvalidRange | if min > max |
|
inline |
|
inline |
make the range empty, i.e. isEmpty() will be true
|
inline |
is value
within [min, max]?
Referenced by RangeIntensity::containsIntensity(), RangeMobility::containsMobility(), RangeMZ::containsMZ(), and RangeRT::containsRT().
|
inline |
is the range inner_range
within [min, max]?
References RangeBase::max_, and RangeBase::min_.
|
inline |
extend the range such that it includes the given value
|
inline |
ensure the range includes the range of other
References RangeBase::max_, and RangeBase::min_.
|
inline |
only useful if isEmpty() returns false
|
inline |
only useful if isEmpty() returns false
|
inline |
is the range empty (i.e. default constructed or cleared using clear())?
|
inline |
References RangeBase::max_, and RangeBase::min_.
|
inline |
Scale the range of the dimension by a factor
. A factor > 1 increases the range; factor < 1 decreases it.
Let d = max - min; then min = min - d*(factor-1)/2, i.e. scale(1.5) extends the range by 25% on each side.
Scaling an empty range will not have any effect.
factor | The multiplier to increase the range by |
|
inline |
sets the maximum (and the minimum, if uninitialized)
|
inline |
sets the minimum (and the maximum, if uninitialized)
|
protected |
Referenced by RangeBase::contains(), RangeBase::extend(), and RangeBase::operator==().
|
protected |
Referenced by RangeBase::contains(), RangeBase::extend(), and RangeBase::operator==().