Class QuantityRange<Q extends Quantity<Q>>

  • Type Parameters:
    Q - The value of the range.
    All Implemented Interfaces:
    Range<Quantity<Q>>, tech.uom.lib.common.function.MaximumSupplier<Quantity<Q>>, tech.uom.lib.common.function.MinimumSupplier<Quantity<Q>>

    public class QuantityRange<Q extends Quantity<Q>>
    extends Object
    implements Range<Quantity<Q>>
    A Quantity Range is a pair of Quantity items that represent a Range of values.

    Range limits MUST be presented in the same scale and have the same unit as measured data values.
    Subclasses of QuantityRange should be final and immutable.

    Version:
    2.1, Dec 7, 2023
    Author:
    Werner Keil
    See Also:
    SensorML: QuantityRange
    • Constructor Detail

      • QuantityRange

        protected QuantityRange​(Quantity<Q> minimum,
                                Quantity<Q> maximum,
                                Quantity<Q> resolution)
        Construct an instance of QuantityRange with a min, max and res value.
        Parameters:
        minimum - The minimum value for the range.
        maximum - The maximum value for the range.
        resolution - The resolution of the range.
    • Method Detail

      • of

        public static QuantityRange of​(Quantity minimum,
                                       Quantity maximum,
                                       Quantity resolution)
        Returns an QuantityRange with the specified values.
        Parameters:
        minimum - The minimum value for the quantity range.
        maximum - The maximum value for the quantity range.
        resolution - The resolution of the quantity range.
        Returns:
        an QuantityRange with the given values
      • of

        public static QuantityRange of​(Quantity minimum,
                                       Quantity maximum)
        Returns an QuantityRange with the specified values.
        Parameters:
        minimum - The minimum value for the quantity range.
        maximum - The maximum value for the quantity range.
        Returns:
        a QuantityRange with the given values
      • contains

        public boolean contains​(Quantity<Q> q)
        Description copied from interface: Range
        Checks whether the given T is within this range
        Specified by:
        contains in interface Range<Q extends Quantity<Q>>
        Returns:
        true if the value is within the range
      • getMinimum

        public Quantity<QgetMinimum()
        Description copied from interface: Range
        Returns the smallest value of the range. The value is the same as that given as the constructor parameter for the smallest value.
        Specified by:
        getMinimum in interface tech.uom.lib.common.function.MinimumSupplier<Q extends Quantity<Q>>
        Specified by:
        getMinimum in interface Range<Q extends Quantity<Q>>
        Returns:
        the minimum value
      • getMaximum

        public Quantity<QgetMaximum()
        Description copied from interface: Range
        Returns the largest value of the range. The value is the same as that given as the constructor parameter for the largest value.
        Specified by:
        getMaximum in interface tech.uom.lib.common.function.MaximumSupplier<Q extends Quantity<Q>>
        Specified by:
        getMaximum in interface Range<Q extends Quantity<Q>>
        Returns:
        the maximum value
      • getResolution

        public Quantity<QgetResolution()
        Description copied from interface: Range
        Returns the resolution of the range. The value is the same as that given as the constructor parameter for the largest value.
        Specified by:
        getResolution in interface Range<Q extends Quantity<Q>>
        Returns:
        resolution of the range, the value is the same as that given as the constructor parameter for the resolution