Package tech.units.indriya.spi
Class Range<T>
- java.lang.Object
-
- tech.units.indriya.spi.Range<T>
-
- Type Parameters:
T- The value of the range.
- All Implemented Interfaces:
tech.uom.lib.common.function.MaximumSupplier<T>,tech.uom.lib.common.function.MinimumSupplier<T>
- Direct Known Subclasses:
QuantityRange
public abstract class Range<T> extends java.lang.Object implements tech.uom.lib.common.function.MinimumSupplier<T>, tech.uom.lib.common.function.MaximumSupplier<T>A Range is a pair ofTitems that represent a range of values.Subclasses of Range should be immutable.
- Since:
- 1.0
- Version:
- 1.0, December 29, 2017
- See Also:
- Wikipedia: Range
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleancontains(T t)Checks whether the givenTis within this rangebooleanequals(java.lang.Object obj)TgetMaximum()Returns the largest value of the range.TgetMinimum()Returns the smallest value of the range.TgetResolution()Returns the resolution of the range.inthashCode()booleanhasMaximum()Method to easily check ifgetMaximum()is notnull.booleanhasMinimum()Method to easily check ifgetMinimum()is notnull.java.lang.StringtoString()
-
-
-
Method Detail
-
getMinimum
public T getMinimum()
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:
getMinimumin interfacetech.uom.lib.common.function.MinimumSupplier<T>- Returns:
- the minimum value
-
getMaximum
public T getMaximum()
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:
getMaximumin interfacetech.uom.lib.common.function.MaximumSupplier<T>- Returns:
- the maximum value
-
getResolution
public T getResolution()
Returns the resolution of the range. The value is the same as that given as the constructor parameter for the largest value.- Returns:
- resolution of the range, the value is the same as that given as the constructor parameter for the resolution
-
hasMinimum
public boolean hasMinimum()
Method to easily check ifgetMinimum()is notnull.- Returns:
trueifgetMinimum()is notnull.
-
hasMaximum
public boolean hasMaximum()
Method to easily check ifgetMaximum()is notnull.- Returns:
trueifgetMaximum()is notnull.
-
contains
public abstract boolean contains(T t)
Checks whether the givenTis within this range- Parameters:
t-- Returns:
- true if the value is within the range
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-