Class CollationRootElements
java.lang.Object
com.ibm.icu.impl.coll.CollationRootElements
Container and access methods for collation elements and weights
that occur in the root collator.
Needed for finding boundaries for building a tailoring.
This class takes and returns 16-bit secondary and tertiary weights.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long[]Data structure: See ICU4C source/i18n/collationrootelements.h.(package private) static final intMust match Collation.COMMON_SEC_AND_TER_CE.(package private) static final intThe current number of indexes.(package private) static final intIndex of the first CE with a non-zero primary weight.(package private) static final intIndex of the first CE with a non-zero secondary weight.static final intIndex of the first CE with a non-zero tertiary weight.(package private) static final intSecondary invalid input: '&' tertiary boundaries.static final longHigher than any root primary.static final intMask for getting the primary range step value from a primary-range-end element.static final intFlag in a root element, set if the element contains secondary invalid input: '&' tertiary weights, rather than a primary. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate intfindP(long p) Finds the largest index i where elements[i]invalid input: '<'=p.(package private) intfindPrimary(long p) Finds the index of the input primary.(package private) longfirstCEWithPrimaryAtLeast(long p) Returns the first root CE with a primary weight of at least p.(package private) longReturns the first assigned primary weight.(package private) longReturns the first assigned primary CE.(package private) longReturns the first assigned secondary CE.private longgetFirstSecTerForPrimary(int index) Returns the first secondary invalid input: '&' tertiary weights for p where index=findPrimary(p)+1.(package private) longReturns the first assigned tertiary CE.intReturns the last common secondary weight.(package private) longReturns the last assigned secondary CE.(package private) longReturns the last assigned tertiary CE.(package private) longgetPrimaryAfter(long p, int index, boolean isCompressible) Returns the primary weight after p where index=findPrimary(p).(package private) longgetPrimaryBefore(long p, boolean isCompressible) Returns the primary weight before p.(package private) intgetSecondaryAfter(int index, int s) Returns the secondary weight after [p, s] where index=findPrimary(p) except use index=0 for p=0.(package private) intgetSecondaryBefore(long p, int s) Returns the secondary weight before [p, s].intReturns the boundary between secondary weights of primary CEs and those of secondary CEs.(package private) intgetTertiaryAfter(int index, int s, int t) Returns the tertiary weight after [p, s, t] where index=findPrimary(p) except use index=0 for p=0.(package private) intgetTertiaryBefore(long p, int s, int t) Returns the tertiary weight before [p, s, t].intReturns the boundary between tertiary weights of primary/secondary CEs and those of tertiary CEs.private static booleanisEndOfPrimaryRange(long q) (package private) longlastCEWithPrimaryBefore(long p) Returns the last root CE with a primary weight before p.
-
Field Details
-
PRIMARY_SENTINEL
public static final long PRIMARY_SENTINELHigher than any root primary.- See Also:
-
SEC_TER_DELTA_FLAG
public static final int SEC_TER_DELTA_FLAGFlag in a root element, set if the element contains secondary invalid input: '&' tertiary weights, rather than a primary.- See Also:
-
PRIMARY_STEP_MASK
public static final int PRIMARY_STEP_MASKMask for getting the primary range step value from a primary-range-end element.- See Also:
-
IX_FIRST_TERTIARY_INDEX
public static final int IX_FIRST_TERTIARY_INDEXIndex of the first CE with a non-zero tertiary weight. Same as the start of the compact root elements table.- See Also:
-
IX_FIRST_SECONDARY_INDEX
static final int IX_FIRST_SECONDARY_INDEXIndex of the first CE with a non-zero secondary weight.- See Also:
-
IX_FIRST_PRIMARY_INDEX
static final int IX_FIRST_PRIMARY_INDEXIndex of the first CE with a non-zero primary weight.- See Also:
-
IX_COMMON_SEC_AND_TER_CE
static final int IX_COMMON_SEC_AND_TER_CEMust match Collation.COMMON_SEC_AND_TER_CE.- See Also:
-
IX_SEC_TER_BOUNDARIES
static final int IX_SEC_TER_BOUNDARIESSecondary invalid input: '&' tertiary boundaries. Bits 31..24: [fixed last secondary common byte 45] Bits 23..16: [fixed first ignorable secondary byte 80] Bits 15.. 8: reserved, 0 Bits 7.. 0: [fixed first ignorable tertiary byte 3C]- See Also:
-
IX_COUNT
static final int IX_COUNTThe current number of indexes. Currently the same as elements[IX_FIRST_TERTIARY_INDEX].- See Also:
-
elements
private long[] elementsData structure: See ICU4C source/i18n/collationrootelements.h.
-
-
Constructor Details
-
CollationRootElements
public CollationRootElements(long[] rootElements)
-
-
Method Details
-
getTertiaryBoundary
public int getTertiaryBoundary()Returns the boundary between tertiary weights of primary/secondary CEs and those of tertiary CEs. This is the upper limit for tertiaries of primary/secondary CEs. This minus one is the lower limit for tertiaries of tertiary CEs. -
getFirstTertiaryCE
long getFirstTertiaryCE()Returns the first assigned tertiary CE. -
getLastTertiaryCE
long getLastTertiaryCE()Returns the last assigned tertiary CE. -
getLastCommonSecondary
public int getLastCommonSecondary()Returns the last common secondary weight. This is the lower limit for secondaries of primary CEs. -
getSecondaryBoundary
public int getSecondaryBoundary()Returns the boundary between secondary weights of primary CEs and those of secondary CEs. This is the upper limit for secondaries of primary CEs. This minus one is the lower limit for secondaries of secondary CEs. -
getFirstSecondaryCE
long getFirstSecondaryCE()Returns the first assigned secondary CE. -
getLastSecondaryCE
long getLastSecondaryCE()Returns the last assigned secondary CE. -
getFirstPrimary
long getFirstPrimary()Returns the first assigned primary weight. -
getFirstPrimaryCE
long getFirstPrimaryCE()Returns the first assigned primary CE. -
lastCEWithPrimaryBefore
long lastCEWithPrimaryBefore(long p) Returns the last root CE with a primary weight before p. Intended only for reordering group boundaries. -
firstCEWithPrimaryAtLeast
long firstCEWithPrimaryAtLeast(long p) Returns the first root CE with a primary weight of at least p. Intended only for reordering group boundaries. -
getPrimaryBefore
long getPrimaryBefore(long p, boolean isCompressible) Returns the primary weight before p. p must be greater than the first root primary. -
getSecondaryBefore
int getSecondaryBefore(long p, int s) Returns the secondary weight before [p, s]. -
getTertiaryBefore
int getTertiaryBefore(long p, int s, int t) Returns the tertiary weight before [p, s, t]. -
findPrimary
int findPrimary(long p) Finds the index of the input primary. p must occur as a root primary, and must not be 0. -
getPrimaryAfter
long getPrimaryAfter(long p, int index, boolean isCompressible) Returns the primary weight after p where index=findPrimary(p). p must be at least the first root primary. -
getSecondaryAfter
int getSecondaryAfter(int index, int s) Returns the secondary weight after [p, s] where index=findPrimary(p) except use index=0 for p=0.Must return a weight for every root [p, s] as well as for every weight returned by getSecondaryBefore(). If p!=0 then s can be BEFORE_WEIGHT16.
Exception: [0, 0] is handled by the CollationBuilder: Both its lower and upper boundaries are special.
-
getTertiaryAfter
int getTertiaryAfter(int index, int s, int t) Returns the tertiary weight after [p, s, t] where index=findPrimary(p) except use index=0 for p=0.Must return a weight for every root [p, s, t] as well as for every weight returned by getTertiaryBefore(). If s!=0 then t can be BEFORE_WEIGHT16.
Exception: [0, 0, 0] is handled by the CollationBuilder: Both its lower and upper boundaries are special.
-
getFirstSecTerForPrimary
private long getFirstSecTerForPrimary(int index) Returns the first secondary invalid input: '&' tertiary weights for p where index=findPrimary(p)+1. -
findP
private int findP(long p) Finds the largest index i where elements[i]invalid input: '<'=p. Requires first primaryinvalid input: '<'=pinvalid input: '<'0xffffff00 (PRIMARY_SENTINEL). Does not require that p is a root collator primary. -
isEndOfPrimaryRange
private static boolean isEndOfPrimaryRange(long q)
-