herschel.share.unit.converter
F - Unit format type; must be an enumpublic abstract class UnitFormatConverter<F extends java.lang.Enum<?> & UnitFormat> extends java.lang.Object implements UnitConverter
| Constructor and Description |
|---|
UnitFormatConverter() |
| Modifier and Type | Method and Description |
|---|---|
double |
convert(double value,
Unit<?> sourceUnit,
Unit<?> targetUnit)
Converts the given value, which is expressed in the
sourceUnit, in terms of the targetUnit. |
static UnitFormat |
formatOf(java.lang.Class<? extends UnitFormat> formatClass,
Unit<?> unit)
Returns the format of the given unit.
|
public static UnitFormat formatOf(java.lang.Class<? extends UnitFormat> formatClass, Unit<?> unit)
formatClass - The expected format classunit - The unit whose frequency format we want to knowIncompatibleUnitException - if no format of the given class is found for the unitpublic final double convert(double value,
Unit<?> sourceUnit,
Unit<?> targetUnit)
sourceUnit, in terms of the targetUnit.convert in interface UnitConvertervalue - Original value, expressed in the sourceUnitsourceUnit - The unit in which the given value is expressedtargetUnit - The unit in which we want to express the given valuetargetUnit