public interface SequenceMatchResult<T> extends java.util.regex.MatchResult, HasInterval<java.lang.Integer>
MatchResult
except it is for sequences
over arbitrary types T instead of just characters.
This interface contains query methods used to determine the
results of a match against a regular expression against an sequence.
The match boundaries, groups and group boundaries can be seen
but not modified through a SequenceMatchResult
.SequenceMatcher
Modifier and Type | Interface and Description |
---|---|
static class |
SequenceMatchResult.GroupToIntervalFunc<MR extends java.util.regex.MatchResult> |
static class |
SequenceMatchResult.MatchedGroupInfo<T>
Information about a matched group.
|
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<? super java.util.regex.MatchResult> |
DEFAULT_COMPARATOR |
static int |
GROUP_AFTER_MATCH |
static int |
GROUP_BEFORE_MATCH |
static java.util.Comparator<java.util.regex.MatchResult> |
LENGTH_COMPARATOR
Compares two match results.
|
static java.util.Comparator<java.util.regex.MatchResult> |
OFFSET_COMPARATOR |
static java.util.Comparator<java.util.regex.MatchResult> |
ORDER_COMPARATOR |
static java.util.Comparator<java.util.regex.MatchResult> |
PRIORITY_COMPARATOR |
static java.util.Comparator<java.util.regex.MatchResult> |
PRIORITY_SCORE_LENGTH_ORDER_OFFSET_COMPARATOR
Compares two match results.
|
static java.util.Comparator<java.util.regex.MatchResult> |
SCORE_COMPARATOR |
static java.util.function.ToDoubleFunction<java.util.regex.MatchResult> |
SCORER |
static SequenceMatchResult.GroupToIntervalFunc |
TO_INTERVAL |
CONTAINS_FIRST_ENDPOINTS_COMPARATOR, ENDPOINTS_COMPARATOR, LENGTH_ENDPOINTS_COMPARATOR, LENGTH_GT_COMPARATOR, LENGTH_LT_COMPARATOR, NESTED_FIRST_ENDPOINTS_COMPARATOR
Modifier and Type | Method and Description |
---|---|
java.util.List<? extends T> |
elements()
Returns the original sequence the match was performed on.
|
int |
end(java.lang.String groupVar)
Returns the index of the next element after the subsequence captured by the given group
during this match.
|
int |
getOrder() |
java.lang.String |
group(java.lang.String groupVar)
Returns the
String representing the matched group. |
SequenceMatchResult.MatchedGroupInfo<T> |
groupInfo() |
SequenceMatchResult.MatchedGroupInfo<T> |
groupInfo(int group) |
SequenceMatchResult.MatchedGroupInfo<T> |
groupInfo(java.lang.String var) |
java.lang.Object |
groupMatchResult(int groupid,
int index)
Returns an Object representing the result for the match for a particular node in a group.
|
java.lang.Object |
groupMatchResult(java.lang.String groupVar,
int index)
Returns an Object representing the result for the match for a particular node in a group.
|
java.util.List<java.lang.Object> |
groupMatchResults()
Returns a list of Objects representing the match results for the entire sequence.
|
java.util.List<java.lang.Object> |
groupMatchResults(int group)
Returns a list of Objects representing the match results for the nodes in the group.
|
java.util.List<java.lang.Object> |
groupMatchResults(java.lang.String groupVar)
Returns a list of Objects representing the match results for the nodes in the group.
|
java.util.List<? extends T> |
groupNodes()
Returns the entire matched subsequence as a list.
|
java.util.List<? extends T> |
groupNodes(int group)
Returns the matched group as a list.
|
java.util.List<? extends T> |
groupNodes(java.lang.String groupVar)
Returns the matched group as a list.
|
java.lang.Object |
groupValue()
Returns the value (some Object) associated with the entire matched sequence.
|
java.lang.Object |
groupValue(int group)
Returns the value (some Object) associated with the captured group.
|
java.lang.Object |
groupValue(java.lang.String var)
Returns the value (some Object) associated with the captured group.
|
java.lang.Object |
nodeMatchResult(int index)
Returns an Object representing the result for the match for a particular node.
|
SequencePattern<T> |
pattern()
Returns pattern used to create this sequence match result
|
double |
priority() |
double |
score() |
int |
start(java.lang.String groupVar)
Returns the start index of the subsequence captured by the given group
during this match.
|
BasicSequenceMatchResult<T> |
toBasicSequenceMatchResult() |
end, end, group, group, groupCount, start, start
getInterval
static final int GROUP_BEFORE_MATCH
static final int GROUP_AFTER_MATCH
static final SequenceMatchResult.GroupToIntervalFunc TO_INTERVAL
static final java.util.Comparator<java.util.regex.MatchResult> PRIORITY_COMPARATOR
static final java.util.Comparator<java.util.regex.MatchResult> SCORE_COMPARATOR
static final java.util.Comparator<java.util.regex.MatchResult> ORDER_COMPARATOR
static final java.util.Comparator<java.util.regex.MatchResult> LENGTH_COMPARATOR
static final java.util.Comparator<java.util.regex.MatchResult> OFFSET_COMPARATOR
static final java.util.Comparator<java.util.regex.MatchResult> PRIORITY_SCORE_LENGTH_ORDER_OFFSET_COMPARATOR
static final java.util.Comparator<? super java.util.regex.MatchResult> DEFAULT_COMPARATOR
static final java.util.function.ToDoubleFunction<java.util.regex.MatchResult> SCORER
double score()
double priority()
java.util.List<? extends T> elements()
SequencePattern<T> pattern()
java.util.List<? extends T> groupNodes()
java.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.util.List<? extends T> groupNodes(int group)
group
- The index of a capturing group in this matcher's patternjava.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.lang.IndexOutOfBoundsException
- If there is no capturing group in the pattern
with the given indexBasicSequenceMatchResult<T> toBasicSequenceMatchResult()
java.util.List<? extends T> groupNodes(java.lang.String groupVar)
groupVar
- The name of the capturing group in this matcher's patternnull
if there is no capturing group in the pattern
with the given namejava.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.lang.String group(java.lang.String groupVar)
String
representing the matched group.groupVar
- The name of the capturing group in this matcher's patternString
or null
if there is no capturing group in the pattern
with the given namejava.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedint start(java.lang.String groupVar)
groupVar
- The name of the capturing group in this matcher's pattern-1
if the match was successful but the group
itself did not match anything
or if there is no capturing group in the pattern
with the given namejava.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedint end(java.lang.String groupVar)
groupVar
- The name of the capturing group in this matcher's pattern-1
if the match was successful but the group
itself did not match anything
or if there is no capturing group in the pattern
with the given namejava.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedint getOrder()
java.lang.Object nodeMatchResult(int index)
Map<Class, Object>
, while
for String, the match result is typically a MatchResult.index
- The index of the element in the original sequence.java.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.lang.IndexOutOfBoundsException
- If the index is out of rangejava.lang.Object groupMatchResult(int groupid, int index)
Map<Class, Object>
, while
for String, the match result is typically a MatchResult.groupid
- The index of a capturing group in this matcher's patternindex
- The index of the element in the captured subsequence.java.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.lang.IndexOutOfBoundsException
- If there is no capturing group in the pattern
with the given groupid or if the index is out of rangejava.lang.Object groupMatchResult(java.lang.String groupVar, int index)
Map<Class, Object>
, while
for String, the match result is typically a MatchResult.groupVar
- The name of the capturing group in this matcher's patternindex
- The index of the element in the captured subsequence.java.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.lang.IndexOutOfBoundsException
- if the index is out of rangejava.util.List<java.lang.Object> groupMatchResults()
java.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.util.List<java.lang.Object> groupMatchResults(int group)
group
- The index of a capturing group in this matcher's patternjava.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.lang.IndexOutOfBoundsException
- If there is no capturing group in the pattern
with the given indexjava.util.List<java.lang.Object> groupMatchResults(java.lang.String groupVar)
groupVar
- The name of the capturing group in this matcher's patternjava.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.lang.Object groupValue()
java.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.lang.Object groupValue(int group)
group
- The index of a capturing group in this matcher's patternjava.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedjava.lang.Object groupValue(java.lang.String var)
var
- The name of the capturing group in this matcher's patternjava.lang.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedSequenceMatchResult.MatchedGroupInfo<T> groupInfo()
SequenceMatchResult.MatchedGroupInfo<T> groupInfo(int group)
SequenceMatchResult.MatchedGroupInfo<T> groupInfo(java.lang.String var)