Package com.ibm.icu.impl.coll
Class CollationSettings
- java.lang.Object
-
- com.ibm.icu.impl.coll.SharedObject
-
- com.ibm.icu.impl.coll.CollationSettings
-
- All Implemented Interfaces:
java.lang.Cloneable
public final class CollationSettings extends SharedObject
Collation settings/options/attributes. These are the values that can be changed via API.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.ibm.icu.impl.coll.SharedObject
SharedObject.Reference<T extends SharedObject>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
ALTERNATE_MASK
Options bits 3..2: Alternate-handling mask.static int
BACKWARD_SECONDARY
Options bit 11: Compare secondary weights backwards.static int
CASE_FIRST
Options bit 9: Keep the case bits in the tertiary weight (they trump other tertiary values) unless case level is on (when they are *moved* into the separate case level).static int
CASE_FIRST_AND_UPPER_MASK
Options bit mask for caseFirst and upperFirst, before shifting.static int
CASE_LEVEL
Options bit 10: Insert the case level between the secondary and tertiary levels.static int
CHECK_FCD
Options bit 0: Perform the FCD check on the input text and deliver normalized text.private static int[]
EMPTY_INT_ARRAY
int
fastLatinOptions
Options for CollationFastLatin.char[]
fastLatinPrimaries
(package private) static int
MAX_VAR_CURRENCY
(package private) static int
MAX_VAR_PUNCT
(package private) static int
MAX_VAR_SPACE
maxVariable values(package private) static int
MAX_VAR_SYMBOL
(package private) static int
MAX_VARIABLE_MASK
maxVariable options bit mask before shifting.(package private) static int
MAX_VARIABLE_SHIFT
Options bits 6..4: The 3-bit maxVariable value bit field is shifted by this value.(package private) long
minHighNoReorder
Limit of last reordered range.static int
NUMERIC
Options bit 1: Numeric collation.int
options
CHECK_FCD etc.int[]
reorderCodes
Array of reorder codes; ignored if length == 0.(package private) long[]
reorderRanges
Primary-weight ranges for script reordering, to be used by reorder(p) for split-reordered primary lead bytes.byte[]
reorderTable
256-byte table for reordering permutation of primary lead bytes; null if no reordering.(package private) static int
SHIFTED
"Shifted" alternate handling, see ALTERNATE_MASK.(package private) static int
STRENGTH_MASK
Strength options bit mask before shifting.(package private) static int
STRENGTH_SHIFT
Options bits 15..12: The 4-bit strength value bit field is shifted by this value.(package private) static int
UPPER_FIRST
Options bit 8: Sort uppercase first if caseLevel or caseFirst is on.long
variableTop
Variable-top primary weight.
-
Constructor Summary
Constructors Constructor Description CollationSettings()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
aliasReordering(CollationData data, int[] codesAndRanges, int codesLength, byte[] table)
CollationSettings
clone()
Initializes refCount to 0.void
copyReorderingFrom(CollationSettings other)
boolean
dontCheckFCD()
boolean
equals(java.lang.Object other)
boolean
getAlternateHandling()
int
getCaseFirst()
boolean
getFlag(int bit)
int
getMaxVariable()
int
getStrength()
(package private) static int
getStrength(int options)
(package private) static int
getTertiaryMask(int options)
(package private) boolean
hasBackwardSecondary()
int
hashCode()
boolean
hasReordering()
boolean
isNumeric()
(package private) static boolean
isTertiaryWithCaseBits(int options)
Include case bits in the tertiary level if caseLevel=off and caseFirst!=off.long
reorder(long p)
private long
reorderEx(long p)
private static boolean
reorderTableHasSplitBytes(byte[] table)
void
resetReordering()
void
setAlternateHandlingDefault(int defaultOptions)
void
setAlternateHandlingShifted(boolean value)
void
setCaseFirst(int value)
void
setCaseFirstDefault(int defaultOptions)
void
setFlag(int bit, boolean value)
Sets the options bit for an on/off attribute.void
setFlagDefault(int bit, int defaultOptions)
void
setMaxVariable(int value, int defaultOptions)
private void
setReorderArrays(int[] codes, int[] ranges, int rangesStart, int rangesLength, byte[] table)
void
setReordering(CollationData data, int[] codes)
private void
setReorderRanges(int[] ranges, int rangesStart, int rangesLength)
void
setStrength(int value)
void
setStrengthDefault(int defaultOptions)
(package private) static boolean
sortsTertiaryUpperCaseFirst(int options)
-
Methods inherited from class com.ibm.icu.impl.coll.SharedObject
addRef, deleteIfZeroRefCount, getRefCount, removeRef
-
-
-
-
Field Detail
-
CHECK_FCD
public static final int CHECK_FCD
Options bit 0: Perform the FCD check on the input text and deliver normalized text.- See Also:
- Constant Field Values
-
NUMERIC
public static final int NUMERIC
Options bit 1: Numeric collation. Also known as CODAN = COllate Digits As Numbers. Treat digit sequences as numbers with CE sequences in numeric order, rather than returning a normal CE for each digit.- See Also:
- Constant Field Values
-
SHIFTED
static final int SHIFTED
"Shifted" alternate handling, see ALTERNATE_MASK.- See Also:
- Constant Field Values
-
ALTERNATE_MASK
static final int ALTERNATE_MASK
Options bits 3..2: Alternate-handling mask. 0 for non-ignorable. Reserve values 8 and 0xc for shift-trimmed and blanked.- See Also:
- Constant Field Values
-
MAX_VARIABLE_SHIFT
static final int MAX_VARIABLE_SHIFT
Options bits 6..4: The 3-bit maxVariable value bit field is shifted by this value.- See Also:
- Constant Field Values
-
MAX_VARIABLE_MASK
static final int MAX_VARIABLE_MASK
maxVariable options bit mask before shifting.- See Also:
- Constant Field Values
-
UPPER_FIRST
static final int UPPER_FIRST
Options bit 8: Sort uppercase first if caseLevel or caseFirst is on.- See Also:
- Constant Field Values
-
CASE_FIRST
public static final int CASE_FIRST
Options bit 9: Keep the case bits in the tertiary weight (they trump other tertiary values) unless case level is on (when they are *moved* into the separate case level). By default, the case bits are removed from the tertiary weight (ignored). When CASE_FIRST is off, UPPER_FIRST must be off too, corresponding to the tri-value UCOL_CASE_FIRST attribute: UCOL_OFF vs. UCOL_LOWER_FIRST vs. UCOL_UPPER_FIRST.- See Also:
- Constant Field Values
-
CASE_FIRST_AND_UPPER_MASK
public static final int CASE_FIRST_AND_UPPER_MASK
Options bit mask for caseFirst and upperFirst, before shifting. Same value as caseFirst==upperFirst.- See Also:
- Constant Field Values
-
CASE_LEVEL
public static final int CASE_LEVEL
Options bit 10: Insert the case level between the secondary and tertiary levels.- See Also:
- Constant Field Values
-
BACKWARD_SECONDARY
public static final int BACKWARD_SECONDARY
Options bit 11: Compare secondary weights backwards. ("French secondary")- See Also:
- Constant Field Values
-
STRENGTH_SHIFT
static final int STRENGTH_SHIFT
Options bits 15..12: The 4-bit strength value bit field is shifted by this value. It is the top used bit field in the options. (No need to mask after shifting.)- See Also:
- Constant Field Values
-
STRENGTH_MASK
static final int STRENGTH_MASK
Strength options bit mask before shifting.- See Also:
- Constant Field Values
-
MAX_VAR_SPACE
static final int MAX_VAR_SPACE
maxVariable values- See Also:
- Constant Field Values
-
MAX_VAR_PUNCT
static final int MAX_VAR_PUNCT
- See Also:
- Constant Field Values
-
MAX_VAR_SYMBOL
static final int MAX_VAR_SYMBOL
- See Also:
- Constant Field Values
-
MAX_VAR_CURRENCY
static final int MAX_VAR_CURRENCY
- See Also:
- Constant Field Values
-
options
public int options
CHECK_FCD etc.
-
variableTop
public long variableTop
Variable-top primary weight.
-
reorderTable
public byte[] reorderTable
256-byte table for reordering permutation of primary lead bytes; null if no reordering. A 0 entry at a non-zero index means that the primary lead byte is "split" (there are different offsets for primaries that share that lead byte) and the reordering offset must be determined via the reorderRanges.
-
minHighNoReorder
long minHighNoReorder
Limit of last reordered range. 0 if no reordering or no split bytes.
-
reorderRanges
long[] reorderRanges
Primary-weight ranges for script reordering, to be used by reorder(p) for split-reordered primary lead bytes.Each entry is a (limit, offset) pair. The upper 16 bits of the entry are the upper 16 bits of the exclusive primary limit of a range. Primaries between the previous limit and this one have their lead bytes modified by the signed offset (-0xff..+0xff) stored in the lower 16 bits.
CollationData.makeReorderRanges() writes a full list where the first range (at least for terminators and separators) has a 0 offset. The last range has a non-zero offset. minHighNoReorder is set to the limit of that last range.
In the settings object, the initial ranges before the first split lead byte are omitted for efficiency; they are handled by reorder(p) via the reorderTable. If there are no split-reordered lead bytes, then no ranges are needed.
-
reorderCodes
public int[] reorderCodes
Array of reorder codes; ignored if length == 0.
-
EMPTY_INT_ARRAY
private static final int[] EMPTY_INT_ARRAY
-
fastLatinOptions
public int fastLatinOptions
Options for CollationFastLatin. Negative if disabled.
-
fastLatinPrimaries
public char[] fastLatinPrimaries
-
-
Method Detail
-
clone
public CollationSettings clone()
Description copied from class:SharedObject
Initializes refCount to 0.- Overrides:
clone
in classSharedObject
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
resetReordering
public void resetReordering()
-
aliasReordering
void aliasReordering(CollationData data, int[] codesAndRanges, int codesLength, byte[] table)
-
setReordering
public void setReordering(CollationData data, int[] codes)
-
setReorderArrays
private void setReorderArrays(int[] codes, int[] ranges, int rangesStart, int rangesLength, byte[] table)
-
setReorderRanges
private void setReorderRanges(int[] ranges, int rangesStart, int rangesLength)
-
copyReorderingFrom
public void copyReorderingFrom(CollationSettings other)
-
hasReordering
public boolean hasReordering()
-
reorderTableHasSplitBytes
private static boolean reorderTableHasSplitBytes(byte[] table)
-
reorder
public long reorder(long p)
-
reorderEx
private long reorderEx(long p)
-
setStrength
public void setStrength(int value)
-
setStrengthDefault
public void setStrengthDefault(int defaultOptions)
-
getStrength
static int getStrength(int options)
-
getStrength
public int getStrength()
-
setFlag
public void setFlag(int bit, boolean value)
Sets the options bit for an on/off attribute.
-
setFlagDefault
public void setFlagDefault(int bit, int defaultOptions)
-
getFlag
public boolean getFlag(int bit)
-
setCaseFirst
public void setCaseFirst(int value)
-
setCaseFirstDefault
public void setCaseFirstDefault(int defaultOptions)
-
getCaseFirst
public int getCaseFirst()
-
setAlternateHandlingShifted
public void setAlternateHandlingShifted(boolean value)
-
setAlternateHandlingDefault
public void setAlternateHandlingDefault(int defaultOptions)
-
getAlternateHandling
public boolean getAlternateHandling()
-
setMaxVariable
public void setMaxVariable(int value, int defaultOptions)
-
getMaxVariable
public int getMaxVariable()
-
isTertiaryWithCaseBits
static boolean isTertiaryWithCaseBits(int options)
Include case bits in the tertiary level if caseLevel=off and caseFirst!=off.
-
getTertiaryMask
static int getTertiaryMask(int options)
-
sortsTertiaryUpperCaseFirst
static boolean sortsTertiaryUpperCaseFirst(int options)
-
dontCheckFCD
public boolean dontCheckFCD()
-
hasBackwardSecondary
boolean hasBackwardSecondary()
-
isNumeric
public boolean isNumeric()
-
-