gate.jape
Class BasicPatternElement

java.lang.Object
  extended by gate.jape.PatternElement
      extended by gate.jape.BasicPatternElement
All Implemented Interfaces:
JapeConstants, Serializable, Cloneable

public class BasicPatternElement
extends PatternElement
implements JapeConstants, Serializable

A pattern element within curly braces. Has a set of Constraint, which all must be satisfied at whatever position the element is being matched at.

See Also:
Serialized Form

Field Summary
private  ArrayList<Constraint> constraints1
          A set of Constraint.
private  Constraint[] constraints2
          A set of Constraint.
private  HashMap<Object,Constraint> constraintsMap
          A map of constraint annot type to constraint.
private static boolean DEBUG
          Debug flag
private  int lastFailurePoint
          Cache of the last position we failed at (-1 when none).
private  AnnotationSet matchedAnnots
          The set of annotations we have matched.
 
Fields inherited from class gate.jape.PatternElement
matchHistory
 
Fields inherited from interface gate.jape.JapeConstants
ALL_STYLE, 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
BasicPatternElement()
          Construction.
 
Method Summary
 void addConstraint(Constraint newConstraint)
          Add a constraint.
 Object clone()
          Need cloning for processing of macro references.
 void finish()
          Finish: replace dynamic data structures with Java arrays; called after parsing.
 Constraint[] getConstraints()
          Get the finished Constraint objects.
 ArrayList<Constraint> getUnfinishedConstraints()
          Get the current list of unfinished Constraint objects.
 boolean isMultiType()
          Indicates whether this constraint deals with only one type of annotation or multiple types.
 String shortDesc()
          Returns a short description.
 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
Debug flag

See Also:
Constant Field Values

constraints1

private ArrayList<Constraint> constraints1
A set of Constraint. Used during parsing.


constraints2

private Constraint[] constraints2
A set of Constraint. Used during matching.


constraintsMap

private HashMap<Object,Constraint> constraintsMap
A map of constraint annot type to constraint. Used during parsing.


lastFailurePoint

private int lastFailurePoint
Cache of the last position we failed at (-1 when none).


matchedAnnots

private AnnotationSet matchedAnnots
The set of annotations we have matched.

Constructor Detail

BasicPatternElement

public BasicPatternElement()
Construction.

Method Detail

clone

public Object clone()
Need cloning for processing of macro references. See comments on PatternElement.clone()

Overrides:
clone in class PatternElement

addConstraint

public void addConstraint(Constraint newConstraint)
Add a constraint. Ensures that only one constraint of any given annotation type and negation state exists.


isMultiType

public boolean isMultiType()
Indicates whether this constraint deals with only one type of annotation or multiple types.


finish

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

Specified by:
finish in class PatternElement

toString

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

Overrides:
toString in class Object

toString

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

Specified by:
toString in class PatternElement

shortDesc

public String shortDesc()
Returns a short description.


getUnfinishedConstraints

public ArrayList<Constraint> getUnfinishedConstraints()
Get the current list of unfinished Constraint objects. This can only be used before the finish() method is used.

Returns:
the array list of constraint objects. Will be null after the finish() method has been used.

getConstraints

public Constraint[] getConstraints()
Get the finished Constraint objects. Can only be used after the finish() method has been used.

Returns:
an array of constraint objects. Will be null before the finish() method has been used.