Top Description Fields Constructors Methods
com.ibm.icu.impl.coll

public final Class CollationData

extends Object
Class Inheritance
Imports
com.ibm.icu.impl.Normalizer2Impl, .Trie2_32, com.ibm.icu.lang.UScript, com.ibm.icu.text.Collator, .UnicodeSet, com.ibm.icu.util.ICUException

Collation data container. Immutable data created by a CollationDataBuilder, or loaded from a file, or deserialized from API-provided binary data. Includes data for the collation base (root/default), aliased if this is not the base.

Field Summary

Modifier and TypeField and Description
public CollationData
base

Base collation data, or null if this data itself is a base.

pack-priv int[]
ce32s

Array of CE32 values.

pack-priv long[]
ces

Array of CE values for expansions and OFFSET_TAG.

public boolean[]
compressibleBytes

256 flags for which primary-weight lead bytes are compressible.

pack-priv String
contexts

Array of prefix and contraction-suffix matching data.

private static final int[]
public char[]
fastLatinTable

Fast Latin table for common-Latin-text string comparisons.

pack-priv char[]
fastLatinTableHeader

Header portion of the fastLatinTable.

pack-priv static final int
pack-priv int[]
jamoCE32s

Simple array of JAMO_CE32S_LENGTH=19+21+27 CE32s, one per canonical Jamo L/V/T.

pack-priv static final int
public Normalizer2Impl
pack-priv long
numericPrimary

The single-byte primary weight (xx000000) for numeric collation.

pack-priv int
numScripts

Data for scripts and reordering groups.

pack-priv static final int
pack-priv static final int
public long[]
rootElements

Collation elements in the root collator.

pack-priv char[]
scriptsIndex

The length of scriptsIndex is numScripts+16.

pack-priv char[]
scriptStarts

Start primary weight (top 16 bits only) for a group/script/reserved range indexed by scriptsIndex.

pack-priv Trie2_32
trie

Main lookup trie.

pack-priv UnicodeSet
unsafeBackwardSet

Set of code points that are unsafe for starting string comparison after an identical prefix, or in backwards CE iteration.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private int
addHighScriptRange(short[] table, int index, int highLimit)

private int
addLowScriptRange(short[] table, int index, int lowStart)

public int
getCE32(int c)

pack-priv int
getCE32FromContexts(int index)

Returns the CE32 from two contexts words.

pack-priv int
pack-priv long
getCEFromOffsetCE32(int c, int ce32)

Computes a CE from c's ce32 which has the OFFSET_TAG.

public int[]
pack-priv int
getFCD16(int c)

Returns the FCD16 value for code point c.

pack-priv int
getFinalCE32(int ce32)

Returns the CE32 for an indirect special CE32 (e.g., with DIGIT_TAG), if ce32 is special.

pack-priv long

Returns:

the primary with only the first primary lead byte of the group (not necessarily an actual root collator primary weight), or 0 if the script is unknown
getFirstPrimaryForGroup
(int script)

Returns the first primary for the script's reordering group.

public int

Returns:

the first script of the group, or -1 if the weight is beyond the last group
getGroupForPrimary
(long p)

Finds the reordering group which contains the primary weight.

pack-priv int
getIndirectCE32(int ce32)

Returns the CE32 for an indirect special CE32 (e.g., with DIGIT_TAG).

public long

Returns:

the last primary of the group (not an actual root collator primary weight), or 0 if the script is unknown
getLastPrimaryForGroup
(int script)

Returns the last primary for the script's reordering group.

private int
getScriptIndex(int script)

pack-priv long
getSingleCE(int c)

Returns the single CE that c maps to.

public boolean
public boolean
pack-priv boolean
isDigit(int c)

public boolean
isUnsafeBackward(int c, boolean numeric)

pack-priv void
makeReorderRanges(int[] reorder, UVector32 ranges)

Writes the permutation of primary-weight ranges for the given reordering of scripts and groups.

private void
makeReorderRanges(int[] reorder, boolean latinMustMove, UVector32 ranges)

private static String
scriptCodeString(int script)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseback to summary
public CollationData base

Base collation data, or null if this data itself is a base.

ce32sback to summary
pack-priv int[] ce32s

Array of CE32 values. At index 0 there must be CE32(U+0000) to support U+0000's special-tag for NUL-termination handling.

cesback to summary
pack-priv long[] ces

Array of CE values for expansions and OFFSET_TAG.

compressibleBytesback to summary
public boolean[] compressibleBytes

256 flags for which primary-weight lead bytes are compressible.

contextsback to summary
pack-priv String contexts

Array of prefix and contraction-suffix matching data.

EMPTY_INT_ARRAYback to summary
private static final int[] EMPTY_INT_ARRAY
fastLatinTableback to summary
public char[] fastLatinTable

Fast Latin table for common-Latin-text string comparisons. Data structure see class CollationFastLatin.

fastLatinTableHeaderback to summary
pack-priv char[] fastLatinTableHeader

Header portion of the fastLatinTable. In C++, these are one array, and the header is skipped for mapping characters. In Java, two arrays work better.

JAMO_CE32S_LENGTHback to summary
pack-priv static final int JAMO_CE32S_LENGTH
See Also
jamoCE32s
jamoCE32sback to summary
pack-priv int[] jamoCE32s

Simple array of JAMO_CE32S_LENGTH=19+21+27 CE32s, one per canonical Jamo L/V/T. They are normally simple CE32s, rarely expansions. For fast handling of HANGUL_TAG.

MAX_NUM_SPECIAL_REORDER_CODESback to summary
pack-priv static final int MAX_NUM_SPECIAL_REORDER_CODES
nfcImplback to summary
public Normalizer2Impl nfcImpl
numericPrimaryback to summary
pack-priv long numericPrimary

The single-byte primary weight (xx000000) for numeric collation.

numScriptsback to summary
pack-priv int numScripts

Data for scripts and reordering groups. Uses include building a reordering permutation table and providing script boundaries to AlphabeticIndex.

REORDER_RESERVED_AFTER_LATINback to summary
pack-priv static final int REORDER_RESERVED_AFTER_LATIN
REORDER_RESERVED_BEFORE_LATINback to summary
pack-priv static final int REORDER_RESERVED_BEFORE_LATIN
rootElementsback to summary
public long[] rootElements

Collation elements in the root collator. Used by the CollationRootElements class. The data structure is described there. null in a tailoring.

scriptsIndexback to summary
pack-priv char[] scriptsIndex

The length of scriptsIndex is numScripts+16. It maps from a UScriptCode or a special reorder code to an entry in scriptStarts. 16 special reorder codes (not all used) are mapped starting at numScripts. Up to MAX_NUM_SPECIAL_REORDER_CODES are codes for special groups like space/punct/digit. There are special codes at the end for reorder-reserved primary ranges.

Multiple scripts may share a range and index, for example Hira & Kana.

scriptStartsback to summary
pack-priv char[] scriptStarts

Start primary weight (top 16 bits only) for a group/script/reserved range indexed by scriptsIndex. The first range (separators & terminators) and the last range (trailing weights) are not reorderable, and no scriptsIndex entry points to them.

trieback to summary
pack-priv Trie2_32 trie

Main lookup trie.

unsafeBackwardSetback to summary
pack-priv UnicodeSet unsafeBackwardSet

Set of code points that are unsafe for starting string comparison after an identical prefix, or in backwards CE iteration.

Constructor Detail

CollationDataback to summary
pack-priv CollationData(Normalizer2Impl nfc)

Method Detail

addHighScriptRangeback to summary
private int addHighScriptRange(short[] table, int index, int highLimit)
addLowScriptRangeback to summary
private int addLowScriptRange(short[] table, int index, int lowStart)
getCE32back to summary
public int getCE32(int c)
getCE32FromContextsback to summary
pack-priv int getCE32FromContexts(int index)

Returns the CE32 from two contexts words. Access to the defaultCE32 for contraction and prefix matching.

getCE32FromSupplementaryback to summary
pack-priv int getCE32FromSupplementary(int c)
getCEFromOffsetCE32back to summary
pack-priv long getCEFromOffsetCE32(int c, int ce32)

Computes a CE from c's ce32 which has the OFFSET_TAG.

getEquivalentScriptsback to summary
public int[] getEquivalentScripts(int script)
getFCD16back to summary
pack-priv int getFCD16(int c)

Returns the FCD16 value for code point c. c must be >= 0.

getFinalCE32back to summary
pack-priv int getFinalCE32(int ce32)

Returns the CE32 for an indirect special CE32 (e.g., with DIGIT_TAG), if ce32 is special.

getFirstPrimaryForGroupback to summary
pack-priv long getFirstPrimaryForGroup(int script)

Returns the first primary for the script's reordering group.

Returns:long

the primary with only the first primary lead byte of the group (not necessarily an actual root collator primary weight), or 0 if the script is unknown

getGroupForPrimaryback to summary
public int getGroupForPrimary(long p)

Finds the reordering group which contains the primary weight.

Returns:int

the first script of the group, or -1 if the weight is beyond the last group

getIndirectCE32back to summary
pack-priv int getIndirectCE32(int ce32)

Returns the CE32 for an indirect special CE32 (e.g., with DIGIT_TAG). Requires that ce32 is special.

getLastPrimaryForGroupback to summary
public long getLastPrimaryForGroup(int script)

Returns the last primary for the script's reordering group.

Returns:long

the last primary of the group (not an actual root collator primary weight), or 0 if the script is unknown

getScriptIndexback to summary
private int getScriptIndex(int script)
getSingleCEback to summary
pack-priv long getSingleCE(int c)

Returns the single CE that c maps to. Throws UnsupportedOperationException if c does not map to a single CE.

isCompressibleLeadByteback to summary
public boolean isCompressibleLeadByte(int b)
isCompressiblePrimaryback to summary
public boolean isCompressiblePrimary(long p)
isDigitback to summary
pack-priv boolean isDigit(int c)
isUnsafeBackwardback to summary
public boolean isUnsafeBackward(int c, boolean numeric)
makeReorderRangesback to summary
pack-priv void makeReorderRanges(int[] reorder, UVector32 ranges)

Writes the permutation of primary-weight ranges for the given reordering of scripts and groups. The caller checks for illegal arguments and takes care of [DEFAULT] and memory allocation.

Each list element will be a (limit, offset) pair as described for the CollationSettings.reorderRanges. The list will be empty if no ranges are reordered.

makeReorderRangesback to summary
private void makeReorderRanges(int[] reorder, boolean latinMustMove, UVector32 ranges)
scriptCodeStringback to summary
private static String scriptCodeString(int script)