public interface ITypedQuantity<U extends TypedUnit<U>> extends IQuantity
IQuantity. This construction exists to reduce clutter for
casual users of IQuantity, while still providing type safety for internal implementations.
(Proposed "self-variance" extensions to Java, in JDK 9 or beyond, may directly support this with
a single interface.)AUTO, EXACT, VERBOSE| Modifier and Type | Method and Description |
|---|---|
ITypedQuantity<U> |
add(ITypedQuantity<LinearUnit> addend) |
ITypedQuantity<U> |
floorQuantize(ITypedQuantity<LinearUnit> quanta) |
KindOfQuantity<U> |
getType()
Get the kind of this quantity.
|
U |
getUnit() |
ITypedQuantity<U> |
in(U targetUnit)
Get this quantity expressed in the unit
targetUnit. |
java.lang.String |
interactiveFormat(boolean allowCustomUnit) |
java.lang.String |
localizedFormat(boolean useBreakingSpace,
boolean allowCustomUnit) |
ITypedQuantity<U> |
multiply(double factor)
Returns a new quantity that is this quantity multiplied with
factor, if this is a
linear quantity. |
ITypedQuantity<U> |
multiply(long factor)
Returns a new quantity that is this quantity multiplied with
factor, if this is a
linear quantity. |
ITypedQuantity<LinearUnit> |
subtract(ITypedQuantity<U> subtrahend) |
add, clampedFloorIn, clampedIntFloorIn, clampedLongValueIn, doubleValue, doubleValueIn, in, interactiveFormat, isLinear, longValue, longValueIn, longValueIn, numberValue, numberValueIn, persistableString, ratioTo, subtractdisplayUsingKindOfQuantity<U> getType()
IQuantityU getUnit()
ITypedQuantity<U> in(U targetUnit)
targetUnit. Note that as a result of this
conversion, precision may be lost. Note that this method differs from IQuantity.in(IUnit) only
by stricter typing.targetUnitjava.lang.IllegalArgumentException - if targetUnit is not of the same kind of quantityITypedQuantity<U> add(ITypedQuantity<LinearUnit> addend) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionITypedQuantity<LinearUnit> subtract(ITypedQuantity<U> subtrahend) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionITypedQuantity<U> multiply(long factor) throws java.lang.UnsupportedOperationException
IQuantityfactor, if this is a
linear quantity. Otherwise, this operation is undefined and
UnsupportedOperationException will be thrown.ITypedQuantity<U> multiply(double factor) throws java.lang.UnsupportedOperationException
IQuantityfactor, if this is a
linear quantity. Otherwise, this operation is undefined and
UnsupportedOperationException will be thrown.ITypedQuantity<U> floorQuantize(ITypedQuantity<LinearUnit> quanta)
java.lang.String interactiveFormat(boolean allowCustomUnit)
java.lang.String localizedFormat(boolean useBreakingSpace,
boolean allowCustomUnit)