Source Code Cross Referenced for CharacterIterator.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 Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * 
003:         * @(#)CharacterIterator.java	1.22 06/10/10
004:         * 
005:         * Portions Copyright  2000-2006 Sun Microsystems, Inc. All Rights
006:         * Reserved.  Use is subject to license terms.
007:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
008:         * 
009:         * This program is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU General Public License version
011:         * 2 only, as published by the Free Software Foundation.
012:         * 
013:         * This program is distributed in the hope that it will be useful, but
014:         * WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016:         * General Public License version 2 for more details (a copy is
017:         * included at /legal/license.txt).
018:         * 
019:         * You should have received a copy of the GNU General Public License
020:         * version 2 along with this work; if not, write to the Free Software
021:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
022:         * 02110-1301 USA
023:         * 
024:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
025:         * Clara, CA 95054 or visit www.sun.com if you need additional
026:         * information or have any questions.
027:         */
028:
029:        /*
030:         * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
031:         * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
032:         *
033:         * The original version of this source code and documentation
034:         * is copyrighted and owned by Taligent, Inc., a wholly-owned
035:         * subsidiary of IBM. These materials are provided under terms
036:         * of a License Agreement between Taligent and Sun. This technology
037:         * is protected by multiple US and International patents.
038:         *
039:         * This notice and attribution to Taligent may not be removed.
040:         * Taligent is a registered trademark of Taligent, Inc.
041:         *
042:         */
043:
044:        package java.text;
045:
046:        /**
047:         * This interface defines a protocol for bidirectional iteration over text.
048:         * The iterator iterates over a bounded sequence of characters.  Characters
049:         * are indexed with values beginning with the value returned by getBeginIndex() and
050:         * continuing through the value returned by getEndIndex()-1.
051:         * <p>
052:         * Iterators maintain a current character index, whose valid range is from
053:         * getBeginIndex() to getEndIndex(); the value getEndIndex() is included to allow
054:         * handling of zero-length text ranges and for historical reasons.
055:         * The current index can be retrieved by calling getIndex() and set directly
056:         * by calling setIndex(), first(), and last().
057:         * <p>
058:         * The methods previous() and next() are used for iteration. They return DONE if
059:         * they would move outside the range from getBeginIndex() to getEndIndex() -1,
060:         * signaling that the iterator has reached the end of the sequence. DONE is
061:         * also returned by other methods to indicate that the current index is
062:         * outside this range.
063:         *
064:         * <P>Examples:<P>
065:         *
066:         * Traverse the text from start to finish
067:         * <pre>
068:         * public void traverseForward(CharacterIterator iter) {
069:         *     for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
070:         *         processChar(c);
071:         *     }
072:         * }
073:         * </pre>
074:         *
075:         * Traverse the text backwards, from end to start
076:         * <pre>
077:         * public void traverseBackward(CharacterIterator iter) {
078:         *     for(char c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) {
079:         *         processChar(c);
080:         *     }
081:         * }
082:         * </pre>
083:         *
084:         * Traverse both forward and backward from a given position in the text.
085:         * Calls to notBoundary() in this example represents some
086:         * additional stopping criteria.
087:         * <pre>
088:         * public void traverseOut(CharacterIterator iter, int pos) {
089:         *     for (char c = iter.setIndex(pos);
090:         *              c != CharacterIterator.DONE && notBoundary(c);
091:         *              c = iter.next()) {
092:         *     }
093:         *     int end = iter.getIndex();
094:         *     for (char c = iter.setIndex(pos);
095:         *             c != CharacterIterator.DONE && notBoundary(c);
096:         *             c = iter.previous()) {
097:         *     }
098:         *     int start = iter.getIndex();
099:         *     processSection(start, end);
100:         * }
101:         * </pre>
102:         *
103:         * @see StringCharacterIterator
104:         * @see AttributedCharacterIterator
105:         */
106:
107:        public interface CharacterIterator extends Cloneable {
108:
109:            /**
110:             * Constant that is returned when the iterator has reached either the end
111:             * or the beginning of the text. The value is '\\uFFFF', the "not a
112:             * character" value which should not occur in any valid Unicode string.
113:             */
114:            public static final char DONE = '\uFFFF';
115:
116:            /**
117:             * Sets the position to getBeginIndex() and returns the character at that
118:             * position.
119:             * @return the first character in the text, or DONE if the text is empty
120:             * @see #getBeginIndex()
121:             */
122:            public char first();
123:
124:            /**
125:             * Sets the position to getEndIndex()-1 (getEndIndex() if the text is empty)
126:             * and returns the character at that position.
127:             * @return the last character in the text, or DONE if the text is empty
128:             * @see #getEndIndex()
129:             */
130:            public char last();
131:
132:            /**
133:             * Gets the character at the current position (as returned by getIndex()).
134:             * @return the character at the current position or DONE if the current
135:             * position is off the end of the text.
136:             * @see #getIndex()
137:             */
138:            public char current();
139:
140:            /**
141:             * Increments the iterator's index by one and returns the character
142:             * at the new index.  If the resulting index is greater or equal
143:             * to getEndIndex(), the current index is reset to getEndIndex() and
144:             * a value of DONE is returned.
145:             * @return the character at the new position or DONE if the new
146:             * position is off the end of the text range.
147:             */
148:            public char next();
149:
150:            /**
151:             * Decrements the iterator's index by one and returns the character
152:             * at the new index. If the current index is getBeginIndex(), the index
153:             * remains at getBeginIndex() and a value of DONE is returned.
154:             * @return the character at the new position or DONE if the current
155:             * position is equal to getBeginIndex().
156:             */
157:            public char previous();
158:
159:            /**
160:             * Sets the position to the specified position in the text and returns that
161:             * character.
162:             * @param position the position within the text.  Valid values range from
163:             * getBeginIndex() to getEndIndex().  An IllegalArgumentException is thrown
164:             * if an invalid value is supplied.
165:             * @return the character at the specified position or DONE if the specified position is equal to getEndIndex()
166:             */
167:            public char setIndex(int position);
168:
169:            /**
170:             * Returns the start index of the text.
171:             * @return the index at which the text begins.
172:             */
173:            public int getBeginIndex();
174:
175:            /**
176:             * Returns the end index of the text.  This index is the index of the first
177:             * character following the end of the text.
178:             * @return the index after the last character in the text
179:             */
180:            public int getEndIndex();
181:
182:            /**
183:             * Returns the current index.
184:             * @return the current index.
185:             */
186:            public int getIndex();
187:
188:            /**
189:             * Create a copy of this iterator
190:             * @return A copy of this
191:             */
192:            public Object clone();
193:
194:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.