Q
- the type of the Quantity
resultpublic interface QuantityFactory<Q extends Quantity<Q>>
Unit
arguments to create a Quantity
result.
This is a functional interface
whose functional method is create(Number, Unit)
.
Quantity<Q> create(Number value, Unit<Q> unit)
number
- 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–2015 Jean-Marie Dautelle, Werner Keil, V2COM. All rights reserved.