|
Jakarta-ORO 2.0.6 API: Class PatternMatcherInput
org.apache.oro.text.regex
|
Constructor Summary | |
PatternMatcherInput(char[] input)
Like calling: |
|
PatternMatcherInput(char[] input,
int begin,
int length)
Creates a PatternMatcherInput object, associating a region of a string (represented as a char[]) as input to be used for pattern matching by PatternMatcher objects. |
|
PatternMatcherInput(java.lang.String input)
Like calling |
|
PatternMatcherInput(java.lang.String input,
int begin,
int length)
Creates a PatternMatcherInput object, associating a region of a String as input to be used for pattern matching by PatternMatcher objects. |
Method Summary | |
char |
charAt(int offset)
Returns the character at a particular offset relative to the begin offset of the input. |
boolean |
endOfInput()
Returns whether or not the end of the input has been reached. |
int |
getBeginOffset()
|
char[] |
getBuffer()
Retrieves the char[] buffer to be used used as input by PatternMatcher implementations to look for matches. |
int |
getCurrentOffset()
|
int |
getEndOffset()
|
java.lang.Object |
getInput()
Retrieves the original input used to initialize the PatternMatcherInput instance. |
int |
getMatchBeginOffset()
Returns the offset marking the beginning of the match found by contains(). |
int |
getMatchEndOffset()
Returns the offset marking the end of the match found by contains(). |
int |
length()
|
java.lang.String |
match()
A convenience method returning the part of the input corresponding to the last match found by a call to a Perl5Matcher contains method. |
java.lang.String |
postMatch()
A convenience method returning the part of the input occurring after the last match found by a call to a Perl5Matcher contains method. |
java.lang.String |
preMatch()
A convenience method returning the part of the input occurring before the last match found by a call to a Perl5Matcher contains method. |
void |
setBeginOffset(int offset)
Sets the offset of the input that should be considered the start of the region to be considered as input by PatternMatcher methods. |
void |
setCurrentOffset(int offset)
Sets the offset of the input that should be considered the current offset where PatternMatcher methods should start looking for matches. |
void |
setEndOffset(int offset)
Sets the offset of the input that should be considered the end of the region to be considered as input by PatternMatcher methods. |
void |
setInput(char[] input)
This method is identical to calling: |
void |
setInput(char[] input,
int begin,
int length)
Associates a region of a string (represented as a char[]) as input to be used for pattern matching by PatternMatcher objects. |
void |
setInput(java.lang.String input)
This method is identical to calling: |
void |
setInput(java.lang.String input,
int begin,
int length)
Associates a region of a String as input to be used for pattern matching by PatternMatcher objects. |
void |
setMatchOffsets(int matchBeginOffset,
int matchEndOffset)
This method is intended for use by PatternMatcher implementations. |
java.lang.String |
substring(int beginOffset)
Returns a new string that is a substring of the PatternMatcherInput instance. |
java.lang.String |
substring(int beginOffset,
int endOffset)
Returns a new string that is a substring of the PatternMatcherInput instance. |
java.lang.String |
toString()
Returns the string representation of the input, where the input is considered to start from the begin offset and end at the end offset. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PatternMatcherInput(java.lang.String input, int begin, int length)
input
- The input to associate with the PatternMatcherInput.begin
- The offset into the char[] to use as the beginning of
the input.length
- The length of the reegion starting from the begin offset
to use as the input for pattern matching purposes.public PatternMatcherInput(java.lang.String input)
PatternMatcherInput(input, 0, input.length());
input
- The input to associate with the PatternMatcherInput.public PatternMatcherInput(char[] input, int begin, int length)
input
- The input to associate with the PatternMatcherInput.begin
- The offset into the char[] to use as the beginning of
the input.length
- The length of the reegion starting from the begin offset
to use as the input for pattern matching purposes.public PatternMatcherInput(char[] input)
PatternMatcherInput(input, 0, input.length);
input
- The input to associate with the PatternMatcherInput.Method Detail |
public int length()
public void setInput(java.lang.String input, int begin, int length)
input
- The input to associate with the PatternMatcherInput.begin
- The offset into the String to use as the beginning of
the input.length
- The length of the reegion starting from the begin offset
to use as the input for pattern matching purposes.public void setInput(java.lang.String input)
setInput(input, 0, input.length());
input
- The input to associate with the PatternMatcherInput.public void setInput(char[] input, int begin, int length)
input
- The input to associate with the PatternMatcherInput.begin
- The offset into the char[] to use as the beginning of
the input.length
- The length of the reegion starting from the begin offset
to use as the input for pattern matching purposes.public void setInput(char[] input)
setInput(input, 0, input.length);
input
- The input to associate with the PatternMatcherInput.public char charAt(int offset)
offset
- The offset at which to fetch a character (relative to
the beginning offset.ArrayIndexOutOfBoundsException
- If the offset does not occur
within the bounds of the input.public java.lang.String substring(int beginOffset, int endOffset)
beginOffset
- The offset relative to the begin offset of the
PatternMatcherInput at which to start the substring (inclusive).endOffset
- The offset relative to the begin offset of the
PatternMatcherInput at which to end the substring (exclusive).ArrayIndexOutOfBoundsException
- If one of the offsets does
not occur within the bounds of the input.public java.lang.String substring(int beginOffset)
beginOffset
- The offset relative to the begin offset of the
PatternMatcherInput at which to start the substring.ArrayIndexOutOfBoundsException
- If the offset does not occur
within the bounds of the input.public java.lang.Object getInput()
public char[] getBuffer()
public boolean endOfInput()
public int getBeginOffset()
public int getEndOffset()
public int getCurrentOffset()
public void setBeginOffset(int offset)
offset
- The offset to use as the beginning of the input.public void setEndOffset(int offset)
offset
- The offset to use as the end of the input.public void setCurrentOffset(int offset)
offset
- The offset to use as the current offset.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String preMatch()
contains
method.
public java.lang.String postMatch()
contains
method.
public java.lang.String match()
contains
method.
The method is not called getMatch() so as not to confuse it
with Perl5Matcher's getMatch() which returns a MatchResult instance
and also for consistency with preMatch() and postMatch().
public void setMatchOffsets(int matchBeginOffset, int matchEndOffset)
As a note, the preMatch(), postMatch(), and match() methods are provided as conveniences because PatternMatcherInput must store match offset information to completely preserve state for consecutive PatternMatcher contains() matches.
matchBeginOffset
- The begin offset of a match found by contains().matchEndOffset
- The end offset of a match found by contains().public int getMatchBeginOffset()
public int getMatchEndOffset()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |