Q
- the type of the Quantity
resultpublic interface QuantityFactory<Q extends Quantity<Q>>
Quantity<Q> create(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–2016 Jean-Marie Dautelle, Werner Keil, V2COM. All rights reserved.