45 |
* by the methods in this interface. Additionally, various methods allow |
* by the methods in this interface. Additionally, various methods allow |
46 |
* the index to be set. |
* the index to be set. |
47 |
* |
* |
|
* @version 0.0 |
|
|
* |
|
48 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
49 |
*/ |
*/ |
50 |
public interface CharacterIterator extends Cloneable |
public interface CharacterIterator extends Cloneable |
51 |
{ |
{ |
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/* |
|
|
* Static Variables |
|
|
*/ |
|
|
|
|
52 |
/** |
/** |
53 |
* This is a special constant value that is returned when the beginning or |
* This is a special constant value that is returned when the beginning or |
54 |
* end of the character range has been reached. |
* end of the character range has been reached. |
55 |
*/ |
*/ |
56 |
char DONE = '\uFFFF'; |
char DONE = '\uFFFF'; |
57 |
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/* |
|
|
* Instance Methods |
|
|
*/ |
|
|
|
|
58 |
/** |
/** |
59 |
* This method returns the character at the current index position |
* This method returns the character at the current index position |
60 |
* |
* |
62 |
*/ |
*/ |
63 |
char current(); |
char current(); |
64 |
|
|
|
/*************************************************************************/ |
|
|
|
|
65 |
/** |
/** |
66 |
* This method increments the current index and then returns the character |
* This method increments the current index and then returns the character |
67 |
* at the new index value. If the index is already at <code>getEndIndex() - 1</code>, |
* at the new index value. If the index is already at <code>getEndIndex() - 1</code>, |
68 |
* it will not be incremented. |
* it will not be incremented. |
69 |
* |
* |
70 |
* @return The character at the position of the incremented index value, or <code>DONE</code> if the index has reached getEndIndex() - 1 |
* @return The character at the position of the incremented index value, |
71 |
|
* or <code>DONE</code> if the index has reached getEndIndex() - 1 |
72 |
*/ |
*/ |
73 |
char next(); |
char next(); |
74 |
|
|
|
/*************************************************************************/ |
|
|
|
|
75 |
/** |
/** |
76 |
* This method decrements the current index and then returns the character |
* This method decrements the current index and then returns the character |
77 |
* at the new index value. If the index value is already at the beginning |
* at the new index value. If the index value is already at the beginning |
78 |
* index, it will not be decremented. |
* index, it will not be decremented. |
79 |
* |
* |
80 |
* @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. |
* @return The character at the position of the decremented index value, |
81 |
|
* or <code>DONE</code> if index was already equal to the beginning index value. |
82 |
*/ |
*/ |
83 |
char previous(); |
char previous(); |
84 |
|
|
|
/*************************************************************************/ |
|
|
|
|
85 |
/** |
/** |
86 |
* This method sets the index value to the beginning of the range and returns |
* This method sets the index value to the beginning of the range and returns |
87 |
* the character there. |
* the character there. |
90 |
*/ |
*/ |
91 |
char first(); |
char first(); |
92 |
|
|
|
/*************************************************************************/ |
|
|
|
|
93 |
/** |
/** |
94 |
* This method sets the index value to <code>getEndIndex() - 1</code> and |
* This method sets the index value to <code>getEndIndex() - 1</code> and |
95 |
* returns the character there. If the range is empty, then the index value |
* returns the character there. If the range is empty, then the index value |
99 |
*/ |
*/ |
100 |
char last(); |
char last(); |
101 |
|
|
|
/*************************************************************************/ |
|
|
|
|
102 |
/** |
/** |
103 |
* This method returns the current value of the index. |
* This method returns the current value of the index. |
104 |
* |
* |
106 |
*/ |
*/ |
107 |
int getIndex(); |
int getIndex(); |
108 |
|
|
|
/*************************************************************************/ |
|
|
|
|
109 |
/** |
/** |
110 |
* This method sets the value of the index to the specified value, then |
* This method sets the value of the index to the specified value, then |
111 |
* returns the character at that position. |
* returns the character at that position. |
116 |
*/ |
*/ |
117 |
char setIndex (int index) throws IllegalArgumentException; |
char setIndex (int index) throws IllegalArgumentException; |
118 |
|
|
|
/*************************************************************************/ |
|
|
|
|
119 |
/** |
/** |
120 |
* This method returns the character position of the first character in the |
* This method returns the character position of the first character in the |
121 |
* range. |
* range. |
124 |
*/ |
*/ |
125 |
int getBeginIndex(); |
int getBeginIndex(); |
126 |
|
|
|
/*************************************************************************/ |
|
|
|
|
127 |
/** |
/** |
128 |
* This method returns the character position of the end of the text range. |
* This method returns the character position of the end of the text range. |
129 |
* This will actually be the index of the first character following the |
* This will actually be the index of the first character following the |
134 |
*/ |
*/ |
135 |
int getEndIndex(); |
int getEndIndex(); |
136 |
|
|
|
/*************************************************************************/ |
|
|
|
|
137 |
/** |
/** |
138 |
* This method creates a copy of this <code>CharacterIterator</code>. |
* This method creates a copy of this <code>CharacterIterator</code>. |
139 |
* |
* |