Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 659
نمايش فراداده

CollationElementIteratorjava.text

Java 1.1

A CollationElementIterator object is returned by the getCollationElementIterator( ) method of the RuleBasedCollator object. The purpose of this class is to allow a program to iterate (with the next( ) method) through the characters of a string, returning ordering values for each of the collation keys in the string. Note that collation keys are not exactly the same as characters. In the traditional Spanish collation order, for example, the two-character sequence "ch" is treated as a single collation key that comes alphabetically between the letters "c" and "d." The value returned by the next( ) method is the collation order of the next collation key in the string. This numeric value can be directly compared to the value returned by next( ) for other CollationElementIterator objects. The value returned by next( ) can also be decomposed into primary, secondary, and tertiary ordering values with the static methods of this class. This class is used by RuleBasedCollator to implement its compare( ) method and to create CollationKey objects. Few applications ever need to use it directly.

public final class

CollationElementIterator { // No Constructor // Public Constants public static final int

NULLORDER ; =-1 // Public Class Methods public static final int

primaryOrder (int

order ); public static final short

secondaryOrder (int

order ); public static final short

tertiaryOrder (int

order ); // Public Instance Methods

1.2 public int

getMaxExpansion (int

order );

1.2 public int

getOffset ( ); public int

next ( );

1.2 public int

previous ( ); public void

reset ( );

1.2 public void

setOffset (int

newOffset );

1.2 public void

setText (String

source );

1.2 public void

setText (CharacterIterator

source ); }

Returned By

RuleBasedCollator.getCollationElementIterator( )