Package com.ibm.icu.dev.demo.translit
Class AnyTransliterator
- java.lang.Object
-
- com.ibm.icu.text.Transliterator
-
- com.ibm.icu.dev.demo.translit.AnyTransliterator
-
- All Implemented Interfaces:
StringTransform
,Transform<java.lang.String,java.lang.String>
public class AnyTransliterator extends Transliterator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AnyTransliterator.RunIterator
static class
AnyTransliterator.ScriptRunIterator
Returns a series of ranges corresponding to scripts.-
Nested classes/interfaces inherited from class com.ibm.icu.text.Transliterator
Transliterator.Factory, Transliterator.Position
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static boolean
DEBUG
private static Transliterator
hex
private AnyTransliterator.RunIterator
it
private Transliterator.Position
run
private java.lang.String
targetName
-
Fields inherited from class com.ibm.icu.text.Transliterator
FORWARD, REVERSE
-
-
Constructor Summary
Constructors Constructor Description AnyTransliterator(java.lang.String targetName, UnicodeFilter filter)
AnyTransliterator(java.lang.String targetName, UnicodeFilter filter, AnyTransliterator.RunIterator it)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
handleTransliterate(Replaceable text, Transliterator.Position offsets, boolean isIncremental)
Abstract method that concrete subclasses define to implement their transliteration algorithm.static java.lang.String
toString(Transliterator.Position offsets)
-
Methods inherited from class com.ibm.icu.text.Transliterator
addSourceTargetSet, baseToRules, createFromRules, filteredTransliterate, finishTransliteration, getAvailableIDs, getAvailableSources, getAvailableTargets, getAvailableVariants, getDisplayName, getDisplayName, getDisplayName, getElements, getFilter, getFilterAsUnicodeSet, getID, getInstance, getInstance, getInverse, getMaximumContextLength, getSourceSet, getTargetSet, handleGetSourceSet, registerAlias, registerAny, registerClass, registerFactory, registerInstance, setFilter, setID, setMaximumContextLength, toRules, transform, transliterate, transliterate, transliterate, transliterate, transliterate, transliterate, unregister
-
-
-
-
Field Detail
-
DEBUG
static final boolean DEBUG
- See Also:
- Constant Field Values
-
targetName
private java.lang.String targetName
-
it
private AnyTransliterator.RunIterator it
-
run
private Transliterator.Position run
-
hex
private static Transliterator hex
-
-
Constructor Detail
-
AnyTransliterator
public AnyTransliterator(java.lang.String targetName, UnicodeFilter filter, AnyTransliterator.RunIterator it)
-
AnyTransliterator
public AnyTransliterator(java.lang.String targetName, UnicodeFilter filter)
-
-
Method Detail
-
handleTransliterate
protected void handleTransliterate(Replaceable text, Transliterator.Position offsets, boolean isIncremental)
Description copied from class:Transliterator
Abstract method that concrete subclasses define to implement their transliteration algorithm. This method handles both incremental and non-incremental transliteration. LetoriginalStart
refer to the value ofpos.start
upon entry.- If
incremental
is false, then this method should transliterate all characters betweenpos.start
andpos.limit
. Upon returnpos.start
must ==pos.limit
. - If
incremental
is true, then this method should transliterate all characters betweenpos.start
andpos.limit
that can be unambiguously transliterated, regardless of future insertions of text atpos.limit
. Upon return,pos.start
should be in the range [originalStart
,pos.limit
).pos.start
should be positioned such that characters [originalStart
,pos.start
) will not be changed in the future by this transliterator and characters [pos.start
,pos.limit
) are unchanged.
Implementations of this method should also obey the following invariants:
-
pos.limit
andpos.contextLimit
should be updated to reflect changes in length of the text betweenpos.start
andpos.limit
. The differencepos.contextLimit - pos.limit
should not change. pos.contextStart
should not change.- Upon return, neither
pos.start
norpos.limit
should be less thanoriginalStart
. - Text before
originalStart
and text afterpos.limit
should not change. - Text before
pos.contextStart
and text afterpos.contextLimit
should be ignored.
Subclasses may safely assume that all characters in [
pos.start
,pos.limit
) are filtered. In other words, the filter has already been applied by the time this method is called. SeefilteredTransliterate()
.This method is not for public consumption. Calling this method directly will transliterate [
pos.start
,pos.limit
) without applying the filter. End user code should calltransliterate()
instead of this method. Subclass code should callfilteredTransliterate()
instead of this method.- Specified by:
handleTransliterate
in classTransliterator
- Parameters:
text
- the buffer holding transliterated and untransliterated textoffsets
- the indices indicating the start, limit, context start, and context limit of the text.isIncremental
- if true, assume more text may be inserted atpos.limit
and act accordingly. Otherwise, transliterate all text betweenpos.start
andpos.limit
and movepos.start
up topos.limit
.- See Also:
Transliterator.transliterate(com.ibm.icu.text.Replaceable, int, int)
- If
-
toString
public static java.lang.String toString(Transliterator.Position offsets)
-
-