Package org.vast.unit
Class GenericUnitConverter
java.lang.Object
org.vast.unit.AbstractUnitConverter
org.vast.unit.GenericUnitConverter
- All Implemented Interfaces:
UnitConverter
*
Can convert anyone unit to another by using a single scale factor and custom functions.
- Since:
- May 4, 2006
-
Field Summary
FieldsFields inherited from class org.vast.unit.AbstractUnitConverter
conversionNeeded, conversionPossible, destUnit, srcUnit -
Constructor Summary
ConstructorsConstructorDescriptionGenericUnitConverter(double conversionFactor) Default constructor using given scalefactorGenericUnitConverter(Unit srcUnit, Unit destUnit) Default constructor using given units as source and destination -
Method Summary
Modifier and TypeMethodDescriptiondoubleconvert(double value) Converts a double value expressed in sourceUnit to the corresponding value expressed in destinationUnit.Methods inherited from class org.vast.unit.AbstractUnitConverter
getDestUnit, getSrcUnit, isConversionNeeded, isConversionPossible, setDestUnit, setSrcUnit
-
Field Details
-
conversionFactor
protected double conversionFactor -
noFunctions
protected boolean noFunctions
-
-
Constructor Details
-
GenericUnitConverter
public GenericUnitConverter(double conversionFactor) Default constructor using given scalefactor- Parameters:
conversionFactor-
-
GenericUnitConverter
Default constructor using given units as source and destination- Parameters:
srcUnit-destUnit-
-
-
Method Details
-
convert
public double convert(double value) Description copied from class:AbstractUnitConverterConverts a double value expressed in sourceUnit to the corresponding value expressed in destinationUnit.- Specified by:
convertin interfaceUnitConverter- Specified by:
convertin classAbstractUnitConverter
-