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

public Class UnitsData

extends Object
Class Inheritance
Imports
java.util.ArrayList, .HashMap, .Iterator, com.ibm.icu.impl.ICUData, .ICUResourceBundle, .IllegalIcuArgumentException, .UResource, com.ibm.icu.util.ULocale, .UResourceBundle

Responsible for all units data operations (retriever, analysis, extraction certain data ... etc.).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
UnitsData.CategoriesSink

A Resource Sink that collects information from unitQuantities in the units resource to provide key->value lookups from base unit to category, as well as preserving ordering information for these categories.

public static class
UnitsData.Constants

Contains all the needed constants.

public static class

Field Summary

Modifier and TypeField and Description
private ConversionRates
private static int[]
private static String[]
private UnitPreferences

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the corresponding category.
getCategory
(MeasureUnitImpl
An instance of MeasureUnitImpl.
measureUnit
)

public static int
getCategoryIndexOfSimpleUnit(int simpleUnitIndex)

public ConversionRates
public UnitPreferences.UnitPreference[]
getPreferencesFor(String category, String usage, ULocale locale)

public static String[]
public UnitPreferences
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

conversionRatesback to summary
private ConversionRates conversionRates
simpleUnitCategoriesback to summary
private static int[] simpleUnitCategories
simpleUnitsback to summary
private static String[] simpleUnits
unitPreferencesback to summary
private UnitPreferences unitPreferences

Constructor Detail

UnitsDataback to summary
public UnitsData()

Method Detail

getCategoryback to summary
public String getCategory(MeasureUnitImpl measureUnit)
Parameters
measureUnit:MeasureUnitImpl

An instance of MeasureUnitImpl.

Returns:String

the corresponding category.

getCategoryIndexOfSimpleUnitback to summary
public static int getCategoryIndexOfSimpleUnit(int simpleUnitIndex)
getConversionRatesback to summary
public ConversionRates getConversionRates()
getPreferencesForback to summary
public UnitPreferences.UnitPreference[] getPreferencesFor(String category, String usage, ULocale locale)
getSimpleUnitsback to summary
public static String[] getSimpleUnits()
getUnitPreferencesback to summary
public UnitPreferences getUnitPreferences()
com.ibm.icu.impl.units back to summary

public Class UnitsData.Categories

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static HashMap<String, Integer>
baseUnitToIndex

Maps from base unit to an index value: an index into the indexToCategory array.

pack-priv static String[]
indexToCategory

Our official array of category strings - categories are identified by indeces into this array.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseUnitToIndexback to summary
pack-priv static HashMap<String, Integer> baseUnitToIndex

Maps from base unit to an index value: an index into the indexToCategory array.

indexToCategoryback to summary
pack-priv static String[] indexToCategory

Our official array of category strings - categories are identified by indeces into this array.

Constructor Detail

Categoriesback to summary
public Categories()
com.ibm.icu.impl.units back to summary

public Class UnitsData.CategoriesSink

extends Sink
Class Inheritance

A Resource Sink that collects information from unitQuantities in the units resource to provide key->value lookups from base unit to category, as well as preserving ordering information for these categories. See units.txt. For example: "kilogram" -> "mass", "meter-per-second" -> "speed". In Java unitQuantity values are collected in order into an ArrayList, while unitQuantity key-to-index lookups are handled with a HashMap.

Field Summary

Modifier and TypeField and Description
pack-priv ArrayList<String>
pack-priv HashMap<String, Integer>
mapFromUnitToIndex

Contains the map between units in their base units into their category.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
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

categoriesback to summary
pack-priv ArrayList<String> categories
mapFromUnitToIndexback to summary
pack-priv HashMap<String, Integer> mapFromUnitToIndex

Contains the map between units in their base units into their category. For example: meter-per-second --> "speed"

Constructor Detail

CategoriesSinkback to summary
public CategoriesSink()

Method Detail

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
com.ibm.icu.impl.units back to summary

public Class UnitsData.Constants

extends Object
Class Inheritance

Contains all the needed constants.

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
public static final String
public static final String
public static final int
public static final int
public static final int
public static final int
public static final int
public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CATEGORY_TABLE_NAMEback to summary
public static final String CATEGORY_TABLE_NAME
CONVERSION_UNIT_TABLE_NAMEback to summary
public static final String CONVERSION_UNIT_TABLE_NAME
DEFAULT_REGIONback to summary
public static final String DEFAULT_REGION
DEFAULT_USAGEback to summary
public static final String DEFAULT_USAGE
kCompoundPartOffsetback to summary
public static final int kCompoundPartOffset
kInitialCompoundPartOffsetback to summary
public static final int kInitialCompoundPartOffset
kPowerPartOffsetback to summary
public static final int kPowerPartOffset
kPrefixOffsetback to summary
public static final int kPrefixOffset
kSimpleUnitOffsetback to summary
public static final int kSimpleUnitOffset
UNIT_PREFERENCE_TABLE_NAMEback to summary
public static final String UNIT_PREFERENCE_TABLE_NAME

Constructor Detail

Constantsback to summary
public Constants()
com.ibm.icu.impl.units back to summary

public Class UnitsData.SimpleUnitIdentifiersSink

extends Sink
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int[]
pack-priv String[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
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

simpleUnitCategoriesback to summary
pack-priv int[] simpleUnitCategories
simpleUnitsback to summary
pack-priv String[] simpleUnits

Constructor Detail

SimpleUnitIdentifiersSinkback to summary
public SimpleUnitIdentifiersSink()

Method Detail

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