| gnu.regexp.CharIndexed
All known Subclasses: gnu.regexp.CharIndexedCharArray, gnu.regexp.CharIndexedString, gnu.regexp.CharIndexedStringBuffer, gnu.regexp.CharIndexedInputStream, gnu.regexp.CharIndexedReader,
CharIndexed | public interface CharIndexed (Code) | | Defines the interface used internally so that different types of source
text can be accessed in the same way. Built-in concrete classes provide
support for String, StringBuffer, InputStream and char[] types.
A class that is CharIndexed supports the notion of a cursor within a
block of text. The cursor must be able to be advanced via the move()
method. The charAt() method returns the character at the cursor position
plus a given offset.
author: Wes Biggs |
Field Summary | |
char | OUT_OF_BOUNDS Defines a constant (0xFFFF was somewhat arbitrarily chosen)
that can be returned by the charAt() function indicating that
the specified index is out of range. |
Method Summary | |
char | charAt(int index) Returns the character at the given offset past the current cursor
position in the input. | boolean | isValid() Returns true if the most recent move() operation placed the cursor
position at a valid position in the input. | boolean | move(int index) Shifts the input buffer by a given number of positions. |
OUT_OF_BOUNDS | char OUT_OF_BOUNDS(Code) | | Defines a constant (0xFFFF was somewhat arbitrarily chosen)
that can be returned by the charAt() function indicating that
the specified index is out of range.
|
charAt | char charAt(int index)(Code) | | Returns the character at the given offset past the current cursor
position in the input. The index of the current position is zero.
It is possible for this method to be called with a negative index.
This happens when using the '^' operator in multiline matching mode
or the '\b' or '\<' word boundary operators. In any case, the lower
bound is currently fixed at -2 (for '^' with a two-character newline).
Parameters: index - the offset position in the character field to examine the character at the specified index, or the OUT_OF_BOUNDScharacter defined by this interface. |
isValid | boolean isValid()(Code) | | Returns true if the most recent move() operation placed the cursor
position at a valid position in the input.
|
move | boolean move(int index)(Code) | | Shifts the input buffer by a given number of positions. Returns
true if the new cursor position is valid.
|
|
|