gate.jape
Class LeftHandSide

java.lang.Object
  extended bygate.jape.LeftHandSide
All Implemented Interfaces:
JapeConstants, Matcher, Serializable

public class LeftHandSide
extends Object
implements Matcher, JapeConstants, Serializable

The LHS of a CPSL rule. The pattern part. Has a ConstraintGroup and binding information that associates labels with ComplexPatternElements. Provides the Matcher interface.

See Also:
Serialized Form

Field Summary
private  HashMap bindingTable
          Mapping of binding names to ComplexPatternElements
private  ConstraintGroup constraintGroup
          The constraint group making up this LHS.
private static boolean DEBUG
          Debug flag
private  boolean hasMatched
          Flag for whether our last match was successful or not.
 
Fields inherited from interface gate.jape.JapeConstants
APPELT_STYLE, BRILL_STYLE, DEFAULT_PRIORITY, FIRST_STYLE, INDENT_PADDING, KLEENE_PLUS, KLEENE_QUERY, KLEENE_STAR, MULTI_SPAN_BINDING, NO_BINDING, NO_KLEENE_OP, ONCE_STYLE, SINGLE_SPAN_BINDING
 
Constructor Summary
LeftHandSide(ConstraintGroup constraintGroup)
          Construction from a ConstraintGroup
 
Method Summary
 void addBinding(String bindingName, ComplexPatternElement binding, HashSet bindingNameSet, boolean macroRef)
          Add a binding record.
 void finish()
          Finish: replace dynamic data structures with Java arrays; called after parsing.
 AnnotationSet getBoundAnnots(String bindingName)
          Get annotations via a binding name.
 ConstraintGroup getConstraintGroup()
          Get the constraint group
(package private)  AnnotationSet getMatchedAnnots()
          For debugging only.
 boolean hasMatched()
          Was the last match successful?
 boolean matches(Document doc, int position, MutableInteger newPosition)
          Does the LHS match the document at this position?
 void reset()
          Clear the matched annotations cached in pattern elements.
 String toString()
          Create a string representation of the object.
 String toString(String pad)
          Create a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
Debug flag

See Also:
Constant Field Values

constraintGroup

private ConstraintGroup constraintGroup
The constraint group making up this LHS.


bindingTable

private HashMap bindingTable
Mapping of binding names to ComplexPatternElements


hasMatched

private boolean hasMatched
Flag for whether our last match was successful or not.

Constructor Detail

LeftHandSide

public LeftHandSide(ConstraintGroup constraintGroup)
Construction from a ConstraintGroup

Method Detail

addBinding

public void addBinding(String bindingName,
                       ComplexPatternElement binding,
                       HashSet bindingNameSet,
                       boolean macroRef)
                throws JapeException
Add a binding record.

Throws:
JapeException

finish

public void finish()
Finish: replace dynamic data structures with Java arrays; called after parsing.

Specified by:
finish in interface Matcher

getBoundAnnots

public AnnotationSet getBoundAnnots(String bindingName)
Get annotations via a binding name.


getMatchedAnnots

AnnotationSet getMatchedAnnots()
For debugging only. Return a set of all annotations matched by the LHS during the last call to matches. (May be null.)


reset

public void reset()
Clear the matched annotations cached in pattern elements.

Specified by:
reset in interface Matcher

hasMatched

public boolean hasMatched()
Was the last match successful?


matches

public boolean matches(Document doc,
                       int position,
                       MutableInteger newPosition)
Does the LHS match the document at this position?

Specified by:
matches in interface Matcher

toString

public String toString()
Create a string representation of the object.


toString

public String toString(String pad)
Create a string representation of the object.


getConstraintGroup

public ConstraintGroup getConstraintGroup()
Get the constraint group