Package tech.units.indriya.quantity
Class QuantityRange<Q extends Quantity<Q>>
- java.lang.Object
-
- tech.units.indriya.quantity.QuantityRange<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 ofQuantityitems that represent aRangeof values.Range limits MUST be presented in the same scale and have the same unit as measured data values.
Subclasses of QuantityRange should befinaland immutable.- Version:
- 2.1, Dec 7, 2023
- Author:
- Werner Keil
- See Also:
- SensorML: QuantityRange
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Quantity<Q> q)Checks whether the givenTis within this rangebooleanequals(Object obj)Quantity<Q>getMaximum()Returns the largest value of the range.Quantity<Q>getMinimum()Returns the smallest value of the range.Quantity<Q>getResolution()Returns the resolution of the range.inthashCode()booleanhasMaximum()Method to easily check ifRange.getMaximum()is notnull.booleanhasMinimum()Method to easily check ifRange.getMinimum()is notnull.static QuantityRangeof(Quantity minimum, Quantity maximum)Returns anQuantityRangewith the specified values.static QuantityRangeof(Quantity minimum, Quantity maximum, Quantity resolution)Returns anQuantityRangewith the specified values.StringtoString()
-
-
-
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.
-
QuantityRange
protected QuantityRange(Quantity<Q> min, Quantity<Q> max)
-
-
Method Detail
-
of
public static QuantityRange of(Quantity minimum, Quantity maximum, Quantity resolution)
Returns anQuantityRangewith 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
QuantityRangewith the given values
-
of
public static QuantityRange of(Quantity minimum, Quantity maximum)
Returns anQuantityRangewith the specified values.- Parameters:
minimum- The minimum value for the quantity range.maximum- The maximum value for the quantity range.- Returns:
- a
QuantityRangewith the given values
-
contains
public boolean contains(Quantity<Q> q)
Description copied from interface:RangeChecks whether the givenTis within this range
-
getMinimum
public Quantity<Q> getMinimum()
Description copied from interface:RangeReturns the smallest value of the range. The value is the same as that given as the constructor parameter for the smallest value.
-
getMaximum
public Quantity<Q> getMaximum()
Description copied from interface:RangeReturns the largest value of the range. The value is the same as that given as the constructor parameter for the largest value.
-
getResolution
public Quantity<Q> getResolution()
Description copied from interface:RangeReturns the resolution of the range. The value is the same as that given as the constructor parameter for the largest value.- Specified by:
getResolutionin interfaceRange<Q extends Quantity<Q>>- Returns:
- resolution of the range, the value is the same as that given as the constructor parameter for the resolution
-
hasMinimum
public boolean hasMinimum()
Description copied from interface:RangeMethod to easily check ifRange.getMinimum()is notnull.- Specified by:
hasMinimumin interfaceRange<Q extends Quantity<Q>>- Returns:
trueifRange.getMinimum()is notnull.
-
hasMaximum
public boolean hasMaximum()
Description copied from interface:RangeMethod to easily check ifRange.getMaximum()is notnull.- Specified by:
hasMaximumin interfaceRange<Q extends Quantity<Q>>- Returns:
trueifRange.getMaximum()is notnull.
-
-