Class DoubleRange

java.lang.Object
org.yamcs.xtce.util.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:
  • Constructor Details

    • DoubleRange

      public DoubleRange(double min, double max, boolean minIncl, boolean maxIncl)
    • DoubleRange

      public DoubleRange(double minInclusive, double maxInclusive)
    • DoubleRange

      public DoubleRange(DoubleRange range)
  • Method Details

    • 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)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object