Package org.yamcs.utils
Class DoubleRange
- java.lang.Object
-
- org.yamcs.utils.DoubleRange
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
FloatValidRange
public class DoubleRange extends Object implements Serializable
A range of numbers [min, max) where both min and max can be inclusive or exclusive.Both min and max can be Double.NaN meaning that the range is open at that end.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DoubleRange(double minInclusive, double maxInclusive)
DoubleRange(double min, double max, boolean minIncl, boolean maxIncl)
DoubleRange(DoubleRange range)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
static DoubleRange
fromXtceComplement(double minExclusive, double maxExclusive, double minInclusive, double maxInclusive)
Returns a range from the XTCE float range used for alarms which is in fact a union of two rangesdouble
getMax()
double
getMin()
int
hashCode()
int
inRange(double v)
Checks if the value is in range.DoubleRange
intersectWith(DoubleRange other)
E.g. a low limit of ]-Infinity, -22] and a high limit of [40, +Infinity[ intersect to [-22, 40] (which for practical purposes is actually the range inside of which pvals are _not_ out of limits)boolean
isMaxInclusive()
boolean
isMinInclusive()
String
toString()
-
-
-
Constructor Detail
-
DoubleRange
public DoubleRange(double min, double max, boolean minIncl, boolean maxIncl)
-
DoubleRange
public DoubleRange(double minInclusive, double maxInclusive)
-
DoubleRange
public DoubleRange(DoubleRange range)
-
-
Method Detail
-
fromXtceComplement
public static DoubleRange fromXtceComplement(double minExclusive, double maxExclusive, double minInclusive, double maxInclusive)
Returns a range from the XTCE float range used for alarms which is in fact a union of two ranges- Parameters:
minExclusive
-maxExclusive
-minInclusive
-maxInclusive
-- Returns:
-
getMax
public double getMax()
-
getMin
public double getMin()
-
isMinInclusive
public boolean isMinInclusive()
-
isMaxInclusive
public boolean isMaxInclusive()
-
inRange
public int inRange(double v)
Checks if the value is in range.- Parameters:
v
-- Returns:
- <0 =0 or >0 if the value v is lower than min, between min and max or greater than max respectively.
-
intersectWith
public DoubleRange intersectWith(DoubleRange other)
E.g. a low limit of ]-Infinity, -22] and a high limit of [40, +Infinity[ intersect to [-22, 40] (which for practical purposes is actually the range inside of which pvals are _not_ out of limits)
-
-