Package net.sf.basedb.util.units
Interface UnitConverter
- All Known Implementing Classes:
IdentityUnitConverter
,LinearUnitConverter
public interface UnitConverter
Interface for converting values between two units. A unit converter
implemenation usually has a notion of a specific unit and
a reference unit, which are the two units the converter can
convert values from.
If rounding errors and truncation is ignored the following should
hold for any implementation:
value == converter.convertFrom(converter.convertTo(value))
- Version:
- 2.9
- Author:
- Nicklas
- Last modified
- $Date: 2008-09-25 09:01:30 +0200 (to, 25 sep 2008) $
-
Method Summary
Modifier and TypeMethodDescriptiondouble
convertToReferenceUnit
(double specificValue) Convert a value from the specific unit to the reference unit.double
convertToSpecificUnit
(double referenceValue) Convert a value from the reference unit to the specific unit.
-
Method Details
-
convertToReferenceUnit
double convertToReferenceUnit(double specificValue) Convert a value from the specific unit to the reference unit.- Parameters:
specificValue
- The value to convert- Returns:
- The converted value
-
convertToSpecificUnit
double convertToSpecificUnit(double referenceValue) Convert a value from the reference unit to the specific unit.- Parameters:
referenceValue
- The reference value- Returns:
- The converted value
-