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

pack-priv final Class NormalizationTransliterator

extends Transliterator
Class Inheritance
Imports
java.util.HashMap, .Map, com.ibm.icu.impl.Norm2AllModes, .Normalizer2Impl

Author
Alan Liu, Markus Scherer

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final Normalizer2
pack-priv static final Map<Normalizer2, SourceTargetUtility>
Inherited from com.ibm.icu.text.Transliterator:
DEBUGFORWARDID_DELIMID_SEPREVERSEVARIANT_SEP

Constructor Summary

AccessConstructor and Description
private
NormalizationTransliterator(String id, Normalizer2 n2)

Constructs a transliterator.

Method Summary

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

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

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.
offsets
,
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.
isIncremental
)

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

Implements Transliterator#handleTransliterate.
pack-priv static void
register()

System registration hook.

Inherited from com.ibm.icu.text.Transliterator:
baseToRulescreateFromRulesfilteredTransliteratefinishTransliterationgetAvailableIDsgetAvailableSourcesgetAvailableTargetsgetAvailableVariantsgetBasicInstancegetDisplayNamegetDisplayNamegetDisplayNamegetElementsgetFiltergetFilterAsUnicodeSetgetIDgetInstancegetInstancegetInversegetMaximumContextLengthgetSourceSetgetTargetSethandleGetSourceSetregisterAliasregisterAnyregisterClassregisterFactoryregisterInstanceregisterInstanceregisterSpecialInversesetFiltersetIDsetMaximumContextLengthtoRulestransformtransliteratetransliteratetransliteratetransliteratetransliteratetransliterateunregister

Field Detail

norm2back to summary
private final Normalizer2 norm2
SOURCE_CACHEback to summary
pack-priv static final Map<Normalizer2, SourceTargetUtility> SOURCE_CACHE

Constructor Detail

NormalizationTransliteratorback to summary
private NormalizationTransliterator(String id, Normalizer2 n2)

Constructs a transliterator.

Method Detail

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

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

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

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
@Override
handleTransliterateback to summary
protected void handleTransliterate(Replaceable text, Transliterator.Position offsets, boolean isIncremental)

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

Implements Transliterator#handleTransliterate.

Parameters
text:Replaceable

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

the buffer holding transliterated and untransliterated text

offsets:Transliterator.Position

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

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

isIncremental: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
registerback to summary
pack-priv static void register()

System registration hook.

com.ibm.icu.text back to summary

pack-priv Class NormalizationTransliterator.NormalizingTransform

extends Object
implements Transform<String, String>
Class Inheritance
  • java.lang.Object
  • com.ibm.icu.text.NormalizationTransliterator.NormalizingTransform
All Implemented Interfaces
com.ibm.icu.text.Transform

Field Summary

Modifier and TypeField and Description
pack-priv final Normalizer2

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
transform(String
to be transformed (eg lowercased)
source
)

Implements com.ibm.icu.text.Transform.transform.

Transform the input in some way, to be determined by the subclass.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

norm2back to summary
pack-priv final Normalizer2 norm2

Constructor Detail

NormalizingTransformback to summary
public NormalizingTransform(Normalizer2 norm2)

Method Detail

transformback to summary
public String transform(String source)

Implements com.ibm.icu.text.Transform.transform.

Doc from com.ibm.icu.text.Transform.transform.

Transform the input in some way, to be determined by the subclass.

Parameters
source:String

to be transformed (eg lowercased)

Returns:String

result

Annotations
@Override