Package com.ibm.icu.text
Class FunctionReplacer
- java.lang.Object
-
- com.ibm.icu.text.FunctionReplacer
-
- All Implemented Interfaces:
UnicodeReplacer
class FunctionReplacer extends java.lang.Object implements 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
Fields Modifier and Type Field Description private UnicodeReplacer
replacer
The replacer object.private Transliterator
translit
The transliterator.
-
Constructor Summary
Constructors Constructor Description FunctionReplacer(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReplacementSetTo(UnicodeSet toUnionTo)
Union the set of all characters that may output by this object into the given set.int
replace(Replaceable text, int start, int limit, int[] cursor)
UnicodeReplacer APIjava.lang.String
toReplacerPattern(boolean escapeUnprintable)
UnicodeReplacer API
-
-
-
Field Detail
-
translit
private Transliterator translit
The transliterator. Must not be null.
-
replacer
private UnicodeReplacer replacer
The replacer object. This generates text that is then processed by 'translit'. Must not be null.
-
-
Constructor Detail
-
FunctionReplacer
public FunctionReplacer(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 Detail
-
replace
public int replace(Replaceable text, int start, int limit, int[] cursor)
UnicodeReplacer API- Specified by:
replace
in 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
public java.lang.String toReplacerPattern(boolean escapeUnprintable)
UnicodeReplacer API- Specified by:
toReplacerPattern
in 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
public void addReplacementSetTo(UnicodeSet toUnionTo)
Union the set of all characters that may output by this object into the given set.- Specified by:
addReplacementSetTo
in interfaceUnicodeReplacer
- Parameters:
toUnionTo
- the set into which to union the output characters
-
-