gate.jape
Class Constraint

java.lang.Object
  |
  +--gate.jape.Constraint
All Implemented Interfaces:
Cloneable, JapeConstants, Serializable

public class Constraint
extends Object
implements JapeConstants, Serializable, Cloneable

An individual annotation/attribute/value expression. It doesn't extend PatternElement, even though it has to "match", because a set of Constraint must be applied together in order to avoid doing separate selectAnnotations calls for each one.

See Also:
Serialized Form

Field Summary
private  String annotType
          The type of annnotation we're looking for.
private  FeatureMap attrs1
          The attributes that must be present on the matched annotation.
private  JdmAttribute[] attrs2
          The attributes array that must be present on the matched annotation.
private static boolean DEBUG
          Debug flag
private  boolean negated
          Are we negated?
 
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
Constraint(String annotType)
          Construction from annot type string
Constraint(String annotType, ArrayList attrsArray)
          Construction from annot type and array of attributes
Constraint(String annotType, FeatureMap attrs)
          Construction from annot type and attribute sequence
 
Method Summary
 void addAttribute(JdmAttribute attr)
          Add an attribute.
 void addAttribute(String name, Object value)
          Create and add an attribute.
 Object clone()
          Need cloning for processing of macro references.
 void finish()
          Finish: replace dynamic data structures with Java arrays; called after parsing.
 String getAnnotType()
          Get the type of annnotation we're looking for.
 JdmAttribute[] getAttributeArray()
          Get the attributes that must be present on the matched annotation.
 FeatureMap getAttributeSeq()
          Get the attributes that must be present on the matched annotation.
 boolean isNegated()
          Access to negation flag.
 void negate()
          Set negation.
 String shortDesc()
           
 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

annotType

private String annotType
The type of annnotation we're looking for.


negated

private boolean negated
Are we negated?


attrs1

private FeatureMap attrs1
The attributes that must be present on the matched annotation.


attrs2

private JdmAttribute[] attrs2
The attributes array that must be present on the matched annotation.

Constructor Detail

Constraint

public Constraint(String annotType)
Construction from annot type string


Constraint

public Constraint(String annotType,
                  FeatureMap attrs)
Construction from annot type and attribute sequence


Constraint

public Constraint(String annotType,
                  ArrayList attrsArray)
Construction from annot type and array of attributes

Method Detail

negate

public void negate()
Set negation.


isNegated

public boolean isNegated()
Access to negation flag.


getAnnotType

public String getAnnotType()
Get the type of annnotation we're looking for.


getAttributeSeq

public FeatureMap getAttributeSeq()
Get the attributes that must be present on the matched annotation.


getAttributeArray

public JdmAttribute[] getAttributeArray()
Get the attributes that must be present on the matched annotation.


addAttribute

public void addAttribute(JdmAttribute attr)
Add an attribute.


addAttribute

public void addAttribute(String name,
                         Object value)
Create and add an attribute.


clone

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

Overrides:
clone in class Object

finish

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


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.


shortDesc

public String shortDesc()