public interface UnitValue<U extends Unit<U>> extends java.lang.Comparable<UnitValue<U>>, java.io.Serializable
Modifier and Type | Method and Description |
---|---|
UnitValue<U> |
add(UnitValue<U> other)
The method adds the quantities of two UnitValues.
|
java.math.BigDecimal |
getQuantity()
Returns the quantity
|
U |
getUnit()
Returns the Unit
|
boolean |
isZero()
The method returns true if the quantity of this UnitValue is zero.
|
UnitValue |
max(UnitValue otherUnitValue)
compare with the otherUnitValue and return the max
|
UnitValue<U> |
multiply(UnitValue<U> other)
The method multiplies the other UnitValue from this UnitValue.
|
UnitValue<U> |
round(int precision,
java.math.RoundingMode mode)
The method rounds the quantity based on the passed precision and the RoundingMode
|
UnitValue<U> |
scale(int scaleValue,
java.math.RoundingMode mode)
The method scales the quantity based on the passed scale and the RoundingMode
|
UnitValue<U> |
subtract(UnitValue<U> other)
The method subtracts the other UnitValue from this UnitValue.
|
boolean isZero()
UnitValue<U> add(UnitValue<U> other)
other
- UnitValue The UnitValue to be addedUnit.UnitMisMatchException
- If two Units can not be added.UnitValue<U> subtract(UnitValue<U> other)
other
- UnitValue The UnitValue to be subtractedUnit.UnitMisMatchException
- If the other Unit can not be subtracted.UnitValue<U> multiply(UnitValue<U> other)
other
- UnitValue The UnitValue to be multipliedUnit.UnitMisMatchException
- If the other Unit can not be subtracted.UnitValue<U> round(int precision, java.math.RoundingMode mode)
precision
- intmode
- RoundingModeUnitValue<U> scale(int scaleValue, java.math.RoundingMode mode)
scaleValue
- intmode
- RoundingModejava.math.BigDecimal getQuantity()
U getUnit()