Package com.ibm.icu.impl.coll
Class CollationDataBuilder.DataBuilderCollationIterator
java.lang.Object
com.ibm.icu.impl.coll.CollationIterator
com.ibm.icu.impl.coll.CollationDataBuilder.DataBuilderCollationIterator
- Enclosing class:
CollationDataBuilder
private static final class CollationDataBuilder.DataBuilderCollationIterator
extends CollationIterator
Build-time collation element and character iterator.
Uses the runtime CollationIterator for fetching CEs for a string
but reads from the builder's unfinished data structures.
In particular, this class reads from the unfinished trie
and has to avoid CollationIterator.nextCE() and redirect other
calls to data.getCE32() and data.getCE32FromSupplementary().
We do this so that we need not implement the collation algorithm
again for the builder and make it behave exactly like the runtime code.
That would be more difficult to test and maintain than this indirection.
Some CE32 tags (for example, the DIGIT_TAG) do not occur in the builder data,
so the data accesses from those code paths need not be modified.
This class iterates directly over whole code points
so that the CollationIterator does not need the finished trie
for handling the LEAD_SURROGATE_TAG.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CollationDataBuilder
protected final CollationData
protected final int[]
protected int
protected CharSequence
Fields inherited from class com.ibm.icu.impl.coll.CollationIterator
data, NO_CP_AND_CE32, trie
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
backwardNumCodePoints
(int num) (package private) int
fetchCEs
(CharSequence str, int start, long[] ces, int cesLength) protected void
forwardNumCodePoints
(int num) protected int
getCE32FromBuilderData
(int ce32) protected int
getDataCE32
(int c) Returns the CE32 from the data trie.int
int
Returns the next code point (with post-increment).int
Returns the previous code point (with pre-decrement).void
resetToOffset
(int newOffset) Resets the iterator state and sets the position to the specified offset.Methods inherited from class com.ibm.icu.impl.coll.CollationIterator
appendCEsFromCE32, clearCEs, clearCEsIfNoneRemaining, equals, fetchCEs, forbidSurrogateCodePoints, getCE, getCEs, getCEsLength, handleGetTrailSurrogate, handleNextCE32, hashCode, isLeadSurrogate, isTrailSurrogate, makeCodePointAndCE32Pair, nextCE, previousCE, reset, reset, setCurrentCE
-
Field Details
-
builder
-
builderData
-
jamoCE32s
protected final int[] jamoCE32s -
s
-
pos
protected int pos
-
-
Constructor Details
-
DataBuilderCollationIterator
DataBuilderCollationIterator(CollationDataBuilder b, CollationData newData)
-
-
Method Details
-
fetchCEs
-
resetToOffset
public void resetToOffset(int newOffset) Description copied from class:CollationIterator
Resets the iterator state and sets the position to the specified offset. Subclasses must implement, and must call the parent class method, or CollationIterator.reset().- Specified by:
resetToOffset
in classCollationIterator
-
getOffset
public int getOffset()- Specified by:
getOffset
in classCollationIterator
-
nextCodePoint
public int nextCodePoint()Description copied from class:CollationIterator
Returns the next code point (with post-increment). Public for identical-level comparison and for testing.- Specified by:
nextCodePoint
in classCollationIterator
-
previousCodePoint
public int previousCodePoint()Description copied from class:CollationIterator
Returns the previous code point (with pre-decrement). Public for identical-level comparison and for testing.- Specified by:
previousCodePoint
in classCollationIterator
-
forwardNumCodePoints
protected void forwardNumCodePoints(int num) - Specified by:
forwardNumCodePoints
in classCollationIterator
-
backwardNumCodePoints
protected void backwardNumCodePoints(int num) - Specified by:
backwardNumCodePoints
in classCollationIterator
-
getDataCE32
protected int getDataCE32(int c) Description copied from class:CollationIterator
Returns the CE32 from the data trie. Normally the same as data.getCE32(), but overridden in the builder. Call this only when the faster data.getCE32() cannot be used.- Overrides:
getDataCE32
in classCollationIterator
-
getCE32FromBuilderData
protected int getCE32FromBuilderData(int ce32) - Overrides:
getCE32FromBuilderData
in classCollationIterator
-