]> gcc.gnu.org Git - gcc.git/blame - libjava/java/text/CharacterIterator.java
SimpleDateFormat.java: Re-merged with Classpath.
[gcc.git] / libjava / java / text / CharacterIterator.java
CommitLineData
a1f4e5ed
TT
1/* CharacterIterator.java -- Iterate over a character range
2 Copyright (C) 1998, 2001 Free Software Foundation, Inc.
ee9dd372 3
a1f4e5ed 4This file is part of GNU Classpath.
ee9dd372 5
a1f4e5ed
TT
6GNU Classpath is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Classpath is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Classpath; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1902111-1307 USA.
20
21As a special exception, if you link this library with other files to
22produce an executable, this library does not by itself cause the
23resulting executable to be covered by the GNU General Public License.
24This exception does not however invalidate any other reasons why the
25executable file might be covered by the GNU General Public License. */
ee9dd372 26
ee9dd372
TT
27
28package java.text;
29
30/**
a1f4e5ed
TT
31 * This interface defines a mechanism for iterating over a range of
32 * characters. For a given range of text, a beginning and ending index,
33 * as well as a current index are defined. These values can be queried
34 * by the methods in this interface. Additionally, various methods allow
35 * the index to be set.
36 *
37 * @version 0.0
38 *
39 * @author Aaron M. Renn (arenn@urbanophile.com)
40 */
ee9dd372
TT
41public interface CharacterIterator extends Cloneable
42{
a1f4e5ed
TT
43
44 /*************************************************************************/
45
46 /*
47 * Static Variables
48 */
49
50 /**
51 * This is a special constant value that is returned when the beginning or
52 * end of the character range has been reached.
53 */
54 public static final char DONE = '\uFFFF';
55
56 /*************************************************************************/
57
58 /*
59 * Instance Methods
60 */
61
62 /**
63 * This method returns the character at the current index position
64 *
65 * @return The character at the current index position.
66 */
ee9dd372 67 public abstract char current ();
a1f4e5ed
TT
68
69 /*************************************************************************/
70
71 /**
72 * This method increments the current index and then returns the character
73 * at the new index value. If the index is already at <code>getEndIndex() - 1</code>,
74 * it will not be incremented.
75 *
76 * @return The character at the position of the incremented index value, or <code>DONE</code> if the index has reached getEndIndex() - 1
77 */
78 public abstract char next ();
79
80 /*************************************************************************/
81
82 /**
83 * This method decrements the current index and then returns the character
84 * at the new index value. If the index value is already at the beginning
85 * index, it will not be decremented.
86 *
87 * @return The character at the position of the decremented index value, or <code>DONE</code> if index was already equal to the beginning index value.
88 */
89 public abstract char previous ();
90
91 /*************************************************************************/
92
93 /**
94 * This method sets the index value to the beginning of the range and returns
95 * the character there.
96 *
97 * @return The character at the beginning of the range, or <code>DONE</code> if the range is empty.
98 */
ee9dd372 99 public abstract char first ();
a1f4e5ed
TT
100
101 /*************************************************************************/
102
103 /**
104 * This method sets the index value to <code>getEndIndex() - 1</code> and
105 * returns the character there. If the range is empty, then the index value
106 * will be set equal to the beginning index.
107 *
108 * @return The character at the end of the range, or <code>DONE</code> if the range is empty.
109 */
110 public abstract char last ();
111
112 /*************************************************************************/
113
114 /**
115 * This method returns the current value of the index.
116 *
117 * @return The current index value
118 */
119 public abstract int getIndex ();
120
121 /*************************************************************************/
122
123 /**
124 * This method sets the value of the index to the specified value, then
125 * returns the character at that position.
126 *
127 * @param index The new index value.
128 *
129 * @return The character at the new index value or <code>DONE</code> if the index value is equal to <code>getEndIndex</code>.
130 */
131 public abstract char setIndex (int index) throws IllegalArgumentException;
132
133 /*************************************************************************/
134
135 /**
136 * This method returns the character position of the first character in the
137 * range.
138 *
139 * @return The index of the first character in the range.
140 */
ee9dd372 141 public abstract int getBeginIndex ();
a1f4e5ed
TT
142
143 /*************************************************************************/
144
145 /**
146 * This method returns the character position of the end of the text range.
147 * This will actually be the index of the first character following the
148 * end of the range. In the event the text range is empty, this will be
149 * equal to the first character in the range.
150 *
151 * @return The index of the end of the range.
152 */
ee9dd372 153 public abstract int getEndIndex ();
ee9dd372 154
a1f4e5ed
TT
155 /*************************************************************************/
156
157 /**
158 * This method creates a copy of this <code>CharacterIterator</code>.
159 *
160 * @return A copy of this <code>CharacterIterator</code>.
161 */
162 public abstract Object clone ();
ee9dd372 163}
This page took 0.187044 seconds and 5 git commands to generate.