|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.text.CollationElementIterator
public final class CollationElementIterator
CollationElementIterator is created by a
RuleBasedCollator to iterate through a string. The return
result of each iteration is a 32-bit collation element that defines the
ordering priority of the next character or sequence of characters in the
source string.
For illustration, consider the following in Spanish:
"ca" -> the first collation element is collation_element('c') and second
collation element is collation_element('a').
Since "ch" in Spanish sorts as one entity, the below example returns one
collation element for the two characters 'c' and 'h'
"cha" -> the first collation element is collation_element('ch') and second
collation element is collation_element('a').
And in German,
Since the character '\u0086' is a composed character of 'a' and 'e', the iterator
returns two collation elements for the single character '\u0086'
"\u0086b" -> the first
collation element is collation_element('a'), the second collation element is
collation_element('e'), and the third collation element is
collation_element('b').
| Field Summary | |
|---|---|
static int |
NULLORDER
This constant is returned by the iterator in the methods next() and previous() when the end or the
beginning of the source string has been reached, and there are no more
valid collation elements to return. |
| Constructor Summary | |
|---|---|
CollationElementIterator(com.ibm.icu4jni.text.CollationElementIterator iterator)
|
|
| Method Summary | |
|---|---|
int |
getMaxExpansion(int order)
Obtains the maximum length of any expansion sequence that ends with the specified collation element. |
int |
getOffset()
Obtains the character offset in the source string corresponding to the next collation element. |
int |
next()
Obtains the next collation element in the source string. |
int |
previous()
Obtains the previous collation element in the source string. |
static int |
primaryOrder(int order)
Obtains the primary order of the specified collation element, i.e. |
void |
reset()
Repositions the cursor to point at the first element of the current string. |
static short |
secondaryOrder(int order)
Obtains the secondary order of the specified collation element, i.e. |
void |
setOffset(int newOffset)
Points the iterator at the collation element associated with the character in the source string which is found at the supplied offset. |
void |
setText(CharacterIterator source)
Sets a new source string iterator for iteration, and reset the offset to the beginning of the text. |
void |
setText(String source)
Sets a new source string for iteration, and reset the offset to the beginning of the text. |
static short |
tertiaryOrder(int order)
Obtains the tertiary order of the specified collation element, i.e. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NULLORDER
next() and previous() when the end or the
beginning of the source string has been reached, and there are no more
valid collation elements to return.
| Constructor Detail |
|---|
CollationElementIterator(com.ibm.icu4jni.text.CollationElementIterator iterator)
| Method Detail |
|---|
public int getMaxExpansion(int order)
1.
order - a collation element that has been previously obtained from a
call to either the next() or previous()
method.
public int getOffset()
next()
method.public int next()
NULLORDER if the end
of the iteration has been reached.public int previous()
NULLORDER when
the start of the iteration has been reached.public static final int primaryOrder(int order)
order -
public void reset()
next() or previous()
will return the first and last collation element in the string,
respectively.
If the RuleBasedCollator used by this iterator has had its
attributes changed, calling reset() will reinitialize the
iterator to use the new attributes.
public static final short secondaryOrder(int order)
order -
public void setOffset(int newOffset)
next() method
will return this collation element.
If newOffset corresponds to a character which is part of a
sequence that maps to a single collation element the iterator is adjusted
to the start of that sequence. As a result of this, any subsequent call
made to getOffset() may not return the same value set by
this method.
If the decomposition mode is on, and offset is in the middle of a decomposable range of source text, the iterator may not return a correct result for the next forwards or backwards iteration. The user must ensure that the offset is not in the middle of a decomposable range.
newOffset - the character offset into the original source string to set.
Note that this is not an offset into the corresponding
sequence of collation elements.public void setText(CharacterIterator source)
source - the new source string iterator for iteration.public void setText(String source)
source - the new source string for iterationpublic static final short tertiaryOrder(int order)
order -
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||