Class ConvertedRange

All Implemented Interfaces:
Serializable, Formattable, CheckedContainer<Double>, Emptiable

final class ConvertedRange extends MeasurementRange<Double>
Range of real values computed from the range of the sample values. The Category.toConverse conversion is used by the caller for computing the inclusive and exclusive minimum and maximum values of this range. We compute both the inclusive and exclusive values because we cannot rely on the default implementation, which looks for the nearest representable number. For example if the range of sample values is 0 to 10 exclusive (or 0 to 9 inclusive) and the scale is 2, then the range of real values is 0 to 20 exclusive or 0 to 18 inclusive, not 0 to 19.9999… The numbers between 18 and 20 is a "gray area" where we don't know for sure what the user intents to do.
Since:
1.0
Version:
1.0
  • Field Details

  • Constructor Details

    • ConvertedRange

      ConvertedRange(double[] extremums, boolean isMinIncluded, boolean isMaxIncluded, javax.measure.Unit<?> unit)
      Constructs a range of double values.
    • ConvertedRange

      private ConvertedRange(NumberRange<Double> union, ConvertedRange r1, NumberRange<Double> r2)
      Completes the union computed by Range.union(Range) with the unions of alternative extremum.
  • Method Details

    • union

      public Range<Double> union(Range<Double> range)
      Returns the union of this range with the given range.
      Overrides:
      union in class MeasurementRange<Double>
      Parameters:
      range - the range to add to this range.
      Returns:
      the union of this range with the given range.
    • getMinDouble

      public double getMinDouble(boolean inclusive)
      Returns the minimum value with the specified inclusive or exclusive state.
      Overrides:
      getMinDouble in class NumberRange<Double>
      Parameters:
      inclusive - true for the minimum value inclusive, or false for the minimum value exclusive.
      Returns:
      the minimum value, inclusive or exclusive as requested.
    • getMaxDouble

      public double getMaxDouble(boolean inclusive)
      Returns the maximum value with the specified inclusive or exclusive state.
      Overrides:
      getMaxDouble in class NumberRange<Double>
      Parameters:
      inclusive - true for the maximum value inclusive, or false for the maximum value exclusive.
      Returns:
      the maximum value, inclusive or exclusive as requested.