RuleBasedTransliterator. This set encodes
the transliteration in one direction from one set of characters or short
strings to another. A RuleBasedTransliterator consists of up to
two such sets, one for the forward direction, and one for the reverse.
A TransliterationRuleSet has one important operation, that of
finding a matching rule at a given point in the text. This is accomplished
by the findMatch() method.
Copyright © IBM Corporation 1999. All rights reserved.
| Modifier and Type | Field and Description |
|---|---|
| private int[] | index
Index table. |
| private int | maxContextLength
Length of the longest preceding context |
| private TransliterationRule[] | rules
Sorted and indexed table of rules. |
| private List | ruleVector
Vector of rules, in the order added. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv void | |
| public void | freeze()
Close this rule set to further additions, check it for masked rules, and index it to optimize performance. |
| public int | Returns: the length of the longest preceding context.Return the maximum context length. |
| pack-priv String | |
| public boolean | Returns: true unless a U_PARTIAL_MATCH has been obtained, indicating that transliteration should stop until more text arrives.the text to be transliterated text, Transliterator.the position indices, which will be updated pos,if true, assume new text may be inserted
at index.limit, and return false if there is a partial match. incremental)Transliterate the given text with the given UTransPosition indices. |
| index | back to summary |
|---|---|
| private int[] index Index table. For text having a first character c, compute x = c&0xFF. Now use rules[index[x]..index[x+1]-1]. This index table is created by freeze(). | |
| maxContextLength | back to summary |
|---|---|
| private int maxContextLength Length of the longest preceding context | |
| rules | back to summary |
|---|---|
| private TransliterationRule[] rules Sorted and indexed table of rules. This is created by freeze() from the rules in ruleVector. rules.length >= ruleVector.size(), and the references in rules[] are aliases of the references in ruleVector. A single rule in ruleVector is listed one or more times in rules[]. | |
| ruleVector | back to summary |
|---|---|
| private List<TransliterationRule> ruleVector Vector of rules, in the order added. | |
| TransliterationRuleSet | back to summary |
|---|---|
| public TransliterationRuleSet() Construct a new empty rule set. | |
| addRule | back to summary |
|---|---|
| public void addRule(TransliterationRule rule) Add a rule to this set. Rules are added in order, and order is significant.
| |
| addSourceTargetSet | back to summary |
|---|---|
| pack-priv void addSourceTargetSet(UnicodeSet filter, UnicodeSet sourceSet, UnicodeSet targetSet) | |
| freeze | back to summary |
|---|---|
| public void freeze() Close this rule set to further additions, check it for masked rules, and index it to optimize performance.
| |
| getMaximumContextLength | back to summary |
|---|---|
| public int getMaximumContextLength() Return the maximum context length.
| |
| toRules | back to summary |
|---|---|
| pack-priv String toRules(boolean escapeUnprintable) Create rule strings that represents this rule set. | |
| transliterate | back to summary |
|---|---|
| public boolean transliterate(Replaceable text, Transliterator. Transliterate the given text with the given UTransPosition indices. Return true if the transliteration should continue or false if it should halt (because of a U_PARTIAL_MATCH match). Note that false is only ever returned if isIncremental is true.
| |