Class FunctionReplacer
java.lang.Object
com.ibm.icu.text.FunctionReplacer
- All Implemented Interfaces:
UnicodeReplacer
A replacer that calls a transliterator to generate its output text.
The input text to the transliterator is the output of another
UnicodeReplacer object. That is, this replacer wraps another
replacer with a transliterator.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate UnicodeReplacerThe replacer object.private TransliteratorThe transliterator. -
Constructor Summary
ConstructorsConstructorDescriptionFunctionReplacer(Transliterator theTranslit, UnicodeReplacer theReplacer) Construct a replacer that takes the output of the given replacer, passes it through the given transliterator, and emits the result as output. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReplacementSetTo(UnicodeSet toUnionTo) Union the set of all characters that may output by this object into the given set.intreplace(Replaceable text, int start, int limit, int[] cursor) UnicodeReplacer APItoReplacerPattern(boolean escapeUnprintable) UnicodeReplacer API
-
Field Details
-
translit
The transliterator. Must not be null. -
replacer
The replacer object. This generates text that is then processed by 'translit'. Must not be null.
-
-
Constructor Details
-
FunctionReplacer
Construct a replacer that takes the output of the given replacer, passes it through the given transliterator, and emits the result as output.
-
-
Method Details
-
replace
UnicodeReplacer API- Specified by:
replacein interfaceUnicodeReplacer- Parameters:
text- the text to be matchedstart- inclusive start index of text to be replacedlimit- exclusive end index of text to be replaced; must be greater than or equal to startcursor- output parameter for the cursor position. Not all replacer objects will update this, but in a complete tree of replacer objects, representing the entire output side of a transliteration rule, at least one must update it.- Returns:
- the number of 16-bit code units in the text replacing the characters at offsets start..(limit-1) in text
-
toReplacerPattern
UnicodeReplacer API- Specified by:
toReplacerPatternin interfaceUnicodeReplacer- Parameters:
escapeUnprintable- if true then convert unprintable character to their hex escape representations, \\uxxxx or \\Uxxxxxxxx. Unprintable characters are defined by Utility.isUnprintable().
-
addReplacementSetTo
Union the set of all characters that may output by this object into the given set.- Specified by:
addReplacementSetToin interfaceUnicodeReplacer- Parameters:
toUnionTo- the set into which to union the output characters
-