Package org.yamcs.studio.data.formula
Class Range
java.lang.Object
org.yamcs.studio.data.formula.Range
A range of numeric values.
For the purpose of range calculation, NaNs should be skipped. The only case where NaNs are allowed is for the UNDEFINED range.
The minimum and maximum are simply double values.
-
Method Summary
Modifier and TypeMethodDescriptionDetermines the range that can contain both ranges.boolean
contains
(double value) Determines whether the value is contained by the range or not.boolean
Determines whether the given range is contained by the range or not.static Range
create
(double minValue, double maxValue) Range from given min and max.boolean
double
The maximum value.double
The minimum value.int
hashCode()
boolean
isFinite()
Whether the range is finite and non-zero.boolean
Whether the range goes from min to max or from max to min.double
normalize
(double value) Returns the value normalized within the range.toString()
static Range
An undefined range.
-
Method Details
-
getMinimum
public double getMinimum()The minimum value.- Returns:
- a value
-
getMaximum
public double getMaximum()The maximum value.- Returns:
- a value
-
isReversed
public boolean isReversed()Whether the range goes from min to max or from max to min.- Returns:
- true if range should be traversed from max to min
-
isFinite
public boolean isFinite()Whether the range is finite and non-zero.- Returns:
- true if range is finite and non-zero
-
normalize
public double normalize(double value) Returns the value normalized within the range. It performs a linear transformation where the minimum value of the range becomes 0 while the maximum becomes 1.- Parameters:
value
- a value- Returns:
- the value transformed based on the range
-
contains
public boolean contains(double value) Determines whether the value is contained by the range or not.- Parameters:
value
- a value- Returns:
- true if the value is within the range
-
contains
Determines whether the given range is contained by the range or not.- Parameters:
range
- a range- Returns:
- true if the range is a subrange of this
-
combine
Determines the range that can contain both ranges. If one of the ranges in contained in the other, the bigger range is returned.- Parameters:
other
- another range- Returns:
- the bigger range
-
undefined
An undefined range.- Returns:
- the undefined range
-
toString
-
equals
-
hashCode
public int hashCode() -
create
Range from given min and max. If max is greater than min, a reversed range is returned.- Parameters:
minValue
- minimum valuemaxValue
- maximum value- Returns:
- the range
-