Package org.ka2ddo.yaac.osm
Interface QuantityUnitMeasure<T extends Enum>
public interface QuantityUnitMeasure<T extends Enum>
This interface tags a class that contains a magnitude value and unit thereof.
All such classes must provide a one-arg constructor that takes a float primitive.
- Author:
- Andrew Pavlin, KA2DDO
-
Method Summary
Modifier and TypeMethodDescriptionfloat
Get the magnitude of this value in its unit.float
getMagnitude
(T unit) Get this length in the specified units.float
Get the magnitude of this value in the default unit for the value class, scaling it if stored in a different unit.getUnit()
Get the unit in which the magnitude is measured.
-
Method Details
-
getUnit
T getUnit()Get the unit in which the magnitude is measured.- Returns:
UnitEnum
of the unit
-
getMagnitude
float getMagnitude()Get the magnitude of this value in its unit.- Returns:
- float value
-
getMagnitudeInDefaultUnit
float getMagnitudeInDefaultUnit()Get the magnitude of this value in the default unit for the value class, scaling it if stored in a different unit.- Returns:
- float value
-
getMagnitude
Get this length in the specified units.- Parameters:
unit
-UnitEnum
for scaling the value- Returns:
- float value converted to the specified units
-