gnu.regexp
Class CharIndexedCharSequence

java.lang.Object
gnu.regexp.CharIndexedCharSequence
- All Implemented Interfaces:
- CharIndexed, java.io.Serializable
- Direct Known Subclasses:
- CharIndexedCharArray, CharIndexedString, CharIndexedStringBuffer
- class CharIndexedCharSequence
- extends java.lang.Object
- implements CharIndexed, java.io.Serializable
|
Method Summary |
char |
charAt(int index)
Returns the character at the given offset past the current cursor
position in the input. |
int |
getAnchor()
Returns the anchor. |
REMatch |
getLastMatch()
Returns the REMatch last found on this input. |
boolean |
isValid()
Returns true if the most recent move() operation placed the cursor
position at a valid position in the input. |
int |
length()
Returns the effective length of this CharIndexed |
CharIndexed |
lookBehind(int index,
int length)
Returns another CharIndexed containing length characters to the left
of the given index. |
boolean |
move(int index)
Shifts the input buffer by a given number of positions. |
void |
setAnchor(int anchor)
Sets the anchor. |
void |
setLastMatch(REMatch match)
Sets the REMatch last found on this input. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
s
private java.lang.CharSequence s
anchor
private int anchor
len
private int len
lastMatch
private REMatch lastMatch
CharIndexedCharSequence
CharIndexedCharSequence(java.lang.CharSequence s,
int index)
charAt
public char charAt(int index)
- Description copied from interface:
CharIndexed
- 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).
- Specified by:
charAt in interface CharIndexed
isValid
public boolean isValid()
- Description copied from interface:
CharIndexed
- Returns true if the most recent move() operation placed the cursor
position at a valid position in the input.
- Specified by:
isValid in interface CharIndexed
move
public boolean move(int index)
- Description copied from interface:
CharIndexed
- Shifts the input buffer by a given number of positions. Returns
true if the new cursor position is valid.
- Specified by:
move in interface CharIndexed
lookBehind
public CharIndexed lookBehind(int index,
int length)
- Description copied from interface:
CharIndexed
- Returns another CharIndexed containing length characters to the left
of the given index. The given length is an expected maximum and
the returned CharIndexed may not necessarily contain so many characters.
- Specified by:
lookBehind in interface CharIndexed
length
public int length()
- Description copied from interface:
CharIndexed
- Returns the effective length of this CharIndexed
- Specified by:
length in interface CharIndexed
setLastMatch
public void setLastMatch(REMatch match)
- Description copied from interface:
CharIndexed
- Sets the REMatch last found on this input.
- Specified by:
setLastMatch in interface CharIndexed
getLastMatch
public REMatch getLastMatch()
- Description copied from interface:
CharIndexed
- Returns the REMatch last found on this input.
- Specified by:
getLastMatch in interface CharIndexed
getAnchor
public int getAnchor()
- Description copied from interface:
CharIndexed
- Returns the anchor.
- Specified by:
getAnchor in interface CharIndexed
setAnchor
public void setAnchor(int anchor)
- Description copied from interface:
CharIndexed
- Sets the anchor.
- Specified by:
setAnchor in interface CharIndexed