herschel.share.unit.converter
public class DefaultUnitConverter extends java.lang.Object implements UnitConverter
Unit.getValue(double, herschel.share.unit.Unit>).| Modifier and Type | Field and Description |
|---|---|
static DefaultUnitConverter |
INSTANCE
Single instance of this class.
|
public static final DefaultUnitConverter INSTANCE
public double convert(double value,
Unit<?> sourceUnit,
Unit<?> targetUnit)
sourceUnit, in terms of the targetUnit.Both units must be compatible.
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 valuetargetUnitjava.lang.NullPointerException - if any of the units is nullIncompatibleUnitException - if the units are not compatible