com.ibm.icu4jni.text
Class CollationElementIterator

java.lang.Object
  |
  +--com.ibm.icu4jni.text.CollationElementIterator

public final class CollationElementIterator
extends java.lang.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();
   }
 

Status:
Stable ICU 2.4.

Field Summary
static int NULLORDER
           
 
Method Summary
protected  void finalize()
          Garbage collection.
 int getMaxExpansion(int order)
          Get the maximum length of any expansion sequences that end with the specified comparison order.
 int getOffset()
          Get the offset of the current source character.
 int next()
          Get the ordering priority of the next collation element in the text.
 int previous()
          Get the ordering priority of the previous collation element in the text.
static int primaryOrder(int order)
          Gets the primary order of a collation order.
 void reset()
          Reset the collation elements to their initial state.
static int secondaryOrder(int order)
          Gets the secondary order of a collation order.
 void setOffset(int offset)
          Set the offset of the current source character.
 void setText(java.lang.String source)
          Set the text containing the collation elements.
static int tertiaryOrder(int order)
          Gets the tertiary order of a collation order.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULLORDER

public static final int NULLORDER
See Also:
Constant Field Values
Status:
Stable ICU 2.4.
Method Detail

reset

public void reset()
Reset the collation elements to their initial state. This will move the 'cursor' to the beginning of the text.

Status:
Stable ICU 2.4.

next

public int next()
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.
Status:
Stable ICU 2.4.

previous

public int previous()
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.
Status:
Stable ICU 2.4.

getMaxExpansion

public int getMaxExpansion(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
Status:
Stable ICU 2.4.

setText

public void setText(java.lang.String source)
Set the text containing the collation elements.

Parameters:
source - text containing the collation elements.
Status:
Stable ICU 2.4.

getOffset

public int getOffset()
Get the offset of the current source character. This is an offset into the text of the character containing the current collation elements.

Returns:
offset of the current source character.
Status:
Stable ICU 2.4.

setOffset

public void setOffset(int offset)
Set the offset of the current source character. This is an offset into the text of the character to be processed.

Parameters:
offset - The desired character offset.
Status:
Stable ICU 2.4.

primaryOrder

public static int primaryOrder(int order)
Gets the primary order of a collation order.

Parameters:
order - the collation order
Returns:
the primary order of a collation order.
Status:
Stable ICU 2.4.

secondaryOrder

public static int secondaryOrder(int order)
Gets the secondary order of a collation order.

Parameters:
order - the collation order
Returns:
the secondary order of a collation order.
Status:
Stable ICU 2.4.

tertiaryOrder

public static int tertiaryOrder(int order)
Gets the tertiary order of a collation order.

Parameters:
order - the collation order
Returns:
the tertiary order of a collation order.
Status:
Stable ICU 2.4.

finalize

protected void finalize()
Garbage collection. Close C collator and reclaim memory.

Overrides:
finalize in class java.lang.Object
Status:
Stable ICU 2.4.