public class AutomatonMatcher extends Object implements MatchResult
RunAutomaton.newMatcher(java.lang.CharSequence)
,
RunAutomaton.newMatcher(java.lang.CharSequence, int, int)
Modifier and Type | Method and Description |
---|---|
int |
end()
Returns the offset after the last character matched.
|
int |
end(int group)
Returns the offset after the last character matched of the specified
capturing group.
|
boolean |
find()
Find the next matching subsequence of the input.
|
String |
group()
Returns the subsequence of the input found by the previous match.
|
String |
group(int group)
Returns the subsequence of the input found by the specified capturing
group during the previous match operation.
|
int |
groupCount()
Returns the number of capturing groups in the underlying automaton.
|
int |
start()
Returns the offset of the first character matched.
|
int |
start(int group)
Returns the offset of the first character matched of the specified
capturing group.
|
MatchResult |
toMatchResult()
Returns the current state of this
AutomatonMatcher as a
MatchResult . |
public int end() throws IllegalStateException
end
in interface MatchResult
IllegalStateException
- if there has not been a match attempt or
if the last attempt yielded no results.public int end(int group) throws IndexOutOfBoundsException, IllegalStateException
end
in interface MatchResult
group
- the desired capturing group.IllegalStateException
- if there has not been a match attempt or
if the last attempt yielded no results.IndexOutOfBoundsException
- if the specified capturing group does
not exist in the underlying automaton.public boolean find()
start
, end
, and
group
methods.true
if there is a matching subsequence.public String group() throws IllegalStateException
group
in interface MatchResult
IllegalStateException
- if there has not been a match attempt or
if the last attempt yielded no results.public String group(int group) throws IndexOutOfBoundsException, IllegalStateException
group
in interface MatchResult
group
- the desired capturing group.null
if the given group did match.IllegalStateException
- if there has not been a match attempt or
if the last attempt yielded no results.IndexOutOfBoundsException
- if the specified capturing group does
not exist in the underlying automaton.public int groupCount()
groupCount
in interface MatchResult
public int start() throws IllegalStateException
start
in interface MatchResult
IllegalStateException
- if there has not been a match attempt or
if the last attempt yielded no results.public int start(int group) throws IndexOutOfBoundsException, IllegalStateException
start
in interface MatchResult
group
- the desired capturing group.IllegalStateException
- if there has not been a match attempt or
if the last attempt yielded no results.IndexOutOfBoundsException
- if the specified capturing group does
not exist in the underlying automaton.public MatchResult toMatchResult()
AutomatonMatcher
as a
MatchResult
.
The result is unaffected by subsequent operations on this object.MatchResult
with the state of this
AutomatonMatcher
.Copyright © 2001-2017 Anders Møller.