Top Inners Fields Constructors Methods
com.ibm.icu.impl.units

public Class ConversionRates

extends Object
Class Inheritance
Imports
java.math.BigDecimal, .MathContext, java.util.ArrayList, .HashMap, com.ibm.icu.impl.ICUData, .ICUResourceBundle, .UResource, com.ibm.icu.util.MeasureUnit, .UResourceBundle

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
private HashMap<String, ConversionRates.ConversionRateInfo>
mapToConversionRate

Map from any simple unit (i.e. "meter", "foot", "inch") to its basic/root conversion rate info.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private boolean

Returns:

true if the MeasureUnitImpl is simple, false otherwise.
checkSimpleUnit
(MeasureUnitImpl measureUnitImpl)

Checks if the MeasureUnitImpl is simple or not.

public ArrayList<SingleUnitImpl>
public ArrayList<SingleUnitImpl>

Returns:

The base units in the SingleUnitImpl with applying the dimensionality only and not the SI prefix.

Note

This method is helpful when checking the convertibility because no need to check convertibility.

extractBaseUnits
(SingleUnitImpl
An instance of SingleUnitImpl.
singleUnit
)

public MeasureUnitImpl
public String

Returns:

The measurement systems for the specified unit.
extractSystems
(SingleUnitImpl singleUnit)

private UnitsConverter.Factor
getFactorToBase(SingleUnitImpl singleUnit)

Extracts the factor from a SingleUnitImpl to its Basic Unit.

public UnitsConverter.Factor
protected BigDecimal
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapToConversionRateback to summary
private HashMap<String, ConversionRates.ConversionRateInfo> mapToConversionRate

Map from any simple unit (i.e. "meter", "foot", "inch") to its basic/root conversion rate info.

Constructor Detail

ConversionRatesback to summary
public ConversionRates()

Method Detail

checkSimpleUnitback to summary
private boolean checkSimpleUnit(MeasureUnitImpl measureUnitImpl)

Checks if the MeasureUnitImpl is simple or not.

Returns:boolean

true if the MeasureUnitImpl is simple, false otherwise.

extractBaseUnitsback to summary
public ArrayList<SingleUnitImpl> extractBaseUnits(MeasureUnitImpl measureUnitImpl)
extractBaseUnitsback to summary
public ArrayList<SingleUnitImpl> extractBaseUnits(SingleUnitImpl singleUnit)
Parameters
singleUnit:SingleUnitImpl

An instance of SingleUnitImpl.

Returns:ArrayList<SingleUnitImpl>

The base units in the SingleUnitImpl with applying the dimensionality only and not the SI prefix.

Note

This method is helpful when checking the convertibility because no need to check convertibility.

extractCompoundBaseUnitback to summary
public MeasureUnitImpl extractCompoundBaseUnit(MeasureUnitImpl measureUnit)
extractSystemsback to summary
public String extractSystems(SingleUnitImpl singleUnit)
Returns:String

The measurement systems for the specified unit.

getFactorToBaseback to summary
private UnitsConverter.Factor getFactorToBase(SingleUnitImpl singleUnit)

Extracts the factor from a SingleUnitImpl to its Basic Unit.

getFactorToBaseback to summary
public UnitsConverter.Factor getFactorToBase(MeasureUnitImpl measureUnit)
getOffsetback to summary
protected BigDecimal getOffset(MeasureUnitImpl source, MeasureUnitImpl target, UnitsConverter.Factor sourceToBase, UnitsConverter.Factor targetToBase, UnitsConverter.Convertibility convertibility)
com.ibm.icu.impl.units back to summary

public Class ConversionRates.ConversionRateInfo

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final String
private final BigDecimal
private final String
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
ConversionRateInfo(String simpleUnit, String target, String conversionRate, String offset, String systems)

Method Summary

Modifier and TypeMethod and Description
private static BigDecimal
forNumberWithDivision(String numberWithDivision)

public String

Returns:

The conversion rate from this unit to the base unit.
getConversionRate
()

public BigDecimal

Returns:

The offset from this unit to the base unit.
getOffset
()

public String

Returns:

The measurement systems this unit belongs to.
getSystems
()

public String

Returns:

the base unit.

For example: ("meter", "foot", "inch", "mile" ... etc.) have "meter" as a base/root unit.

getTarget
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

conversionRateback to summary
private final String conversionRate
offsetback to summary
private final BigDecimal offset
simpleUnitback to summary
private final String simpleUnit
Annotations
@SuppressWarnings:unused
systemsback to summary
private final String systems
targetback to summary
private final String target

Constructor Detail

ConversionRateInfoback to summary
public ConversionRateInfo(String simpleUnit, String target, String conversionRate, String offset, String systems)

Method Detail

forNumberWithDivisionback to summary
private static BigDecimal forNumberWithDivision(String numberWithDivision)
getConversionRateback to summary
public String getConversionRate()
Returns:String

The conversion rate from this unit to the base unit.

getOffsetback to summary
public BigDecimal getOffset()
Returns:BigDecimal

The offset from this unit to the base unit.

getSystemsback to summary
public String getSystems()
Returns:String

The measurement systems this unit belongs to.

getTargetback to summary
public String getTarget()
Returns:String

the base unit.

For example: ("meter", "foot", "inch", "mile" ... etc.) have "meter" as a base/root unit.

com.ibm.icu.impl.units back to summary

public Class ConversionRates.ConversionRatesSink

extends Sink
Class Inheritance

Field Summary

Modifier and TypeField and Description
private HashMap<String, ConversionRates.ConversionRateInfo>
mapToConversionRate

Map from any simple unit (i.e. "meter", "foot", "inch") to its basic/root conversion rate info.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public HashMap<String, ConversionRates.ConversionRateInfo>
public void
put(UResource.Key
Initially the key string of the enumeration-start resource. Empty if the enumeration starts at the top level of the bundle. Reuse for output values from Array and Table getters.
key
,
UResource.Value
Call getArray() or getTable() as appropriate. Then reuse for output values from Array and Table getters.
value
,
boolean
true if the bundle has no parent; that is, its top-level table has the nofallback attribute, or it is the root bundle of a locale tree.
noFallback
)

Implements abstract com.ibm.icu.impl.UResource.Sink.put.

Called once for each bundle (child-parent-...-root).

Field Detail

mapToConversionRateback to summary
private HashMap<String, ConversionRates.ConversionRateInfo> mapToConversionRate

Map from any simple unit (i.e. "meter", "foot", "inch") to its basic/root conversion rate info.

Constructor Detail

ConversionRatesSinkback to summary
public ConversionRatesSink()

Method Detail

getMapToConversionRateback to summary
public HashMap<String, ConversionRates.ConversionRateInfo> getMapToConversionRate()
putback to summary
public void put(UResource.Key key, UResource.Value value, boolean noFallback)

Implements abstract com.ibm.icu.impl.UResource.Sink.put.

Doc from com.ibm.icu.impl.UResource.Sink.put.

Called once for each bundle (child-parent-...-root). The value is normally an array or table resource, and implementations of this method normally iterate over the tree of resource items stored there.

Parameters
key:UResource.Key

Initially the key string of the enumeration-start resource. Empty if the enumeration starts at the top level of the bundle. Reuse for output values from Array and Table getters.

value:UResource.Value

Call getArray() or getTable() as appropriate. Then reuse for output values from Array and Table getters.

noFallback:boolean

true if the bundle has no parent; that is, its top-level table has the nofallback attribute, or it is the root bundle of a locale tree.

Annotations
@Override