edu.stanford.nlp.ling.tokensregex
Class BasicSequenceMatchResult<T>

java.lang.Object
  extended by edu.stanford.nlp.ling.tokensregex.BasicSequenceMatchResult<T>
All Implemented Interfaces:
SequenceMatchResult<T>, HasInterval<java.lang.Integer>, java.util.regex.MatchResult
Direct Known Subclasses:
SequenceMatcher

public class BasicSequenceMatchResult<T>
extends java.lang.Object
implements SequenceMatchResult<T>

Basic results for a Sequence Match

Author:
Angel Chang

Nested Class Summary
protected static class BasicSequenceMatchResult.MatchedGroup
           
 
Nested classes/interfaces inherited from interface edu.stanford.nlp.ling.tokensregex.SequenceMatchResult
SequenceMatchResult.GroupToIntervalFunc<MR extends java.util.regex.MatchResult>, SequenceMatchResult.MatchedGroupInfo<T>
 
Field Summary
 
Fields inherited from interface edu.stanford.nlp.ling.tokensregex.SequenceMatchResult
DEFAULT_COMPARATOR, GROUP_AFTER_MATCH, GROUP_BEFORE_MATCH, LENGTH_COMPARATOR, OFFSET_COMPARATOR, ORDER_COMPARATOR, SCORE_COMPARATOR, SCORE_LENGTH_ORDER_OFFSET_COMPARATOR, TO_INTERVAL
 
Fields inherited from interface edu.stanford.nlp.util.HasInterval
CONTAINS_FIRST_ENDPOINTS_COMPARATOR, ENDPOINTS_COMPARATOR, NESTED_FIRST_ENDPOINTS_COMPARATOR
 
Constructor Summary
BasicSequenceMatchResult()
           
 
Method Summary
 BasicSequenceMatchResult<T> copy()
           
 java.util.List<? extends T> elements()
          Returns the original sequence the match was performed on.
 int end()
           
 int end(int group)
           
 int end(java.lang.String var)
          Returns the index of the next element after the subsequence captured by the given group during this match.
 Interval<java.lang.Integer> getInterval()
          Returns the interval
 int getOrder()
           
 java.lang.String group()
           
 java.lang.String group(int group)
           
 java.lang.String group(java.lang.String var)
          Returns the String representing the matched group.
 int groupCount()
           
 SequenceMatchResult.MatchedGroupInfo<T> groupInfo()
           
 SequenceMatchResult.MatchedGroupInfo<T> groupInfo(int group)
           
 SequenceMatchResult.MatchedGroupInfo<T> groupInfo(java.lang.String var)
           
 java.lang.Object groupMatchResult(int group, 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 var, 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 var)
          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 var)
          Returns the matched group as a list.
 java.lang.Object groupValue()
           
 java.lang.Object groupValue(int group)
           
 java.lang.Object groupValue(java.lang.String var)
           
 java.lang.Object nodeMatchResult(int index)
          Returns an Object representing the result for the match for a particular node.
 double score()
           
 void setOrder(int order)
           
 int start()
           
 int start(int group)
           
 int start(java.lang.String var)
          Returns the start index of the subsequence captured by the given group during this match.
 BasicSequenceMatchResult<T> toBasicSequenceMatchResult()
           
static
<T> BasicSequenceMatchResult<T>
toBasicSequenceMatchResult(java.util.List<? extends T> elements)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicSequenceMatchResult

public BasicSequenceMatchResult()
Method Detail

elements

public java.util.List<? extends T> elements()
Description copied from interface: SequenceMatchResult
Returns the original sequence the match was performed on.

Specified by:
elements in interface SequenceMatchResult<T>
Returns:
The list that the match was performed on

toBasicSequenceMatchResult

public static <T> BasicSequenceMatchResult<T> toBasicSequenceMatchResult(java.util.List<? extends T> elements)

toBasicSequenceMatchResult

public BasicSequenceMatchResult<T> toBasicSequenceMatchResult()
Specified by:
toBasicSequenceMatchResult in interface SequenceMatchResult<T>

copy

public BasicSequenceMatchResult<T> copy()

getInterval

public Interval<java.lang.Integer> getInterval()
Description copied from interface: HasInterval
Returns the interval

Specified by:
getInterval in interface HasInterval<java.lang.Integer>
Returns:
interval

getOrder

public int getOrder()
Specified by:
getOrder in interface SequenceMatchResult<T>

setOrder

public void setOrder(int order)

score

public double score()
Specified by:
score in interface SequenceMatchResult<T>

start

public int start()
Specified by:
start in interface java.util.regex.MatchResult

start

public int start(int group)
Specified by:
start in interface java.util.regex.MatchResult

start

public int start(java.lang.String var)
Description copied from interface: SequenceMatchResult
Returns the start index of the subsequence captured by the given group during this match.

Specified by:
start in interface SequenceMatchResult<T>
Parameters:
var - The name of the capturing group in this matcher's pattern
Returns:
the index of the first element captured by the group, or -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 name

end

public int end()
Specified by:
end in interface java.util.regex.MatchResult

end

public int end(int group)
Specified by:
end in interface java.util.regex.MatchResult

end

public int end(java.lang.String var)
Description copied from interface: SequenceMatchResult
Returns the index of the next element after the subsequence captured by the given group during this match.

Specified by:
end in interface SequenceMatchResult<T>
Parameters:
var - The name of the capturing group in this matcher's pattern
Returns:
the index of the next element after the subsequence captured by the group, or -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 name

group

public java.lang.String group()
Specified by:
group in interface java.util.regex.MatchResult

group

public java.lang.String group(int group)
Specified by:
group in interface java.util.regex.MatchResult

group

public java.lang.String group(java.lang.String var)
Description copied from interface: SequenceMatchResult
Returns the String representing the matched group.

Specified by:
group in interface SequenceMatchResult<T>
Parameters:
var - The name of the capturing group in this matcher's pattern
Returns:
the matched group as a String or null if there is no capturing group in the pattern with the given name

groupNodes

public java.util.List<? extends T> groupNodes()
Description copied from interface: SequenceMatchResult
Returns the entire matched subsequence as a list.

Specified by:
groupNodes in interface SequenceMatchResult<T>
Returns:
the matched subsequence as a list

groupNodes

public java.util.List<? extends T> groupNodes(int group)
Description copied from interface: SequenceMatchResult
Returns the matched group as a list.

Specified by:
groupNodes in interface SequenceMatchResult<T>
Parameters:
group - The index of a capturing group in this matcher's pattern
Returns:
the matched group as a list

groupNodes

public java.util.List<? extends T> groupNodes(java.lang.String var)
Description copied from interface: SequenceMatchResult
Returns the matched group as a list.

Specified by:
groupNodes in interface SequenceMatchResult<T>
Parameters:
var - The name of the capturing group in this matcher's pattern
Returns:
the matched group as a list or null if there is no capturing group in the pattern with the given name

groupValue

public java.lang.Object groupValue()
Specified by:
groupValue in interface SequenceMatchResult<T>

groupValue

public java.lang.Object groupValue(int group)
Specified by:
groupValue in interface SequenceMatchResult<T>

groupValue

public java.lang.Object groupValue(java.lang.String var)
Specified by:
groupValue in interface SequenceMatchResult<T>

groupInfo

public SequenceMatchResult.MatchedGroupInfo<T> groupInfo()
Specified by:
groupInfo in interface SequenceMatchResult<T>

groupInfo

public SequenceMatchResult.MatchedGroupInfo<T> groupInfo(int group)
Specified by:
groupInfo in interface SequenceMatchResult<T>

groupInfo

public SequenceMatchResult.MatchedGroupInfo<T> groupInfo(java.lang.String var)
Specified by:
groupInfo in interface SequenceMatchResult<T>

groupCount

public int groupCount()
Specified by:
groupCount in interface java.util.regex.MatchResult

groupMatchResults

public java.util.List<java.lang.Object> groupMatchResults()
Description copied from interface: SequenceMatchResult
Returns a list of Objects representing the match results for the entire sequence.

Specified by:
groupMatchResults in interface SequenceMatchResult<T>
Returns:
the list of match results associated with the entire sequence

groupMatchResults

public java.util.List<java.lang.Object> groupMatchResults(int group)
Description copied from interface: SequenceMatchResult
Returns a list of Objects representing the match results for the nodes in the group.

Specified by:
groupMatchResults in interface SequenceMatchResult<T>
Parameters:
group - The index of a capturing group in this matcher's pattern
Returns:
the list of match results associated with the nodes for the captured group.

groupMatchResults

public java.util.List<java.lang.Object> groupMatchResults(java.lang.String var)
Description copied from interface: SequenceMatchResult
Returns a list of Objects representing the match results for the nodes in the group. f

Specified by:
groupMatchResults in interface SequenceMatchResult<T>
Parameters:
var - The name of the capturing group in this matcher's pattern
Returns:
the list of match results associated with the nodes for the captured group.

nodeMatchResult

public java.lang.Object nodeMatchResult(int index)
Description copied from interface: SequenceMatchResult
Returns an Object representing the result for the match for a particular node. (actual Object returned depends on the type T of the nodes. For instance, for a CoreMap, the match result is returned as a Map, while for String, the match result is typically a MatchResult.

Specified by:
nodeMatchResult in interface SequenceMatchResult<T>
Parameters:
index - The index of the element in the original sequence.
Returns:
the match result associated with the node at the given index.

groupMatchResult

public java.lang.Object groupMatchResult(int group,
                                         int index)
Description copied from interface: SequenceMatchResult
Returns an Object representing the result for the match for a particular node in a group. (actual Object returned depends on the type T of the nodes. For instance, for a CoreMap, the match result is returned as a Map, while for String, the match result is typically a MatchResult.

Specified by:
groupMatchResult in interface SequenceMatchResult<T>
Parameters:
group - The index of a capturing group in this matcher's pattern
index - The index of the element in the captured subsequence.
Returns:
the match result associated with the node at the given index for the captured group.

groupMatchResult

public java.lang.Object groupMatchResult(java.lang.String var,
                                         int index)
Description copied from interface: SequenceMatchResult
Returns an Object representing the result for the match for a particular node in a group. (actual Object returned depends on the type T of the nodes. For instance, for a CoreMap, the match result is returned as a Map, while for String, the match result is typically a MatchResult.

Specified by:
groupMatchResult in interface SequenceMatchResult<T>
Parameters:
var - The name of the capturing group in this matcher's pattern
index - The index of the element in the captured subsequence.
Returns:
the match result associated with the node at the given index for the captured group.


Stanford NLP Group