Java Doc for CollationElementIterator.java in  » 6.0-JDK-Modules » j2me » java » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.text.CollationElementIterator

CollationElementIterator
final public class CollationElementIterator (Code)
The CollationElementIterator 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.

For example, consider the following in Spanish:

 "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').
 
And in German,
 "\u00e4b"-> the first key is key('a'), the second key is key('e'), and
 the third key is key('b').
 
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 primaryOrder, secondaryOrder, and tertiaryOrder return int, short, and short respectively to ensure the correctness of the key value.

Example of the iterator usage,

 String testString = "This is a test";
 RuleBasedCollator ruleBasedCollator = (RuleBasedCollator)Collator.getInstance();
 CollationElementIterator collationElementIterator = ruleBasedCollator.getCollationElementIterator(testString);
 int primaryOrder = CollationElementIterator.primaryOrder(collationElementIterator.next());
 

CollationElementIterator.next 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 int. 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.
See Also:   Collator
See Also:   RuleBasedCollator
version:
   1.24 07/27/98
author:
   Helena Shih, Laura Werner, Richard Gillam



Field Summary
final public static  intNULLORDER
     Null order which indicates the end of string is reached by the cursor.
final static  intUNMAPPEDCHARVALUE
    

Constructor Summary
 CollationElementIterator(String sourceText, RuleBasedCollator owner)
     CollationElementIterator constructor.
 CollationElementIterator(CharacterIterator sourceText, RuleBasedCollator owner)
     CollationElementIterator constructor.

Method Summary
public  intgetMaxExpansion(int order)
     Return the maximum length of any expansion sequences that end with the specified comparison order.
Parameters:
  order - a collation order returned by previous or next.
public  intgetOffset()
     Returns the character offset in the original text corresponding to the next collation element.
final static  booleanisIgnorable(int order)
     Check if a comparison order is ignorable.
public  intnext()
     Get the next collation element in the string.
public  intprevious()
     Get the previous collation element in the string.
final public static  intprimaryOrder(int order)
     Return the primary component of a collation element.
public  voidreset()
     Resets the cursor to the beginning of the string.
final public static  shortsecondaryOrder(int order)
     Return the secondary component of a collation element.
public  voidsetOffset(int newOffset)
     Sets the iterator to point to the collation element corresponding to the specified character (the parameter is a CHARACTER offset in the original string, not an offset into its corresponding sequence of collation elements).
public  voidsetText(String source)
     Set a new string over which to iterate.
public  voidsetText(CharacterIterator source)
     Set a new string over which to iterate.
final  intstrengthOrder(int order)
     Get the comparison order in the desired strength.
final public static  shorttertiaryOrder(int order)
     Return the tertiary component of a collation element.

Field Detail
NULLORDER
final public static int NULLORDER(Code)
Null order which indicates the end of string is reached by the cursor.



UNMAPPEDCHARVALUE
final static int UNMAPPEDCHARVALUE(Code)




Constructor Detail
CollationElementIterator
CollationElementIterator(String sourceText, RuleBasedCollator owner)(Code)
CollationElementIterator constructor. This takes the source string and the collation object. The cursor will walk thru the source string based on the predefined collation rules. If the source string is empty, NULLORDER will be returned on the calls to next().
Parameters:
  sourceText - the source string.
Parameters:
  order - the collation object.



CollationElementIterator
CollationElementIterator(CharacterIterator sourceText, RuleBasedCollator owner)(Code)
CollationElementIterator constructor. This takes the source string and the collation object. The cursor will walk thru the source string based on the predefined collation rules. If the source string is empty, NULLORDER will be returned on the calls to next().
Parameters:
  sourceText - the source string.
Parameters:
  order - the collation object.




Method Detail
getMaxExpansion
public int getMaxExpansion(int order)(Code)
Return the maximum length of any expansion sequences that end with the specified comparison order.
Parameters:
  order - a collation order returned by previous or next. the maximum length of any expansion sequences endingwith the specified order.
since:
   1.2



getOffset
public int getOffset()(Code)
Returns the character offset in the original text corresponding to the next collation element. (That is, getOffset() returns the position in the text corresponding to the collation element that will be returned by the next call to next().) This value will always be the index of the FIRST character corresponding to the collation element (a contracting character sequence is when two or more characters all correspond to the same collation element). This means if you do setOffset(x) followed immediately by getOffset(), getOffset() won't necessarily return x. The character offset in the original text corresponding to the collationelement that will be returned by the next call to next().
since:
   1.2



isIgnorable
final static boolean isIgnorable(int order)(Code)
Check if a comparison order is ignorable. true if a character is ignorable, false otherwise.



next
public int next()(Code)
Get the next collation element in the string.

This iterator iterates over a sequence of collation elements that were built from the string. Because there isn't necessarily a one-to-one mapping from characters to collation elements, this doesn't mean the same thing as "return the collation element [or ordering priority] of the next character in the string".

This function returns the collation element that the iterator is currently pointing to and then updates the internal pointer to point to the next element. previous() updates the pointer first and then returns the element. This means that when you change direction while iterating (i.e., call next() and then call previous(), or call previous() and then call next()), you'll get back the same element twice.




previous
public int previous()(Code)
Get the previous collation element in the string.

This iterator iterates over a sequence of collation elements that were built from the string. Because there isn't necessarily a one-to-one mapping from characters to collation elements, this doesn't mean the same thing as "return the collation element [or ordering priority] of the previous character in the string".

This function updates the iterator's internal pointer to point to the collation element preceding the one it's currently pointing to and then returns that element, while next() returns the current element and then updates the pointer. This means that when you change direction while iterating (i.e., call next() and then call previous(), or call previous() and then call next()), you'll get back the same element twice.


since:
   1.2



primaryOrder
final public static int primaryOrder(int order)(Code)
Return the primary component of a collation element.
Parameters:
  order - the collation element the element's primary component



reset
public void reset()(Code)
Resets the cursor to the beginning of the string. The next call to next() will return the first collation element in the string.



secondaryOrder
final public static short secondaryOrder(int order)(Code)
Return the secondary component of a collation element.
Parameters:
  order - the collation element the element's secondary component



setOffset
public void setOffset(int newOffset)(Code)
Sets the iterator to point to the collation element corresponding to the specified character (the parameter is a CHARACTER offset in the original string, not an offset into its corresponding sequence of collation elements). The value returned by the next call to next() will be the collation element corresponding to the specified position in the text. If that position is in the middle of a contracting character sequence, the result of the next call to next() is the collation element for that sequence. This means that getOffset() is not guaranteed to return the same value as was passed to a preceding call to setOffset().
Parameters:
  newOffset - The new character offset into the original text.
since:
   1.2



setText
public void setText(String source)(Code)
Set a new string over which to iterate.
Parameters:
  source - the new source text
since:
   1.2



setText
public void setText(CharacterIterator source)(Code)
Set a new string over which to iterate.
Parameters:
  source - the new source text.
since:
   1.2



strengthOrder
final int strengthOrder(int order)(Code)
Get the comparison order in the desired strength. Ignore the other differences.
Parameters:
  order - The order value



tertiaryOrder
final public static short tertiaryOrder(int order)(Code)
Return the tertiary component of a collation element.
Parameters:
  order - the collation element the element's tertiary component



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.