Package com.ibm.icu.impl.coll
Class CollationDataBuilder
java.lang.Object
com.ibm.icu.impl.coll.CollationDataBuilder
Low-level CollationData builder.
Takes (character, CE) pairs and builds them into runtime data structures.
Supports characters with context prefixes and contraction suffixes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface
Collation element modifier.private static final class
Build-time context and CE32 for a code point.private static final class
private static final class
Build-time collation element and character iterator. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CollationData
protected CollationSettings
protected UVector32
protected UVector64
protected ArrayList
<CollationDataBuilder.ConditionalCE32> protected UnicodeSet
protected StringBuilder
private int
The "era" of building intermediate contexts.protected CollationFastLatinBuilder
protected boolean
private static final int
protected boolean
protected Normalizer2Impl
protected Trie2Writable
protected UnicodeSet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
add
(CharSequence prefix, CharSequence s, long[] ces, int cesLength) protected int
addCE
(long ce) protected int
addCE32
(int ce32) (package private) void
addCE32
(CharSequence prefix, CharSequence s, int ce32) protected int
addConditionalCE32
(String context, int ce32) protected int
addContextTrie
(int defaultCE32, CharsTrieBuilder trieBuilder) (package private) void
build
(CollationData data) protected int
protected void
protected void
protected void
buildMappings
(CollationData data) protected void
protected int
copyContractionsFromBaseCE32
(StringBuilder context, int c, int ce32, CollationDataBuilder.ConditionalCE32 cond) Copies base contractions to a list of ConditionalCE32.(package private) void
copyFrom
(CollationDataBuilder src, CollationDataBuilder.CEModifier modifier) Copies all mappings from the src builder, with modifications.protected int
copyFromBaseCE32
(int c, int ce32, boolean withContext) (package private) void
(package private) int
encodeCEs
(long[] ces, int cesLength) Encodes the ces as either the returned ce32 by itself, or by storing an expansion, with the returned ce32 referring to that.protected int
encodeExpansion
(long[] ces, int start, int length) protected int
encodeExpansion32
(int[] newCE32s, int start, int length) protected int
encodeOneCE
(long ce) protected static int
encodeOneCEAsCE32
(long ce) private static void
enumRangeForCopy
(int start, int end, int value, CollationDataBuilder.CopyHelper helper) protected int
getCE32FromOffsetCE32
(boolean fromBase, int c, int ce32) protected int
getCEs
(CharSequence s, int start, long[] ces, int cesLength) (package private) int
getCEs
(CharSequence s, long[] ces, int cesLength) Looks up CEs for s and appends them to the ces array.(package private) int
getCEs
(CharSequence prefix, CharSequence s, long[] ces, int cesLength) protected CollationDataBuilder.ConditionalCE32
getConditionalCE32
(int index) protected CollationDataBuilder.ConditionalCE32
getConditionalCE32ForCE32
(int ce32) protected boolean
getJamoCE32s
(int[] jamoCE32s) (package private) boolean
(package private) void
(package private) boolean
isAssigned
(int c) protected static boolean
isBuilderContextCE32
(int ce32) (package private) boolean
isCompressibleLeadByte
(int b) (package private) boolean
isCompressiblePrimary
(long p) protected final boolean
protected static int
jamoCpFromIndex
(int i) protected static int
makeBuilderContextCE32
(int index) (package private) void
optimize
(UnicodeSet set) protected void
protected void
(package private) void
-
Field Details
-
IS_BUILDER_JAMO_CE32
private static final int IS_BUILDER_JAMO_CE32- See Also:
-
nfcImpl
-
base
-
baseSettings
-
trie
-
ce32s
-
ce64s
-
conditionalCE32s
-
contextChars
-
contexts
-
contextsEra
private int contextsEraThe "era" of building intermediate contexts. When the array of cached, temporary contexts overflows, then clearContexts() removes them all and invalidates the builtCE32 that used to point to built tries. SeeCollationDataBuilder.ConditionalCE32.era
. -
unsafeBackwardSet
-
modified
protected boolean modified -
fastLatinEnabled
protected boolean fastLatinEnabled -
fastLatinBuilder
-
collIter
-
-
Constructor Details
-
CollationDataBuilder
CollationDataBuilder()
-
-
Method Details
-
initForTailoring
-
isCompressibleLeadByte
boolean isCompressibleLeadByte(int b) -
isCompressiblePrimary
boolean isCompressiblePrimary(long p) -
hasMappings
boolean hasMappings()- Returns:
- true if this builder has mappings (e.g., add() has been called)
-
isAssigned
boolean isAssigned(int c) - Returns:
- true if c has CEs in this builder
-
add
-
encodeCEs
int encodeCEs(long[] ces, int cesLength) Encodes the ces as either the returned ce32 by itself, or by storing an expansion, with the returned ce32 referring to that.add(p, s, ces, cesLength) = addCE32(p, s, encodeCEs(ces, cesLength))
-
addCE32
-
copyFrom
Copies all mappings from the src builder, with modifications. This builder here must not be built yet, and should be empty. -
optimize
-
suppressContractions
-
enableFastLatin
void enableFastLatin() -
build
-
getCEs
Looks up CEs for s and appends them to the ces array. Does not handle normalization: s should be in FCD form. Does not write completely ignorable CEs. Does not write beyond Collation.MAX_EXPANSION_LENGTH.- Returns:
- incremented cesLength
-
getCEs
-
getCE32FromOffsetCE32
protected int getCE32FromOffsetCE32(boolean fromBase, int c, int ce32) -
addCE
protected int addCE(long ce) -
addCE32
protected int addCE32(int ce32) -
addConditionalCE32
-
getConditionalCE32
-
getConditionalCE32ForCE32
-
makeBuilderContextCE32
protected static int makeBuilderContextCE32(int index) -
isBuilderContextCE32
protected static boolean isBuilderContextCE32(int ce32) -
encodeOneCEAsCE32
protected static int encodeOneCEAsCE32(long ce) -
encodeOneCE
protected int encodeOneCE(long ce) -
encodeExpansion
protected int encodeExpansion(long[] ces, int start, int length) -
encodeExpansion32
protected int encodeExpansion32(int[] newCE32s, int start, int length) -
copyFromBaseCE32
protected int copyFromBaseCE32(int c, int ce32, boolean withContext) -
copyContractionsFromBaseCE32
protected int copyContractionsFromBaseCE32(StringBuilder context, int c, int ce32, CollationDataBuilder.ConditionalCE32 cond) Copies base contractions to a list of ConditionalCE32. Sets cond.next to the index of the first new item and returns the index of the last new item. -
enumRangeForCopy
private static void enumRangeForCopy(int start, int end, int value, CollationDataBuilder.CopyHelper helper) -
getJamoCE32s
protected boolean getJamoCE32s(int[] jamoCE32s) -
setDigitTags
protected void setDigitTags() -
setLeadSurrogates
protected void setLeadSurrogates() -
buildMappings
-
clearContexts
protected void clearContexts() -
buildContexts
protected void buildContexts() -
buildContext
-
addContextTrie
-
buildFastLatinTable
-
getCEs
-
jamoCpFromIndex
protected static int jamoCpFromIndex(int i) -
isMutable
protected final boolean isMutable()
-