Class Ranges

java.lang.Object
org.yamcs.studio.data.formula.Ranges

public class Ranges extends Object
Utility classes to compute ranges.
  • Constructor Details

    • Ranges

      public Ranges()
  • Method Details

    • absRange

      public static Range absRange(Range range)
      Returns the range of the absolute values within the range.

      If the range is all positive, it returns the same range.

      Parameters:
      range - a range
      Returns:
      the range of the absolute values
    • range

      public static Range range(double minValue, double maxValue)
      Range from given min and max.
      Parameters:
      minValue - minimum value
      maxValue - maximum value
      Returns:
      the range
    • sum

      public static Range sum(Range range1, Range range2)
      Determines the range that can contain both ranges. If one of the ranges in contained in the other, the bigger range is returned.
      Parameters:
      range1 - a range
      range2 - another range
      Returns:
      the bigger range
    • aggregateRange

      public static Range aggregateRange(Range dataRange, Range aggregatedRange)
      Increases the given aggregated range with the new data range.

      TODO: maybe this should be re-thought: it's the same as sum with different null handling. Maybe a RangeAggregator utility class that also handles numbers?

      Parameters:
      dataRange - the new data range; can't be null
      aggregatedRange - the old aggregated range; can be null
      Returns:
      a range big enough to contain both ranges
    • overlap

      public static double overlap(Range range, Range otherRange)
      Percentage, from 0 to 1, of the first range that is contained by the second range.
      Parameters:
      range - the range to be contained by the second
      otherRange - the range that has to contain the first
      Returns:
      from 0 (if there is no intersection) to 1 (if the ranges are the same)