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

public Class UnitPreferences

extends Object
Class Inheritance
Imports
java.math.BigDecimal, java.util.ArrayList, .Collections, .HashMap, .List, .Map, com.ibm.icu.impl.ICUData, .ICUResourceBundle, .UResource, com.ibm.icu.util.ULocale, .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, HashMap<String, UnitPreferences.UnitPreference[]>>
private static final Map<String, String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String
formMapKey(String category, String usage)

private static String[]
getAllUsages(String usage)

Extracts all the sub-usages from a usage including the default one in the end.

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

private UnitPreferences.UnitPreference[]

Returns:

null if there is no entry associated to the category and usage. O.W. returns the corresponding UnitPreference[]
getUnitPreferences
(String category, String usage, String region)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapToUnitPreferencesback to summary
private HashMap<String, HashMap<String, UnitPreferences.UnitPreference[]>> mapToUnitPreferences
measurementSystemback to summary
private static final Map<String, String> measurementSystem

Constructor Detail

UnitPreferencesback to summary
public UnitPreferences()

Method Detail

formMapKeyback to summary
public static String formMapKey(String category, String usage)
getAllUsagesback to summary
private static String[] getAllUsages(String usage)

Extracts all the sub-usages from a usage including the default one in the end. The usages will be in order starting with the longest matching one. For example: if usage : "person-height-child" the function will return: "person-height-child" "person-height" "person" "default"

getPreferencesForback to summary
public UnitPreferences.UnitPreference[] getPreferencesFor(String category, String usage, ULocale locale, UnitsData data)
getUnitPreferencesback to summary
private UnitPreferences.UnitPreference[] getUnitPreferences(String category, String usage, String region)
Returns:UnitPreferences.UnitPreference[]

null if there is no entry associated to the category and usage. O.W. returns the corresponding UnitPreference[]

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

public Class UnitPreferences.UnitPreference

extends Object
Class Inheritance

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
UnitPreference(String unit, String geq, String skeleton)

Method Summary

Modifier and TypeMethod and Description
public BigDecimal
public String
public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

geqback to summary
private final BigDecimal geq
skeletonback to summary
private final String skeleton
unitback to summary
private final String unit

Constructor Detail

UnitPreferenceback to summary
public UnitPreference(String unit, String geq, String skeleton)

Method Detail

getGeqback to summary
public BigDecimal getGeq()
getSkeletonback to summary
public String getSkeleton()
getUnitback to summary
public String getUnit()
com.ibm.icu.impl.units back to summary

public Class UnitPreferences.UnitPreferencesSink

extends Sink
Class Inheritance

Field Summary

Modifier and TypeField and Description
private HashMap<String, HashMap<String, UnitPreferences.UnitPreference[]>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public HashMap<String, HashMap<String, UnitPreferences.UnitPreference[]>>
private void
insertUnitPreferences(String category, String usage, String region, UnitPreferences.UnitPreference[] unitPreferences)

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.

The unitPreferenceData structure (see icu4c/source/data/misc/units.txt) contains a hierarchy of category/usage/region, within which are a set of preferences.

Field Detail

mapToUnitPreferencesback to summary
private HashMap<String, HashMap<String, UnitPreferences.UnitPreference[]>> mapToUnitPreferences

Constructor Detail

UnitPreferencesSinkback to summary
public UnitPreferencesSink()

Method Detail

getMapToUnitPreferencesback to summary
public HashMap<String, HashMap<String, UnitPreferences.UnitPreference[]>> getMapToUnitPreferences()
insertUnitPreferencesback to summary
private void insertUnitPreferences(String category, String usage, String region, UnitPreferences.UnitPreference[] unitPreferences)
putback to summary
public void put(UResource.Key key, UResource.Value value, boolean noFallback)

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

The unitPreferenceData structure (see icu4c/source/data/misc/units.txt) contains a hierarchy of category/usage/region, within which are a set of preferences. Hence three for-loops and another loop for the preferences themselves.

Parameters
key:UResource.Key

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

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

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

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

noFallback:boolean

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

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