Package com.ibm.icu.impl.units
Class UnitsConverter
java.lang.Object
com.ibm.icu.impl.units.UnitsConverter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enum(package private) static classResponsible for all the Factor operation NOTE: This class is immutable -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BigDecimalprivate static final BigDecimal[]private BigDecimalprivate booleanprivate Stringprivate String -
Constructor Summary
ConstructorsConstructorDescriptionUnitsConverter(MeasureUnitImpl source, MeasureUnitImpl target, ConversionRates conversionRates) Constructor ofUnitsConverter.UnitsConverter(String sourceIdentifier, String targetIdentifier) Constructor ofUnitsConverter. -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanareDimensionsZeroes(HashMap<String, Integer> dimensionMap) private BigDecimalbaseToScale(BigDecimal baseValue, BigDecimal[] minBaseForScaleValues) convert(BigDecimal inputValue) convertInverse(BigDecimal inputValue) extractConvertibility(MeasureUnitImpl source, MeasureUnitImpl target, ConversionRates conversionRates) private static voidinsertInMap(HashMap<String, Integer> dimensionMap, ArrayList<SingleUnitImpl> singleUnits, int multiplier) Helpersprivate BigDecimalscaleToBase(BigDecimal scaleValue, BigDecimal[] minBaseForScaleValues) toString()
-
Field Details
-
conversionRate
-
reciprocal
private boolean reciprocal -
offset
-
specialSource
-
specialTarget
-
minMetersPerSecForBeaufort
-
-
Constructor Details
-
UnitsConverter
Constructor ofUnitsConverter. NOTE: - source and target must be under the same category - e.g. meter to mile --> both of them are length units.NOTE: This constructor creates an instance of
UnitsConverterinternally.- Parameters:
sourceIdentifier- represents the source unit identifier.targetIdentifier- represents the target unit identifier.
-
UnitsConverter
public UnitsConverter(MeasureUnitImpl source, MeasureUnitImpl target, ConversionRates conversionRates) Constructor ofUnitsConverter. NOTE: - source and target must be under the same category - e.g. meter to mile --> both of them are length units. This converts from source to base to target (one of those may be a no-op).- Parameters:
source- represents the source unit.target- represents the target unit.conversionRates- contains all the needed conversion rates.
-
-
Method Details
-
extractConvertibility
public static UnitsConverter.Convertibility extractConvertibility(MeasureUnitImpl source, MeasureUnitImpl target, ConversionRates conversionRates) -
insertInMap
private static void insertInMap(HashMap<String, Integer> dimensionMap, ArrayList<SingleUnitImpl> singleUnits, int multiplier) Helpers -
areDimensionsZeroes
-
convert
-
convertInverse
-
scaleToBase
-
baseToScale
-
getConversionInfo
-
toString
-