public interface SequenceMatchResult<T> extends MatchResult, HasInterval<Integer>
Similar to Java's 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 MatchResult> |
static class |
SequenceMatchResult.MatchedGroupInfo<T>
Information about a matched group
|
Modifier and Type | Field and Description |
---|---|
static Comparator<? super MatchResult> |
DEFAULT_COMPARATOR |
static int |
GROUP_AFTER_MATCH |
static int |
GROUP_BEFORE_MATCH |
static Comparator<MatchResult> |
LENGTH_COMPARATOR |
static Comparator<MatchResult> |
OFFSET_COMPARATOR |
static Comparator<MatchResult> |
ORDER_COMPARATOR |
static Comparator<MatchResult> |
PRIORITY_COMPARATOR |
static Comparator<MatchResult> |
PRIORITY_SCORE_LENGTH_ORDER_OFFSET_COMPARATOR |
static Comparator<MatchResult> |
SCORE_COMPARATOR |
static java.util.function.Function<MatchResult,Double> |
SCORER |
static SequenceMatchResult.GroupToIntervalFunc |
TO_INTERVAL |
CONTAINS_FIRST_ENDPOINTS_COMPARATOR, ENDPOINTS_COMPARATOR, LENGTH_ENDPOINTS_COMPARATOR, NESTED_FIRST_ENDPOINTS_COMPARATOR
Modifier and Type | Method and Description |
---|---|
List<? extends T> |
elements()
Returns the original sequence the match was performed on.
|
int |
end(String groupVar)
Returns the index of the next element after the subsequence captured by the given group
during this match.
|
int |
getOrder() |
String |
group(String groupVar)
Returns the
String representing the matched group. |
SequenceMatchResult.MatchedGroupInfo<T> |
groupInfo() |
SequenceMatchResult.MatchedGroupInfo<T> |
groupInfo(int group) |
SequenceMatchResult.MatchedGroupInfo<T> |
groupInfo(String var) |
Object |
groupMatchResult(int groupid,
int index)
Returns an Object representing the result for the match for a particular node in a group.
|
Object |
groupMatchResult(String groupVar,
int index)
Returns an Object representing the result for the match for a particular node in a group.
|
List<Object> |
groupMatchResults()
Returns a list of Objects representing the match results for the entire sequence.
|
List<Object> |
groupMatchResults(int group)
Returns a list of Objects representing the match results for the nodes in the group.
|
List<Object> |
groupMatchResults(String groupVar)
Returns a list of Objects representing the match results for the nodes in the group.
|
List<? extends T> |
groupNodes()
Returns the entire matched subsequence as a list.
|
List<? extends T> |
groupNodes(int group)
Returns the matched group as a list.
|
List<? extends T> |
groupNodes(String groupVar)
Returns the matched group as a list.
|
Object |
groupValue()
Returns the value (some Object) associated with the entire matched sequence.
|
Object |
groupValue(int group)
Returns the value (some Object) associated with the captured group.
|
Object |
groupValue(String var)
Returns the value (some Object) associated with the captured group.
|
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(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 Comparator<MatchResult> PRIORITY_COMPARATOR
static final Comparator<MatchResult> SCORE_COMPARATOR
static final Comparator<MatchResult> ORDER_COMPARATOR
static final Comparator<MatchResult> LENGTH_COMPARATOR
static final Comparator<MatchResult> OFFSET_COMPARATOR
static final Comparator<MatchResult> PRIORITY_SCORE_LENGTH_ORDER_OFFSET_COMPARATOR
static final Comparator<? super MatchResult> DEFAULT_COMPARATOR
static final java.util.function.Function<MatchResult,Double> SCORER
double score()
double priority()
List<? extends T> elements()
SequencePattern<T> pattern()
List<? extends T> groupNodes()
IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedList<? extends T> groupNodes(int group)
group
- The index of a capturing group in this matcher's patternIllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedIndexOutOfBoundsException
- If there is no capturing group in the pattern
with the given indexBasicSequenceMatchResult<T> toBasicSequenceMatchResult()
List<? extends T> groupNodes(String groupVar)
groupVar
- The name of the capturing group in this matcher's patternIllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedString group(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 nameIllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedint start(String groupVar)
groupVar
- The name of the capturing group in this matcher's patternIllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedint end(String groupVar)
groupVar
- The name of the capturing group in this matcher's patternIllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedint getOrder()
Object nodeMatchResult(int index)
index
- The index of the element in the original sequence.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedIndexOutOfBoundsException
- If the index is out of rangeObject groupMatchResult(int groupid, int index)
groupid
- The index of a capturing group in this matcher's patternindex
- The index of the element in the captured subsequence.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedIndexOutOfBoundsException
- If there is no capturing group in the pattern
with the given groupid or if the index is out of rangeObject groupMatchResult(String groupVar, int index)
groupVar
- The name of the capturing group in this matcher's patternindex
- The index of the element in the captured subsequence.IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedIndexOutOfBoundsException
- if the index is out of rangeList<Object> groupMatchResults()
IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedList<Object> groupMatchResults(int group)
group
- The index of a capturing group in this matcher's patternIllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedIndexOutOfBoundsException
- If there is no capturing group in the pattern
with the given indexList<Object> groupMatchResults(String groupVar)
groupVar
- The name of the capturing group in this matcher's patternIllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedObject groupValue()
IllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedObject groupValue(int group)
group
- The index of a capturing group in this matcher's patternIllegalStateException
- If no match has yet been attempted,
or if the previous match operation failedObject groupValue(String var)
var
- The name of the capturing group in this matcher's patternIllegalStateException
- 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(String var)