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

public Class RuleBasedTransliterator

extends Transliterator
Class Inheritance
Annotations
@Deprecated
Imports
java.util.HashMap, .Map

Deprecated

This API is ICU internal only.

RuleBasedTransliterator is a transliterator built from a set of rules as defined for Transliterator#createFromRules(String, String, int). See the class Transliterator documentation for the rule syntax.
Author
Alan Liu
ICU Status
Internal ICU component.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final RuleBasedTransliterator.Data
Inherited from com.ibm.icu.text.Transliterator:
DEBUGFORWARDID_DELIMID_SEPREVERSEVARIANT_SEP

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addSourceTargetSet(UnicodeSet filter, UnicodeSet sourceSet, UnicodeSet
TODO
targetSet
)

Overrides com.ibm.icu.text.Transliterator.addSourceTargetSet.

Deprecated This API is ICU internal only.
Returns the set of all characters that may be generated as replacement text by this transliterator, filtered by BOTH the input filter, and the current getFilter().
protected void
handleTransliterate(Replaceable
the buffer holding transliterated and untransliterated text
text
,
Transliterator.Position
the indices indicating the start, limit, context start, and context limit of the text.
index
,
boolean
if true, assume more text may be inserted at pos.limit and act accordingly. Otherwise, transliterate all text between pos.start and pos.limit and move pos.start up to pos.limit.
incremental
)

Implements abstract com.ibm.icu.text.Transliterator.handleTransliterate.

Deprecated This API is ICU internal only.
Implements Transliterator#handleTransliterate.
public Transliterator
safeClone()

Deprecated This API is ICU internal only.
Temporary hack for registry problem.
public String

Returns:

rules string
toRules
(boolean
if true then convert unprintable character to their hex escape representations, \\uxxxx or \\Uxxxxxxxx. Unprintable characters are those other than U+000A, U+0020..U+007E.
escapeUnprintable
)

Overrides com.ibm.icu.text.Transliterator.toRules.

Deprecated This API is ICU internal only.
Return a representation of this transliterator as source rules.
Inherited from com.ibm.icu.text.Transliterator:
baseToRulescreateFromRulesfilteredTransliteratefinishTransliterationgetAvailableIDsgetAvailableSourcesgetAvailableTargetsgetAvailableVariantsgetBasicInstancegetDisplayNamegetDisplayNamegetDisplayNamegetElementsgetFiltergetFilterAsUnicodeSetgetIDgetInstancegetInstancegetInversegetMaximumContextLengthgetSourceSetgetTargetSethandleGetSourceSetregisterAliasregisterAnyregisterClassregisterFactoryregisterInstanceregisterInstanceregisterSpecialInversesetFiltersetIDsetMaximumContextLengthtransformtransliteratetransliteratetransliteratetransliteratetransliteratetransliterateunregister

Field Detail

databack to summary
private final RuleBasedTransliterator.Data data

Constructor Detail

RuleBasedTransliteratorback to summary
pack-priv RuleBasedTransliterator(String ID, RuleBasedTransliterator.Data data, UnicodeFilter filter)

Method Detail

addSourceTargetSetback to summary
public void addSourceTargetSet(UnicodeSet filter, UnicodeSet sourceSet, UnicodeSet targetSet)

Overrides com.ibm.icu.text.Transliterator.addSourceTargetSet.

Doc from com.ibm.icu.text.Transliterator.addSourceTargetSet.

Deprecated

This API is ICU internal only.

Returns the set of all characters that may be generated as replacement text by this transliterator, filtered by BOTH the input filter, and the current getFilter().

SHOULD BE OVERRIDDEN BY SUBCLASSES. It is probably an error for any transliterator to NOT override this, but we can't force them to for backwards compatibility.

Other methods vector through this.

When gathering the information on source and target, the compound transliterator makes things complicated. For example, suppose we have:

Global FILTER = [ax]
a > b;
:: NULL;
b > c;
x > d;
While the filter just allows a and x, b is an intermediate result, which could produce c. So the source and target sets cannot be gathered independently. What we have to do is filter the sources for the first transliterator according to the global filter, intersect that transliterator's filter. Based on that we get the target. The next transliterator gets as a global filter (global + last target). And so on.

There is another complication:

Global FILTER = [ax]
a >|b;
b >c;
Even though b would be filtered from the input, whenever we have a backup, it could be part of the input. So ideally we will change the global filter as we go.
Parameters
targetSet:UnicodeSet

TODO

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component.
handleTransliterateback to summary
protected void handleTransliterate(Replaceable text, Transliterator.Position index, boolean incremental)

Implements abstract com.ibm.icu.text.Transliterator.handleTransliterate.

Deprecated

This API is ICU internal only.

Implements Transliterator#handleTransliterate.

Parameters
text:Replaceable

Doc from com.ibm.icu.text.Transliterator.handleTransliterate.

the buffer holding transliterated and untransliterated text

index:Transliterator.Position

Doc from com.ibm.icu.text.Transliterator.handleTransliterate.

the indices indicating the start, limit, context start, and context limit of the text.

incremental:boolean

Doc from com.ibm.icu.text.Transliterator.handleTransliterate.

if true, assume more text may be inserted at pos.limit and act accordingly. Otherwise, transliterate all text between pos.start and pos.limit and move pos.start up to pos.limit.

Annotations
@Override
@Deprecated
ICU Status
Internal ICU component.
safeCloneback to summary
public Transliterator safeClone()

Deprecated

This API is ICU internal only.

Temporary hack for registry problem. Needs to be replaced by better architecture.

Annotations
@Deprecated
ICU Status
Internal ICU component.
toRulesback to summary
public String toRules(boolean escapeUnprintable)

Overrides com.ibm.icu.text.Transliterator.toRules.

Deprecated

This API is ICU internal only.

Return a representation of this transliterator as source rules. These rules will produce an equivalent transliterator if used to construct a new transliterator.

Parameters
escapeUnprintable:boolean

if true then convert unprintable character to their hex escape representations, \\uxxxx or \\Uxxxxxxxx. Unprintable characters are those other than U+000A, U+0020..U+007E.

Returns:String

rules string

Annotations
@Override
@Deprecated
ICU Status
Internal ICU component.
com.ibm.icu.text back to summary

pack-priv Class RuleBasedTransliterator.Data

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public TransliterationRuleSet
ruleSet

Rule table.

pack-priv Map<String, char[]>
variableNames

Map variable name (String) to variable (char[]).

pack-priv Object[]
variables

Map category variable (Character) to UnicodeMatcher or UnicodeReplacer.

pack-priv char
variablesBase

The character that represents variables[0].

Constructor Summary

AccessConstructor and Description
public
Data()

Method Summary

Modifier and TypeMethod and Description
public UnicodeMatcher
lookupMatcher(int standIn)

Return the UnicodeMatcher represented by the given character, or null if none.

public UnicodeReplacer
lookupReplacer(int standIn)

Return the UnicodeReplacer represented by the given character, or null if none.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ruleSetback to summary
public TransliterationRuleSet ruleSet

Rule table. May be empty.

variableNamesback to summary
pack-priv Map<String, char[]> variableNames

Map variable name (String) to variable (char[]). A variable name corresponds to zero or more characters, stored in a char[] array in this hash. One or more of these chars may also correspond to a UnicodeSet, in which case the character in the char[] in this hash is a stand-in: it is an index for a secondary lookup in data.variables. The stand-in also represents the UnicodeSet in the stored rules.

variablesback to summary
pack-priv Object[] variables

Map category variable (Character) to UnicodeMatcher or UnicodeReplacer. Variables that correspond to a set of characters are mapped from variable name to a stand-in character in data.variableNames. The stand-in then serves as a key in this hash to lookup the actual UnicodeSet object. In addition, the stand-in is stored in the rule text to represent the set of characters. variables[i] represents character (variablesBase + i).

variablesBaseback to summary
pack-priv char variablesBase

The character that represents variables[0]. Characters variablesBase through variablesBase + variables.length - 1 represent UnicodeSet objects.

Constructor Detail

Databack to summary
public Data()

Method Detail

lookupMatcherback to summary
public UnicodeMatcher lookupMatcher(int standIn)

Return the UnicodeMatcher represented by the given character, or null if none.

lookupReplacerback to summary
public UnicodeReplacer lookupReplacer(int standIn)

Return the UnicodeReplacer represented by the given character, or null if none.