Package tech.units.indriya
Interface ComparableQuantity<Q extends javax.measure.Quantity<Q>>
- Type Parameters:
Q
-
- All Superinterfaces:
Comparable<javax.measure.Quantity<Q>>
,javax.measure.Quantity<Q>
,tech.uom.lib.common.function.QuantityConverter<Q>
,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>, Comparable<javax.measure.Quantity<Q>>, tech.uom.lib.common.function.QuantityConverter<Q>, Serializable
- Since:
- 1.0
- Version:
- 1.0.2, December 29, 2017
-
Method Summary
Modifier and TypeMethodDescription<T extends javax.measure.Quantity<T>>
ComparableQuantity<T>divide
(javax.measure.Quantity<?> that) <T extends javax.measure.Quantity<T>,
E extends javax.measure.Quantity<E>>
ComparableQuantity<E>Multiply and cast theComparableQuantity
inverse()
<T extends javax.measure.Quantity<T>>
ComparableQuantity<T>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.
multiply
(javax.measure.Quantity<?> multiplier) <T extends javax.measure.Quantity<T>,
E extends javax.measure.Quantity<E>>
ComparableQuantity<E>Divide and cast theComparableQuantity
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface javax.measure.Quantity
getUnit, getValue
-
Method Details
-
add
-
subtract
-
divide
-
divide
-
multiply
-
multiply
-
inverse
ComparableQuantity<?> inverse() -
inverse
invert and already cast to defined quantityClass- Parameters:
quantityClass
- Quantity to be converted- See Also:
-
Quantity.inverse()
Quantity.asType(Class)
-
to
-
asType
<T extends javax.measure.Quantity<T>> ComparableQuantity<T> asType(Class<T> type) throws ClassCastException - Specified by:
asType
in interfacejavax.measure.Quantity<Q extends javax.measure.Quantity<Q>>
- Throws:
ClassCastException
- See Also:
-
Quantity.asType(Class)
-
isGreaterThan
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:
NullPointerException
- if the that is null
-
isGreaterThanOrEqualTo
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:
NullPointerException
- if the that is null
-
isLessThan
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:
NullPointerException
- if the quantity is null
-
isLessThanOrEqualTo
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:
NullPointerException
- if the quantity is null
-
isEquivalentOf
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:
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, Class<E> asTypeQuantity) Multiply and cast theComparableQuantity
- Parameters:
that
- quantity to be multipliedasTypeQuantity
- quantity to be converted- Returns:
- the QuantityOperations multiplied and converted
- Throws:
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, Class<E> asTypeQuantity) Divide and cast theComparableQuantity
- Parameters:
that
- quantity to be dividedasTypeQuantity
- quantity to be converted- Returns:
- the QuantityOperations multiplied and converted
- Throws:
NullPointerException
- See Also:
-
QuantityOperations
QuantityOperations#of(Quantity, Class)
Quantity.asType(Class)
Quantity.multiply(Quantity)
-