public final class CollationElementIteratorICU
extends Object
Collation element iterator JNI wrapper.
Iterates over the collation elements of a data string.
The iterator supports both forward and backwards full iteration, ie if
backwards iteration is performed in the midst of a forward iteration, the
result is undefined.
To perform a backwards iteration in the midst of a forward iteration,
reset() has to be called.
This will shift the position to either the start or the last character in the
data string depending on whether next() is called or previous().
RuleBasedCollator coll = Collator.getInstance();
CollationElementIterator iterator = coll.getCollationElementIterator("abc");
int ce = 0;
while (ce != CollationElementIterator.NULLORDER) {
ce = iterator.next();
}
iterator.reset();
while (ce != CollationElementIterator.NULLORDER) {
ce = iterator.previous();
}
Reset the collation elements to their initial state.
This will move the 'cursor' to the beginning of the text.
next
publicintnext()
Get the ordering priority of the next collation element in the text.
A single character may contain more than one collation element.
Returns:
next collation elements ordering, or NULLORDER if the end of the
text is reached.
previous
publicintprevious()
Get the ordering priority of the previous collation element in the text.
A single character may contain more than one collation element.
Returns:
previous collation element ordering, or NULLORDER if the end of
the text is reached.
getMaxExpansion
publicintgetMaxExpansion(int order)
Get the maximum length of any expansion sequences that end with the
specified comparison order.
Parameters:
order - collation order returned by previous or next.
Returns:
maximum size of the expansion sequences ending with the collation
element or 1 if collation element does not occur at the end of
any expansion sequence