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

java.lang.Object
  extended by edu.stanford.nlp.ling.tokensregex.NodePattern<T>
Direct Known Subclasses:
CoreMapExpressionNodePattern, CoreMapNodePattern, CoreMapNodePattern.NilAnnotationPattern, CoreMapNodePattern.NotNilAnnotationPattern, CoreMapNodePattern.NumericAnnotationPattern, CoreMapNodePattern.SequenceRegexPattern, CoreMapNodePattern.StringAnnotationPattern, CoreMapNodePattern.StringAnnotationRegexPattern, CoreMapNodePattern.StringInSetAnnotationPattern, NodePattern.AnyNodePattern, NodePattern.ConjNodePattern, NodePattern.DisjNodePattern, NodePattern.EqualsNodePattern, NodePattern.NegateNodePattern

public abstract class NodePattern<T>
extends java.lang.Object

Matches a Node (i.e a Token)

Author:
Angel Chang

Nested Class Summary
static class NodePattern.AnyNodePattern<T>
          Matches any node
static class NodePattern.ConjNodePattern<T>
          Given a list of patterns p1,...,pn, matches if all patterns p1,...,pn matches
static class NodePattern.DisjNodePattern<T>
          Given a list of patterns p1,...,pn, matches if one of the patterns p1,...,pn matches
static class NodePattern.EqualsNodePattern<T>
          Matches a constant value of type T using equals()
static class NodePattern.NegateNodePattern<T>
          Given a node pattern p, a node x matches if p does not match x
 
Field Summary
static NodePattern ANY_NODE
           
 
Constructor Summary
NodePattern()
           
 
Method Summary
abstract  boolean match(T node)
          Returns true if the input node matches this pattern
 java.lang.Object matchWithResult(T node)
          Returns result associated with the match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_NODE

public static final NodePattern ANY_NODE
Constructor Detail

NodePattern

public NodePattern()
Method Detail

match

public abstract boolean match(T node)
Returns true if the input node matches this pattern

Parameters:
node - - node to match
Returns:
true if the node matches the pattern, false otherwise

matchWithResult

public java.lang.Object matchWithResult(T node)
Returns result associated with the match

Parameters:
node - node to match
Returns:
null if not matched, TRUE if there is a match but no other result associated with the match. Any other value is treated as the result value of the match.


Stanford NLP Group