Q
- the type of the Quantity
resultpublic interface QuantityFactory<Q extends Quantity<Q>>
Quantity
,
Unit
Modifier and Type | Method and Description |
---|---|
Quantity<Q> |
create(java.lang.Number value,
Unit<Q> unit)
Returns the quantity for the specified number stated in the specified unit.
|
Unit<Q> |
getSystemUnit()
Returns the system unit for quantities produced by this factory or
null if unknown. |
Quantity<Q> create(java.lang.Number value, Unit<Q> unit)
value
- the numeric value stated in the specified unitunit
- the unitUnit<Q> getSystemUnit()
null
if unknown.
Because the system unit is unique by quantity type, it can be be used to identify the quantity given the unit. For example:
static boolean isAngularSpeed( Unit<?> unit) { return unit.getSystemUnit().equals(RADIAN.divide(SECOND)); } assert isAngularSpeed(REVOLUTION.divide(MINUTE)); // Returns true.
Unit.getSystemUnit()
Copyright © 2014–2018 Jean-Marie Dautelle, Werner Keil, Otavio Santana. All rights reserved.