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 TypeMethodDescriptiondouble
convert
(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:AbstractUnitConverter
Converts a double value expressed in sourceUnit to the corresponding value expressed in destinationUnit.- Specified by:
convert
in interfaceUnitConverter
- Specified by:
convert
in classAbstractUnitConverter
-