Top Inners Fields Constructors Methods
com.ibm.icu.text

pack-priv Class TransliteratorRegistry

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .Enumeration, .HashMap, .LinkedHashSet, .List, .Locale, .Map, .MissingResourceException, .ResourceBundle, .Set, com.ibm.icu.impl.ICUData, .ICUResourceBundle, .LocaleUtility, .Utility, com.ibm.icu.lang.UScript, com.ibm.icu.text.RuleBasedTransliterator.Data, com.ibm.icu.util.CaseInsensitiveString, .UResourceBundle

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
private static class
TransliteratorRegistry.IDEnumeration

An internal class that adapts an enumeration over CaseInsensitiveStrings to an enumeration over Strings.

pack-priv static class
pack-priv static class
pack-priv static class
TransliteratorRegistry.Spec

A Spec is a string specifying either a source or a target.

Field Summary

Modifier and TypeField and Description
private static final String
private final Set<CaseInsensitiveString>
availableIDs

Vector of public full IDs (CaseInsensitiveString objects).

private static final boolean
private static final char
private static final String
private Map<CaseInsensitiveString, Object[]>
registry

Dynamic registry mapping full IDs to Entry objects.

private Map<CaseInsensitiveString, Map<CaseInsensitiveString, List<CaseInsensitiveString>>>
specDAG

DAG of visible IDs by spec.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private Object[]
find(String ID)

Convenience method.

private Object[]
find(String source, String target, String variant)

Top-level find method.

private Object[]
findInBundle(TransliteratorRegistry.Spec specToOpen, TransliteratorRegistry.Spec specToFind, String variant, int direction)

Attempt to find an entry in a single resource bundle.

private Object[]
findInDynamicStore(TransliteratorRegistry.Spec src, TransliteratorRegistry.Spec trg, String variant)

Attempt to find a source-target/variant in the dynamic registry store.

private Object[]
findInStaticStore(TransliteratorRegistry.Spec src, TransliteratorRegistry.Spec trg, String variant)

Attempt to find a source-target/variant in the static locale resource store.

public Transliterator
get(String ID, StringBuffer aliasReturn)

Given a simple ID (forward direction, no inline filter, not compound) attempt to instantiate it from the registry.

public Enumeration<String>

Returns:

An Enumeration over String objects
getAvailableIDs
()

Returns an enumeration over the programmatic names of visible registered transliterators.

public Enumeration<String>

Returns:

An Enumeration over String objects
getAvailableSources
()

Returns an enumeration over all visible source names.

public Enumeration<String>

Returns:

An Enumeration over String objects
getAvailableTargets
(String source)

Returns an enumeration over visible target names for the given source.

public Enumeration<String>

Returns:

An Enumeration over String objects
getAvailableVariants
(String source, String target)

Returns an enumeration over visible variant names for the given source and target.

private Transliterator
instantiateEntry(String ID, Object[] entryWrapper, StringBuffer aliasReturn)

Given an Entry object, instantiate it.

public void
put(String ID, Class<? extends Transliterator> transliteratorSubclass, boolean visible)

Register a class.

public void
put(String ID, Transliterator.Factory factory, boolean visible)

Register an ID and a factory function pointer.

public void
put(String ID, String resourceName, int dir, boolean visible)

Register an ID and a resource name.

public void
put(String ID, String alias, boolean visible)

Register an ID and an alias ID. This adds an entry to the dynamic store, or replaces an existing entry.

public void
put(String ID, Transliterator trans, boolean visible)

Register an ID and a Transliterator object.

private void
registerEntry(String source, String target, String variant, Object entry, boolean visible)

Convenience method.

private void
registerEntry(String ID, Object entry, boolean visible)

Convenience method.

private void
registerEntry(String ID, String source, String target, String variant, Object entry, boolean visible)

Register an entry object (adopted) with the given ID, source, target, and variant strings.

private void
registerSTV(String source, String target, String variant)

Register a source-target/variant in the specDAG.

public void
remove(String ID)

Unregister an ID. This removes an entry from the dynamic store if there is one.

private void
removeSTV(String source, String target, String variant)

Remove a source-target/variant from the specDAG.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ANYback to summary
private static final String ANY
availableIDsback to summary
private final Set<CaseInsensitiveString> availableIDs

Vector of public full IDs (CaseInsensitiveString objects).

DEBUGback to summary
private static final boolean DEBUG
LOCALE_SEPback to summary
private static final char LOCALE_SEP
NO_VARIANTback to summary
private static final String NO_VARIANT
registryback to summary
private Map<CaseInsensitiveString, Object[]> registry

Dynamic registry mapping full IDs to Entry objects. This contains both public and internal entities. The visibility is controlled by whether an entry is listed in availableIDs and specDAG or not. Keys are CaseInsensitiveString objects. Values are objects of class Class (subclass of Transliterator), RuleBasedTransliterator.Data, Transliterator.Factory, or one of the entry classes defined here (AliasEntry or ResourceEntry).

specDAGback to summary
private Map<CaseInsensitiveString, Map<CaseInsensitiveString, List<CaseInsensitiveString>>> specDAG

DAG of visible IDs by spec. Hashtable: source => (Hashtable: target => (Vector: variant)) The Vector of variants is never empty. For a source-target with no variant, the special variant NO_VARIANT (the empty string) is stored in slot zero of the UVector. Keys are CaseInsensitiveString objects. Values are Hashtable of (CaseInsensitiveString -> Vector of CaseInsensitiveString)

Constructor Detail

TransliteratorRegistryback to summary
public TransliteratorRegistry()

Method Detail

findback to summary
private Object[] find(String ID)

Convenience method. Calls 3-arg find().

findback to summary
private Object[] find(String source, String target, String variant)

Top-level find method. Attempt to find a source-target/variant in either the dynamic or the static (locale resource) store. Perform fallback. Lookup sequence for ss_SS_SSS-tt_TT_TTT/v: ss_SS_SSS-tt_TT_TTT/v -- in hashtable ss_SS_SSS-tt_TT_TTT/v -- in ss_SS_SSS (no fallback) repeat with t = tt_TT_TTT, tt_TT, tt, and tscript ss_SS_SSS-t/* ss_SS-t/* ss-t/* sscript-t/* Here * matches the first variant listed. Caller does NOT own returned object. Return 0 on failure.

findInBundleback to summary
private Object[] findInBundle(TransliteratorRegistry.Spec specToOpen, TransliteratorRegistry.Spec specToFind, String variant, int direction)

Attempt to find an entry in a single resource bundle. This is a one-sided lookup. findInStaticStore() performs up to two such lookups, one for the source, and one for the target. Do not perform fallback. Return 0 on failure. On success, create a new Entry object, populate it, and return it. The caller owns the returned object.

findInDynamicStoreback to summary
private Object[] findInDynamicStore(TransliteratorRegistry.Spec src, TransliteratorRegistry.Spec trg, String variant)

Attempt to find a source-target/variant in the dynamic registry store. Return 0 on failure.

findInStaticStoreback to summary
private Object[] findInStaticStore(TransliteratorRegistry.Spec src, TransliteratorRegistry.Spec trg, String variant)

Attempt to find a source-target/variant in the static locale resource store. Do not perform fallback. Return 0 on failure. On success, create a new entry object, register it in the dynamic store, and return a pointer to it, but do not make it public -- just because someone requested something, we do not expand the available ID list (or spec DAG).

getback to summary
public Transliterator get(String ID, StringBuffer aliasReturn)

Given a simple ID (forward direction, no inline filter, not compound) attempt to instantiate it from the registry. Return 0 on failure. Return a non-empty aliasReturn value if the ID points to an alias. We cannot instantiate it ourselves because the alias may contain filters or compounds, which we do not understand. Caller should make aliasReturn empty before calling.

getAvailableIDsback to summary
public Enumeration<String> getAvailableIDs()

Returns an enumeration over the programmatic names of visible registered transliterators.

Returns:Enumeration<String>

An Enumeration over String objects

getAvailableSourcesback to summary
public Enumeration<String> getAvailableSources()

Returns an enumeration over all visible source names.

Returns:Enumeration<String>

An Enumeration over String objects

getAvailableTargetsback to summary
public Enumeration<String> getAvailableTargets(String source)

Returns an enumeration over visible target names for the given source.

Returns:Enumeration<String>

An Enumeration over String objects

getAvailableVariantsback to summary
public Enumeration<String> getAvailableVariants(String source, String target)

Returns an enumeration over visible variant names for the given source and target.

Returns:Enumeration<String>

An Enumeration over String objects

instantiateEntryback to summary
private Transliterator instantiateEntry(String ID, Object[] entryWrapper, StringBuffer aliasReturn)

Given an Entry object, instantiate it. Caller owns result. Return 0 on failure. Return a non-empty aliasReturn value if the ID points to an alias. We cannot instantiate it ourselves because the alias may contain filters or compounds, which we do not understand. Caller should make aliasReturn empty before calling. The entry object is assumed to reside in the dynamic store. It may be modified.

Annotations
@SuppressWarnings:rawtypes
putback to summary
public void put(String ID, Class<? extends Transliterator> transliteratorSubclass, boolean visible)

Register a class. This adds an entry to the dynamic store, or replaces an existing entry. Any entry in the underlying static locale resource store is masked.

putback to summary
public void put(String ID, Transliterator.Factory factory, boolean visible)

Register an ID and a factory function pointer. This adds an entry to the dynamic store, or replaces an existing entry. Any entry in the underlying static locale resource store is masked.

putback to summary
public void put(String ID, String resourceName, int dir, boolean visible)

Register an ID and a resource name. This adds an entry to the dynamic store, or replaces an existing entry. Any entry in the underlying static locale resource store is masked.

putback to summary
public void put(String ID, String alias, boolean visible)

Register an ID and an alias ID. This adds an entry to the dynamic store, or replaces an existing entry. Any entry in the underlying static locale resource store is masked.

putback to summary
public void put(String ID, Transliterator trans, boolean visible)

Register an ID and a Transliterator object. This adds an entry to the dynamic store, or replaces an existing entry. Any entry in the underlying static locale resource store is masked.

registerEntryback to summary
private void registerEntry(String source, String target, String variant, Object entry, boolean visible)

Convenience method. Calls 6-arg registerEntry().

registerEntryback to summary
private void registerEntry(String ID, Object entry, boolean visible)

Convenience method. Calls 6-arg registerEntry().

registerEntryback to summary
private void registerEntry(String ID, String source, String target, String variant, Object entry, boolean visible)

Register an entry object (adopted) with the given ID, source, target, and variant strings.

registerSTVback to summary
private void registerSTV(String source, String target, String variant)

Register a source-target/variant in the specDAG. Variant may be empty, but source and target must not be. If variant is empty then the special variant NO_VARIANT is stored in slot zero of the UVector of variants.

removeback to summary
public void remove(String ID)

Unregister an ID. This removes an entry from the dynamic store if there is one. The static locale resource store is unaffected.

removeSTVback to summary
private void removeSTV(String source, String target, String variant)

Remove a source-target/variant from the specDAG.

com.ibm.icu.text back to summary

pack-priv Class TransliteratorRegistry.AliasEntry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasback to summary
public String alias

Constructor Detail

AliasEntryback to summary
public AliasEntry(String a)
com.ibm.icu.text back to summary

pack-priv Class TransliteratorRegistry.CompoundRBTEntry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private UnicodeSet
private List<RuleBasedTransliterator.Data>
private String
private List<String>

Constructor Summary

AccessConstructor and Description
public
CompoundRBTEntry(String theID, List<String> theIDBlockVector, List<RuleBasedTransliterator.Data> theDataVector, UnicodeSet theCompoundFilter)

Method Summary

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

Field Detail

compoundFilterback to summary
private UnicodeSet compoundFilter
dataVectorback to summary
private List<RuleBasedTransliterator.Data> dataVector
IDback to summary
private String ID
idBlockVectorback to summary
private List<String> idBlockVector

Constructor Detail

CompoundRBTEntryback to summary
public CompoundRBTEntry(String theID, List<String> theIDBlockVector, List<RuleBasedTransliterator.Data> theDataVector, UnicodeSet theCompoundFilter)

Method Detail

getInstanceback to summary
public Transliterator getInstance()
com.ibm.icu.text back to summary

private Class TransliteratorRegistry.IDEnumeration

extends Object
implements Enumeration<String>
Class Inheritance
All Implemented Interfaces
java.util.Enumeration

An internal class that adapts an enumeration over CaseInsensitiveStrings to an enumeration over Strings.

Field Summary

Modifier and TypeField and Description
pack-priv Enumeration<CaseInsensitiveString>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
hasMoreElements()

Implements java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.
public String
nextElement()

Implements java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

enback to summary
pack-priv Enumeration<CaseInsensitiveString> en

Constructor Detail

IDEnumerationback to summary
public IDEnumeration(Enumeration<CaseInsensitiveString> e)

Method Detail

hasMoreElementsback to summary
public boolean hasMoreElements()

Implements java.util.Enumeration.hasMoreElements.

Doc from java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.

Returns:boolean

true if and only if this enumeration object contains at least one more element to provide; false otherwise.

Annotations
@Override
nextElementback to summary
public String nextElement()

Implements java.util.Enumeration.nextElement.

Doc from java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Returns:String

the next element of this enumeration.

Annotations
@Override
com.ibm.icu.text back to summary

pack-priv Class TransliteratorRegistry.LocaleEntry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public int
public String

Constructor Summary

AccessConstructor and Description
public
LocaleEntry(String r, int d)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

directionback to summary
public int direction
ruleback to summary
public String rule

Constructor Detail

LocaleEntryback to summary
public LocaleEntry(String r, int d)
com.ibm.icu.text back to summary

pack-priv Class TransliteratorRegistry.ResourceEntry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public int
public String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

directionback to summary
public int direction
resourceback to summary
public String resource

Constructor Detail

ResourceEntryback to summary
public ResourceEntry(String n, int d)
com.ibm.icu.text back to summary

pack-priv Class TransliteratorRegistry.Spec

extends Object
Class Inheritance

A Spec is a string specifying either a source or a target. In more general terms, it may also specify a variant, but we only use the Spec class for sources and targets. A Spec may be a locale or a script. If it is a locale, it has a fallback chain that goes xx_YY_ZZZ -> xx_YY -> xx -> ssss, where ssss is the script mapping of xx_YY_ZZZ. The Spec API methods hasFallback(), next(), and reset() iterate over this fallback sequence. The Spec class canonicalizes itself, so the locale is put into canonical form, or the script is transformed from an abbreviation to a full name.

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private String
private ICUResourceBundle
private String
private String
private String

Constructor Summary

AccessConstructor and Description
public
Spec(String theSpec)

Method Summary

Modifier and TypeMethod and Description
public String
get()

public ResourceBundle
getBundle()

Return the ResourceBundle for this spec, at the current level of iteration.

public String
public boolean
public boolean
public String
next()

public void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

isNextLocaleback to summary
private boolean isNextLocale
isSpecLocaleback to summary
private boolean isSpecLocale
nextSpecback to summary
private String nextSpec
resback to summary
private ICUResourceBundle res
scriptNameback to summary
private String scriptName
specback to summary
private String spec
topback to summary
private String top

Constructor Detail

Specback to summary
public Spec(String theSpec)

Method Detail

getback to summary
public String get()
getBundleback to summary
public ResourceBundle getBundle()

Return the ResourceBundle for this spec, at the current level of iteration. The level of iteration goes from aa_BB_CCC to aa_BB to aa. If the bundle does not correspond to the current level of iteration, return null. If isLocale() is false, always return null.

getTopback to summary
public String getTop()
hasFallbackback to summary
public boolean hasFallback()
isLocaleback to summary
public boolean isLocale()
nextback to summary
public String next()
resetback to summary
public void reset()
setupNextback to summary
private void setupNext()