Package com.ibm.icu.impl.units
Class UnitsConverter
java.lang.Object
com.ibm.icu.impl.units.UnitsConverter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static enum
(package private) static class
Responsible for all the Factor operation NOTE: This class is immutable -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BigDecimal
private static final BigDecimal[]
private BigDecimal
private boolean
private String
private 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 boolean
areDimensionsZeroes
(HashMap<String, Integer> dimensionMap) private BigDecimal
baseToScale
(BigDecimal baseValue, BigDecimal[] minBaseForScaleValues) convert
(BigDecimal inputValue) convertInverse
(BigDecimal inputValue) extractConvertibility
(MeasureUnitImpl source, MeasureUnitImpl target, ConversionRates conversionRates) private static void
insertInMap
(HashMap<String, Integer> dimensionMap, ArrayList<SingleUnitImpl> singleUnits, int multiplier) Helpersprivate BigDecimal
scaleToBase
(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
UnitsConverter
internally.- 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
-