Package javax.measure.spi
Interface QuantityFactory<Q extends Quantity<Q>>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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 ornull
if unknown.
-
-
-
Method Detail
-
create
Quantity<Q> create(java.lang.Number value, Unit<Q> unit)
Returns the quantity for the specified number stated in the specified unit.- Parameters:
value
- the numeric value stated in the specified unitunit
- the unit- Returns:
- the corresponding quantity
-
getSystemUnit
Unit<Q> getSystemUnit()
Returns the system unit for quantities produced by this factory ornull
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.
- Returns:
- the system unit for this factory.
- See Also:
Unit.getSystemUnit()
-
-