<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.text.CollationElementIterator
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.text.html">This Package</a>  <a href="java.text.ChoiceFormat.html#_top_">Previous</a>  <a href="java.text.CollationKey.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.text.CollationElementIterator
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----java.text.CollationElementIterator
</pre>
<hr>
<dl>
  <dt> public final class <b>CollationElementIterator</b>
  <dt> extends <a href="java.lang.Object.html#_top_">Object</a>
</dl>
The <code>CollationElementIterator</code> class is used as an iterator
 to walk through each character of an international string. Use the iterator
 to return the ordering priority of the positioned character. The ordering
 priority of a character, which we refer to as a key, defines how a character
 is collated in the given collation object.
 <p>
 For example, consider the following in Spanish:
 <blockquote>
 <pre>
 "ca" -> the first key is key('c') and second key is key('a').
 "cha" -> the first key is key('ch') and second key is key('a').
 </pre>
 </blockquote>
 And in German,
 <blockquote>
 <pre>
 "b"-> the first key is key('a'), the second key is key('e'), and
 the third key is key('b').
 </pre>
 </blockquote>
 The key of a character is an integer composed of primary order(short),
 secondary order(byte), and tertiary order(byte). Java strictly defines
 the size and signedness of its primitive data types. Therefore, the static
 functions <code>primaryOrder</code>, <code>secondaryOrder</code>, and
 <code>tertiaryOrder</code> return <code>int</code>, <code>short</code>,
 and <code>short</code> respectively to ensure the correctness of the key
 value.
 <p>
 Example of the iterator usage,
 <blockquote>
 <pre>
 // get the first key of the string
 String str = "This is a test";
 CollationElementIterator c =
     new CollationElementIterator(str, 0, str.length(),
                                  Collator.getInstance());
 int primaryOrder = CollationElementIterator.primaryOrder(c->next());
 </pre>
 </blockquote>
 <p>
 <code>CollationElementIterator.next</code> returns the collation order
 of the next character. A collation order consists of primary order,
 secondary order and tertiary order. The data type of the collation
 order is <strong>int</strong>. The first 16 bits of a collation order
 is its primary order; the next 8 bits is the secondary order and the
 last 8 bits is the tertiary order.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.text.Collator.html#_top_">Collator</a>, <a href="java.text.RuleBasedCollator.html#_top_">RuleBasedCollator</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#NULLORDER"><b>NULLORDER</b></a>
  <dd>  Null order which indicates the end of string is reached by the
 cursor.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#next()"><b>next</b></a>()
  <dd>  Get the ordering priority of the next character in the string.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#primaryOrder(int)"><b>primaryOrder</b></a>(int)
  <dd>  Get the primary order of a collation order.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#reset()"><b>reset</b></a>()
  <dd>  Resets the cursor to the beginning of the string.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#secondaryOrder(int)"><b>secondaryOrder</b></a>(int)
  <dd>  Get the secondary order of a collation order.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#tertiaryOrder(int)"><b>tertiaryOrder</b></a>(int)
  <dd>  Get the tertiary order of a collation order.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="NULLORDER"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>NULLORDER</b>
<pre>
 public static final int NULLORDER
</pre>
<dl>
  <dd> Null order which indicates the end of string is reached by the
 cursor.<p>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="reset()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="reset"><b>reset</b></a>
<pre>
 public void reset()
</pre>
<dl>
  <dd> Resets the cursor to the beginning of the string.
<p>
</dl>
<a name="next()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="next"><b>next</b></a>
<pre>
 public int next()
</pre>
<dl>
  <dd> Get the ordering priority of the next character in the string.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the next character's ordering.  Returns NULLORDER if
 the end of string is reached.
  </dl></dd>
</dl>
<a name="primaryOrder(int)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="primaryOrder"><b>primaryOrder</b></a>
<pre>
 public static final int primaryOrder(int order)
</pre>
<dl>
  <dd> Get the primary order of a collation order.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> order - the collation order
    <dt> <b>Returns:</b>
    <dd> the primary order of a collation order.
  </dl></dd>
</dl>
<a name="secondaryOrder(int)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="secondaryOrder"><b>secondaryOrder</b></a>
<pre>
 public static final short secondaryOrder(int order)
</pre>
<dl>
  <dd> Get the secondary order of a collation order.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> order - the collation order
    <dt> <b>Returns:</b>
    <dd> the secondary order of a collation order.
  </dl></dd>
</dl>
<a name="tertiaryOrder(int)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="tertiaryOrder"><b>tertiaryOrder</b></a>
<pre>
 public static final short tertiaryOrder(int order)
</pre>
<dl>
  <dd> Get the tertiary order of a collation order.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> order - the collation order
    <dt> <b>Returns:</b>
    <dd> the tertiary order of a collation order.
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.text.html">This Package</a>  <a href="java.text.ChoiceFormat.html#_top_">Previous</a>  <a href="java.text.CollationKey.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
