Package tech.units.indriya
Interface ComparableQuantity<Q extends javax.measure.Quantity<Q>>
-
- Type Parameters:
Q
-
- All Superinterfaces:
java.lang.Comparable<javax.measure.Quantity<Q>>
,javax.measure.Quantity<Q>
,tech.uom.lib.common.function.QuantityConverter<Q>
,java.io.Serializable
- All Known Implementing Classes:
AbstractQuantity
,BigIntegerQuantity
,ByteQuantity
,DecimalQuantity
,DoubleQuantity
,FloatQuantity
,IntegerQuantity
,LongQuantity
,NumberQuantity
,ShortQuantity
,TemporalQuantity
,TimeUnitQuantity
public interface ComparableQuantity<Q extends javax.measure.Quantity<Q>> extends javax.measure.Quantity<Q>, java.lang.Comparable<javax.measure.Quantity<Q>>, tech.uom.lib.common.function.QuantityConverter<Q>, java.io.Serializable
Quantity specialized for the Java SE platform. It extendsQuantity
with Comparable and Serializable- Since:
- 1.0
- Version:
- 1.0.2, December 29, 2017
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ComparableQuantity<Q>
add(javax.measure.Quantity<Q> that)
<T extends javax.measure.Quantity<T>>
ComparableQuantity<T>asType(java.lang.Class<T> type)
ComparableQuantity<Q>
divide(java.lang.Number that)
ComparableQuantity<?>
divide(javax.measure.Quantity<?> that)
<T extends javax.measure.Quantity<T>,E extends javax.measure.Quantity<E>>
ComparableQuantity<E>divide(javax.measure.Quantity<T> that, java.lang.Class<E> asTypeQuantity)
Multiply and cast theComparableQuantity
ComparableQuantity<?>
inverse()
<T extends javax.measure.Quantity<T>>
ComparableQuantity<T>inverse(java.lang.Class<T> quantityClass)
invert and already cast to defined quantityClassboolean
isEquivalentOf(javax.measure.Quantity<Q> that)
Compares two instances of, doing the conversion of unit if necessary.
boolean
isGreaterThan(javax.measure.Quantity<Q> that)
Compares two instances of.
boolean
isGreaterThanOrEqualTo(javax.measure.Quantity<Q> that)
Compares two instances of, doing the conversion of unit if necessary.
boolean
isLessThan(javax.measure.Quantity<Q> that)
Compares two instances of, doing the conversion of unit if necessary.
boolean
isLessThanOrEqualTo(javax.measure.Quantity<Q> that)
Compares two instances of, doing the conversion of unit if necessary.
ComparableQuantity<Q>
multiply(java.lang.Number multiplier)
ComparableQuantity<?>
multiply(javax.measure.Quantity<?> multiplier)
<T extends javax.measure.Quantity<T>,E extends javax.measure.Quantity<E>>
ComparableQuantity<E>multiply(javax.measure.Quantity<T> that, java.lang.Class<E> asTypeQuantity)
Divide and cast theComparableQuantity
ComparableQuantity<Q>
subtract(javax.measure.Quantity<Q> that)
ComparableQuantity<Q>
to(javax.measure.Unit<Q> unit)
-
-
-
Method Detail
-
add
ComparableQuantity<Q> add(javax.measure.Quantity<Q> that)
-
subtract
ComparableQuantity<Q> subtract(javax.measure.Quantity<Q> that)
-
divide
ComparableQuantity<?> divide(javax.measure.Quantity<?> that)
-
divide
ComparableQuantity<Q> divide(java.lang.Number that)
-
multiply
ComparableQuantity<?> multiply(javax.measure.Quantity<?> multiplier)
-
multiply
ComparableQuantity<Q> multiply(java.lang.Number multiplier)
-
inverse
ComparableQuantity<?> inverse()
-
inverse
<T extends javax.measure.Quantity<T>> ComparableQuantity<T> inverse(java.lang.Class<T> quantityClass)
invert and already cast to defined quantityClass- Parameters:
quantityClass
- Quantity to be converted- See Also:
Quantity.inverse()
,Quantity.asType(Class)
-
to
ComparableQuantity<Q> to(javax.measure.Unit<Q> unit)
-
asType
<T extends javax.measure.Quantity<T>> ComparableQuantity<T> asType(java.lang.Class<T> type) throws java.lang.ClassCastException
-
isGreaterThan
boolean isGreaterThan(javax.measure.Quantity<Q> that)
Compares two instances of. Conversion of unit can happen if necessary
- Parameters:
that
- thequantity<Q>
to be compared with this instance.- Returns:
true
ifthat > this
.- Throws:
java.lang.NullPointerException
- if the that is null
-
isGreaterThanOrEqualTo
boolean isGreaterThanOrEqualTo(javax.measure.Quantity<Q> that)
Compares two instances of, doing the conversion of unit if necessary.
- Parameters:
that
- thequantity<Q>
to be compared with this instance.- Returns:
true
ifthat >= this
.- Throws:
java.lang.NullPointerException
- if the that is null
-
isLessThan
boolean isLessThan(javax.measure.Quantity<Q> that)
Compares two instances of, doing the conversion of unit if necessary.
- Parameters:
that
- thequantity<Q>
to be compared with this instance.- Returns:
true
ifthat < this
.- Throws:
java.lang.NullPointerException
- if the quantity is null
-
isLessThanOrEqualTo
boolean isLessThanOrEqualTo(javax.measure.Quantity<Q> that)
Compares two instances of, doing the conversion of unit if necessary.
- Parameters:
that
- thequantity<Q>
to be compared with this instance.- Returns:
true
ifthat < this
.- Throws:
java.lang.NullPointerException
- if the quantity is null
-
isEquivalentOf
boolean isEquivalentOf(javax.measure.Quantity<Q> that)
Compares two instances of, doing the conversion of unit if necessary.
- Parameters:
that
- thequantity<Q>
to be compared with this instance.- Returns:
true
ifthat < this
.- Throws:
java.lang.NullPointerException
- if the quantity is null
-
divide
<T extends javax.measure.Quantity<T>,E extends javax.measure.Quantity<E>> ComparableQuantity<E> divide(javax.measure.Quantity<T> that, java.lang.Class<E> asTypeQuantity)
Multiply and cast theComparableQuantity
- Parameters:
that
- quantity to be multipliedasTypeQuantity
- quantity to be converted- Returns:
- the QuantityOperations multiplied and converted
- Throws:
java.lang.NullPointerException
- See Also:
Quantity.divide(Quantity)
,Quantity.asType(Class)
-
multiply
<T extends javax.measure.Quantity<T>,E extends javax.measure.Quantity<E>> ComparableQuantity<E> multiply(javax.measure.Quantity<T> that, java.lang.Class<E> asTypeQuantity)
Divide and cast theComparableQuantity
- Parameters:
that
- quantity to be dividedasTypeQuantity
- quantity to be converted- Returns:
- the QuantityOperations multiplied and converted
- Throws:
java.lang.NullPointerException
- See Also:
QuantityOperations
,QuantityOperations#of(Quantity, Class)
,Quantity.asType(Class)
,Quantity.multiply(Quantity)
-
-