OpenMS
|
Base class for a simple range with minimum and maximum. More...
#include <OpenMS/KERNEL/RangeManager.h>
Public Member Functions | |
RangeBase ()=default | |
C'tor: initialize with empty range. More... | |
RangeBase (const double min, const double max) | |
RangeBase (const RangeBase &rhs)=default | |
Copy C'tor. More... | |
RangeBase (RangeBase &&rhs) noexcept=default | |
Move C'tor (seems useless, but is required for completeness in derived classes' move c'tor) More... | |
RangeBase & | operator= (const RangeBase &rhs)=default |
Assignment operator. More... | |
RangeBase & | operator= (RangeBase &&rhs) noexcept=default |
Move assignment (seems useless, but is required for completeness in derived classes' move c'tor) More... | |
~RangeBase () noexcept=default | |
D'tor. More... | |
operator RangeRT () const | |
conversion operator to allow accepting a RangeBase (instead of RangeRT) for the implicitly defined special members, e.g. assignment operator (RangeRT& operator=(const RangeRT&)) More... | |
operator RangeMZ () const | |
conversion operator to allow accepting a RangeBase (instead of RangeMZ) for the implicitly defined special members, e.g. assignment operator (RangeMZ& operator=(const RangeMZ&)) More... | |
operator RangeIntensity () const | |
conversion operator to allow accepting a RangeBase (instead of RangeIntensity) for the implicitly defined special members, e.g. assignment operator (RangeIntensity& operator=(const RangeIntensity&)) More... | |
operator RangeMobility () const | |
conversion operator to allow accepting a RangeBase (instead of RangeMobility) for the implicitly defined special members, e.g. assignment operator (RangeMobility& operator=(const RangeMobility&)) More... | |
void | clear () |
make the range empty, i.e. isEmpty() will be true More... | |
bool | isEmpty () const |
is the range empty (i.e. min > max)? 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 | extendLeftRight (const double by) |
void | minSpanIfSingular (const double min_span) |
If the current range is a single point, e.g. min==max, then extend the range by min_span / 2 on either side. More... | |
void | clampTo (const RangeBase &other) |
void | pushInto (const RangeBase &sandbox) |
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 | shift (const double distance) |
double | center () const |
double | getSpan () const |
bool | operator== (const RangeBase &rhs) const |
std::pair< double, double > | getNonEmptyRange () const |
Return the current range, or (if empty) a full range (-1e308, 1e308). More... | |
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>::lowest() |
Base class for a simple range with minimum and maximum.
|
default |
C'tor: initialize with empty range.
|
inline |
Custom C'tor to set min and max
Exception::InvalidRange | if min > max |
Move C'tor (seems useless, but is required for completeness in derived classes' move c'tor)
|
defaultnoexcept |
D'tor.
|
inline |
Compute the center point of the range If range is empty(), 'nan' will be returned
|
inline |
Ensure the range of this does not exceed the range of other
. If other
already contains() this range, nothing changes. If this range is entirely outside the range of other
, the resulting range is empty. Empty ranges are not modified.
Exception::InvalidRange | if other is empty |
References RangeBase::isEmpty(), RangeBase::max_, and RangeBase::min_.
|
inline |
make the range empty, i.e. isEmpty() will be true
Referenced by RangeManager< RangeBases >::clear().
|
inline |
is value
within [min, max]?
Referenced by RangeIntensity::containsIntensity(), RangeMobility::containsMobility(), RangeMZ::containsMZ(), RangeRT::containsRT(), and RangeBase::pushInto().
|
inline |
is the range inner_range
within [min, max]?
References OpenMS::Math::contains(), 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 |
Extend the range by by
units to left and right Using negative values will shrink the range. It may become empty. Calling this on an empty range will not have any effect.
|
inline |
only useful if isEmpty() returns false
Referenced by DimMapper< N_DIM >::mapRange().
|
inline |
only useful if isEmpty() returns false
Referenced by DimMapper< N_DIM >::mapRange().
|
inline |
Return the current range, or (if empty) a full range (-1e308, 1e308).
|
inline |
Get the 'width' of the range If range is empty(), 'nan' will be returned
Referenced by RangeBase::pushInto().
|
inline |
is the range empty (i.e. min > max)?
Referenced by RangeBase::clampTo(), DimMapper< N_DIM >::mapRange(), and RangeBase::pushInto().
|
inline |
If the current range is a single point, e.g. min==max, then extend the range by min_span
/ 2 on either side.
Calling span() afterwards, returns min_span
.
operator RangeIntensity | ( | ) | const |
conversion operator to allow accepting a RangeBase (instead of RangeIntensity) for the implicitly defined special members, e.g. assignment operator (RangeIntensity& operator=(const RangeIntensity&))
operator RangeMobility | ( | ) | const |
conversion operator to allow accepting a RangeBase (instead of RangeMobility) for the implicitly defined special members, e.g. assignment operator (RangeMobility& operator=(const RangeMobility&))
operator RangeMZ | ( | ) | const |
operator RangeRT | ( | ) | const |
Move assignment (seems useless, but is required for completeness in derived classes' move c'tor)
|
inline |
References RangeBase::max_, and RangeBase::min_.
|
inline |
Move range of *this to min/max of sandbox
, without changing the span, if possible. This does tighten the range unless sandbox's
ranges are smaller than *this. Empty ranges are not modified.
sandbox | Range to translate/move the current range into |
Exception::InvalidRange | if sandbox is empty |
References RangeBase::contains(), RangeBase::getSpan(), RangeBase::isEmpty(), 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)
|
inline |
Move the range by distance
(negative values shift left) Shifting an empty range will not have any effect.
|
protected |
Referenced by RangeBase::clampTo(), RangeBase::contains(), RangeBase::extend(), RangeBase::operator==(), and RangeBase::pushInto().
|
protected |
Referenced by RangeBase::clampTo(), RangeBase::contains(), RangeBase::extend(), RangeBase::operator==(), and RangeBase::pushInto().