Package com.ibm.icu.text
Class TitlecaseTransliterator
- java.lang.Object
-
- com.ibm.icu.text.Transliterator
-
- com.ibm.icu.text.TitlecaseTransliterator
-
- All Implemented Interfaces:
StringTransform
,Transform<java.lang.String,java.lang.String>
class TitlecaseTransliterator extends Transliterator
A transliterator that converts all letters (as defined byUCharacter.isLetter()
) to lower case, except for those letters preceded by non-letters. The latter are converted to title case usingUCharacter.toTitleCase()
.
-
-
Nested Class Summary
-
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 java.lang.String
_ID
private int
caseLocale
private UCaseProps
csp
private ReplaceableContextIterator
iter
private ULocale
locale
private java.lang.StringBuilder
result
(package private) SourceTargetUtility
sourceTargetUtility
-
Fields inherited from class com.ibm.icu.text.Transliterator
DEBUG, FORWARD, ID_DELIM, ID_SEP, REVERSE, VARIANT_SEP
-
-
Constructor Summary
Constructors Constructor Description TitlecaseTransliterator(ULocale loc)
Constructs a transliterator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet)
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 text, Transliterator.Position offsets, boolean isIncremental)
(package private) static void
register()
System registration hook.-
Methods inherited from class com.ibm.icu.text.Transliterator
baseToRules, createFromRules, filteredTransliterate, finishTransliteration, getAvailableIDs, getAvailableSources, getAvailableTargets, getAvailableVariants, getBasicInstance, getDisplayName, getDisplayName, getDisplayName, getElements, getFilter, getFilterAsUnicodeSet, getID, getInstance, getInstance, getInverse, getMaximumContextLength, getSourceSet, getTargetSet, handleGetSourceSet, registerAlias, registerAny, registerClass, registerFactory, registerInstance, registerInstance, registerSpecialInverse, setFilter, setID, setMaximumContextLength, toRules, transform, transliterate, transliterate, transliterate, transliterate, transliterate, transliterate, unregister
-
-
-
-
Field Detail
-
_ID
static final java.lang.String _ID
- See Also:
- Constant Field Values
-
locale
private final ULocale locale
-
csp
private final UCaseProps csp
-
iter
private ReplaceableContextIterator iter
-
result
private java.lang.StringBuilder result
-
caseLocale
private int caseLocale
-
sourceTargetUtility
SourceTargetUtility sourceTargetUtility
-
-
Constructor Detail
-
TitlecaseTransliterator
public TitlecaseTransliterator(ULocale loc)
Constructs a transliterator.
-
-
Method Detail
-
register
static void register()
System registration hook.
-
handleTransliterate
protected void handleTransliterate(Replaceable text, Transliterator.Position offsets, boolean isIncremental)
- 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)
-
addSourceTargetSet
public void addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet)
Description copied from class:Transliterator
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.- Overrides:
addSourceTargetSet
in classTransliterator
targetSet
- TODO- See Also:
Transliterator.getTargetSet()
-
-