GATE
Version 3.1-2270

gate.jape
Class PatternElement

java.lang.Object
  extended by gate.jape.PatternElement
All Implemented Interfaces:
JapeConstants, Matcher, Serializable, Cloneable
Direct Known Subclasses:
BasicPatternElement, ComplexPatternElement, ConstraintGroup

public abstract class PatternElement
extends Object
implements Cloneable, Matcher, JapeConstants, Serializable

Superclass of the various types of pattern element, and of ConstraintGroup. Inherits from Matcher, providing matches and reset. Provides access to the annotations that are cached by subclasses, and multilevel rollback of those caches. Stores the match history.

See Also:
Serialized Form

Field Summary
protected  Stack matchHistory
          Match history stack, for use in rollback.
 
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
PatternElement()
          Anonymous construction.
 
Method Summary
 Object clone()
          Cloning for processing of macro references.
abstract  AnnotationSet getMatchedAnnots()
          Access to the annotations that have been matched.
 void reset()
          Reset: clear annotation caches etc.
abstract  void rollback(int arity)
          Multilevel rollback of annotation caches.
abstract  String toString(String pad)
          Create a string representation of the object with padding.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.jape.Matcher
finish, matches
 

Field Detail

matchHistory

protected Stack matchHistory
Match history stack, for use in rollback. In BasicPatternElements the objects on the stack are Integers giving the number of annots that were cached at that point in the history. In ComplexPatternElements the objects are Integers giving the number of times the component ConstraintGroup was successfully matched. In ConstraintGroups the elements are arrays representing conjunctions of PatternElement that succeeded at that point in the history.

Constructor Detail

PatternElement

public PatternElement()
Anonymous construction.

Method Detail

clone

public Object clone()
Cloning for processing of macro references. Note that it doesn't really clone the match history, just set it to a new Stack. This is because a) JGL doesn't have real clone methods and b) we don't actually need it anywhere but during parsing the .jape, where there is no match history yet.

Overrides:
clone in class Object

getMatchedAnnots

public abstract AnnotationSet getMatchedAnnots()
Access to the annotations that have been matched.


rollback

public abstract void rollback(int arity)
Multilevel rollback of annotation caches.


reset

public void reset()
Reset: clear annotation caches etc. Most of the behaviour of this method is the responsibility of subclasses.

Specified by:
reset in interface Matcher

toString

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


GATE
Version 3.1-2270