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

public final Class CollationRootElements

extends Object
Class Inheritance

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

Modifier and TypeField and Description
private long[]
elements

Data structure: See ICU4C source/i18n/collationrootelements.h.

pack-priv static final int
IX_COMMON_SEC_AND_TER_CE

Must match Collation.COMMON_SEC_AND_TER_CE.

pack-priv static final int
IX_COUNT

The current number of indexes.

pack-priv static final int
IX_FIRST_PRIMARY_INDEX

Index of the first CE with a non-zero primary weight.

pack-priv static final int
IX_FIRST_SECONDARY_INDEX

Index of the first CE with a non-zero secondary weight.

public static final int
IX_FIRST_TERTIARY_INDEX

Index of the first CE with a non-zero tertiary weight.

pack-priv static final int
IX_SEC_TER_BOUNDARIES

Secondary & tertiary boundaries.

public static final long
PRIMARY_SENTINEL

Higher than any root primary.

public static final int
PRIMARY_STEP_MASK

Mask for getting the primary range step value from a primary-range-end element.

public static final int
SEC_TER_DELTA_FLAG

Flag in a root element, set if the element contains secondary & tertiary weights, rather than a primary.

Constructor Summary

AccessConstructor and Description
public
CollationRootElements(long[] rootElements)

Method Summary

Modifier and TypeMethod and Description
private int
findP(long p)

Finds the largest index i where elements[i]<=p.

pack-priv int
findPrimary(long p)

Finds the index of the input primary.

pack-priv long
firstCEWithPrimaryAtLeast(long p)

Returns the first root CE with a primary weight of at least p.

pack-priv long
getFirstPrimary()

Returns the first assigned primary weight.

pack-priv long
getFirstPrimaryCE()

Returns the first assigned primary CE.

pack-priv long
getFirstSecondaryCE()

Returns the first assigned secondary CE.

private long
getFirstSecTerForPrimary(int index)

Returns the first secondary & tertiary weights for p where index=findPrimary(p)+1.

pack-priv long
getFirstTertiaryCE()

Returns the first assigned tertiary CE.

public int
getLastCommonSecondary()

Returns the last common secondary weight.

pack-priv long
getLastSecondaryCE()

Returns the last assigned secondary CE.

pack-priv long
getLastTertiaryCE()

Returns the last assigned tertiary CE.

pack-priv long
getPrimaryAfter(long p, int index, boolean isCompressible)

Returns the primary weight after p where index=findPrimary(p).

pack-priv long
getPrimaryBefore(long p, boolean isCompressible)

Returns the primary weight before p.

pack-priv int
getSecondaryAfter(int index, int s)

Returns the secondary weight after [p, s] where index=findPrimary(p) except use index=0 for p=0.

pack-priv int
getSecondaryBefore(long p, int s)

Returns the secondary weight before [p, s].

public int
getSecondaryBoundary()

Returns the boundary between secondary weights of primary CEs and those of secondary CEs.

pack-priv 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.

pack-priv int
getTertiaryBefore(long p, int s, int t)

Returns the tertiary weight before [p, s, t].

public int
getTertiaryBoundary()

Returns the boundary between tertiary weights of primary/secondary CEs and those of tertiary CEs.

private static boolean
pack-priv long
lastCEWithPrimaryBefore(long p)

Returns the last root CE with a primary weight before p.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

elementsback to summary
private long[] elements

Data structure: See ICU4C source/i18n/collationrootelements.h.

IX_COMMON_SEC_AND_TER_CEback to summary
pack-priv static final int IX_COMMON_SEC_AND_TER_CE

Must match Collation.COMMON_SEC_AND_TER_CE.

IX_COUNTback to summary
pack-priv static final int IX_COUNT

The current number of indexes. Currently the same as elements[IX_FIRST_TERTIARY_INDEX].

IX_FIRST_PRIMARY_INDEXback to summary
pack-priv static final int IX_FIRST_PRIMARY_INDEX

Index of the first CE with a non-zero primary weight.

IX_FIRST_SECONDARY_INDEXback to summary
pack-priv static final int IX_FIRST_SECONDARY_INDEX

Index of the first CE with a non-zero secondary weight.

IX_FIRST_TERTIARY_INDEXback to summary
public static final int IX_FIRST_TERTIARY_INDEX

Index of the first CE with a non-zero tertiary weight. Same as the start of the compact root elements table.

IX_SEC_TER_BOUNDARIESback to summary
pack-priv static final int IX_SEC_TER_BOUNDARIES

Secondary & 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]

PRIMARY_SENTINELback to summary
public static final long PRIMARY_SENTINEL

Higher than any root primary.

PRIMARY_STEP_MASKback to summary
public static final int PRIMARY_STEP_MASK

Mask for getting the primary range step value from a primary-range-end element.

SEC_TER_DELTA_FLAGback to summary
public static final int SEC_TER_DELTA_FLAG

Flag in a root element, set if the element contains secondary & tertiary weights, rather than a primary.

Constructor Detail

CollationRootElementsback to summary
public CollationRootElements(long[] rootElements)

Method Detail

findPback to summary
private int findP(long p)

Finds the largest index i where elements[i]<=p. Requires first primary<=p<0xffffff00 (PRIMARY_SENTINEL). Does not require that p is a root collator primary.

findPrimaryback to summary
pack-priv int findPrimary(long p)

Finds the index of the input primary. p must occur as a root primary, and must not be 0.

firstCEWithPrimaryAtLeastback to summary
pack-priv long firstCEWithPrimaryAtLeast(long p)

Returns the first root CE with a primary weight of at least p. Intended only for reordering group boundaries.

getFirstPrimaryback to summary
pack-priv long getFirstPrimary()

Returns the first assigned primary weight.

getFirstPrimaryCEback to summary
pack-priv long getFirstPrimaryCE()

Returns the first assigned primary CE.

getFirstSecondaryCEback to summary
pack-priv long getFirstSecondaryCE()

Returns the first assigned secondary CE.

getFirstSecTerForPrimaryback to summary
private long getFirstSecTerForPrimary(int index)

Returns the first secondary & tertiary weights for p where index=findPrimary(p)+1.

getFirstTertiaryCEback to summary
pack-priv long getFirstTertiaryCE()

Returns the first assigned tertiary CE.

getLastCommonSecondaryback to summary
public int getLastCommonSecondary()

Returns the last common secondary weight. This is the lower limit for secondaries of primary CEs.

getLastSecondaryCEback to summary
pack-priv long getLastSecondaryCE()

Returns the last assigned secondary CE.

getLastTertiaryCEback to summary
pack-priv long getLastTertiaryCE()

Returns the last assigned tertiary CE.

getPrimaryAfterback to summary
pack-priv 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.

getPrimaryBeforeback to summary
pack-priv long getPrimaryBefore(long p, boolean isCompressible)

Returns the primary weight before p. p must be greater than the first root primary.

getSecondaryAfterback to summary
pack-priv 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.

getSecondaryBeforeback to summary
pack-priv int getSecondaryBefore(long p, int s)

Returns the secondary weight before [p, s].

getSecondaryBoundaryback to summary
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.

getTertiaryAfterback to summary
pack-priv 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.

getTertiaryBeforeback to summary
pack-priv int getTertiaryBefore(long p, int s, int t)

Returns the tertiary weight before [p, s, t].

getTertiaryBoundaryback to summary
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.

isEndOfPrimaryRangeback to summary
private static boolean isEndOfPrimaryRange(long q)
lastCEWithPrimaryBeforeback to summary
pack-priv long lastCEWithPrimaryBefore(long p)

Returns the last root CE with a primary weight before p. Intended only for reordering group boundaries.