## gate.annotation
Class AnnotationImpl

    java.lang.Object
      |
      +--gate.util.AbstractFeatureBearer
            |
            +--gate.annotation.AnnotationImpl

All Implemented Interfaces:
  Annotation, Comparable, FeatureBearer, IdBearer, Serializable

public class AnnotationImpl
extends AbstractFeatureBearer
implements Annotation, FeatureBearer, Comparable

Provides an implementation for the interface gate.Annotation

See Also:
  Serialized Form

Inner Class Summary
`(package private) class` `AnnotationImpl.EventsHandler` All the events from the features are handled by this inner class.

Field Summary
`private Vector` `annotationListeners` The set of listeners of the annotation update events.
`private static boolean` `DEBUG` Debug flag
`(package private) Node` `end` The end node
`protected AnnotationImpl.EventsHandler` `eventHandler` The listener for the events coming from the features.
`(package private) Integer` `id` The id of this annotation (for persitency resons)
`(package private) static long` `serialVersionUID` Freeze the serialization UID.
`(package private) Node` `start` The start node
`(package private) String` `type` The type of the annotation

Fields inherited from class gate.util.AbstractFeatureBearer
`features`

Constructor Summary
`(package private)` `AnnotationImpl(Integer id, Node start, Node end, String type, FeatureMap features)` Constructor.

Method Summary
`void` `addAnnotationListener(AnnotationListener l)` Adds an annotation listener
`boolean` `coextensive(Annotation anAnnot)` Two Annotation are coextensive if their offsets are the same.
`int` `compareTo(Object o)` Ordering
`boolean` `equals(Object obj)` Returns true if two annotation are Equals.
`protected void` `fireAnnotationUpdated(AnnotationEvent e)`
`Node` `getEndNode()` The end node.
`Integer` `getId()` The ID of the annotation.
`Node` `getStartNode()` The start node.
`String` `getType()` The type of the annotation (corresponds to TIPSTER "name").
`int` `hashCode()` When equals called on two annotations returns true, is REQUIRED that the value hashCode for each annotation to be the same.
`boolean` `isCompatible(Annotation anAnnot)` This verifies if this annotation is compatible with another one.
`boolean` `isCompatible(Annotation anAnnot, Set aFeatureNamesSet)` This verifies if this annotation is compatible with another one, given a set with certain keys.
`boolean` `isPartiallyCompatible(Annotation anAnnot)` This method verifies if two annotation and are partially compatible.
`boolean` `isPartiallyCompatible(Annotation anAnnot, Set aFeatureNamesSet)` This method verifies if two annotation and are partially compatible, given a set with certain keys.
`boolean` `overlaps(Annotation aAnnot)` This method tells if this overlaps aAnnot.
`void` `removeAnnotationListener(AnnotationListener l)` Removes an annotation listener
`void` `setFeatures(FeatureMap features)` Set the feature set.
`String` `toString()` String representation of hte annotation

Methods inherited from class gate.util.AbstractFeatureBearer
`getFeatures`

Methods inherited from class java.lang.Object
`<clinit>, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait`

Methods inherited from interface gate.util.FeatureBearer
`getFeatures`

Field Detail

### DEBUG

    private static final boolean DEBUG

  Debug flag

### serialVersionUID

    static final long serialVersionUID

  Freeze the serialization UID.

### annotationListeners

    private transient Vector annotationListeners

  The set of listeners of the annotation update events. At present there are two event types supported:
  - ANNOTATION_UPDATED event
  - FEATURES_UPDATED event

### eventHandler

    protected AnnotationImpl.EventsHandler eventHandler

  The listener for the events coming from the features.

### id

    Integer id

  The id of this annotation (for persitency resons)

### type

    String type

  The type of the annotation

### start

    Node start

  The start node

### end

    Node end

  The end node

Constructor Detail

### AnnotationImpl

    AnnotationImpl(Integer id,
                   Node start,
                   Node end,
                   String type,
                   FeatureMap features)

  Constructor. Package access - annotations have to be constructed via AnnotationSets.
  Parameters:
    `id` - The id of the new annotation;
    `start` - The node from where the annotation will depart;
    `end` - The node where trhe annotation ends;
    `type` - The type of the new annotation;
    `features` - The features of the annotation.

Method Detail

### getId

    public Integer getId()

  The ID of the annotation.
  Specified by:
    `getId` in interface `IdBearer`

### getType

    public String getType()

  The type of the annotation (corresponds to TIPSTER "name").
  Specified by:
    `getType` in interface `Annotation`

### getStartNode

    public Node getStartNode()

  The start node.
  Specified by:
    `getStartNode` in interface `Annotation`

### getEndNode

    public Node getEndNode()

  The end node.
  Specified by:
    `getEndNode` in interface `Annotation`

### toString

    public String toString()

  String representation of hte annotation
  Overrides:
    `toString` in class `Object`

### compareTo

    public int compareTo(Object o)
                  throws ClassCastException

  Ordering
  Specified by:
    `compareTo` in interface `Annotation`

### hashCode

    public int hashCode()

  When equals called on two annotations returns true, is REQUIRED that the value hashCode for each annotation to be the same. It is not required that when equals return false, the values to be different. For speed, it would be beneficial to happen that way.
  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Returns true if two annotation are Equals. Two Annotation are equals if their offsets, types, id and features are the same.
  Overrides:
    `equals` in class `Object`

### setFeatures

    public void setFeatures(FeatureMap features)

  Set the feature set. Overriden from the implementation in AbstractFeatureBearer because it needs to fire events
  Specified by:
    `setFeatures` in interface `FeatureBearer`
  Overrides:
    `setFeatures` in class `AbstractFeatureBearer`

### isCompatible

    public boolean isCompatible(Annotation anAnnot)

  This verifies if this annotation is compatible with another one. Compatible means that they hit the same possition and the FeatureMap of this is incuded into aAnnot FeatureMap.
  Specified by:
    `isCompatible` in interface `Annotation`
  Parameters:
    `anAnnot` - a gate Annotation. If anAnnotation is null then false is returned.
  Returns:
    `true` if aAnnot is compatible with this and `false` otherwise.

### isCompatible

    public boolean isCompatible(Annotation anAnnot,
                                Set aFeatureNamesSet)

  This verifies if this annotation is compatible with another one, given a set with certain keys. In this case, compatible means that they hit the same possition and those keys from this's FeatureMap intersected with aFeatureNamesSet are incuded together with their values into the aAnnot's FeatureMap.
  Specified by:
    `isCompatible` in interface `Annotation`
  Parameters:
    `anAnnot` - a gate Annotation. If param is null, it will return false.
    `aFeatureNamesSet` - is a set containing certian key that will be intersected with this's FeatureMap's keys.If param is null then isCompatible(Annotation) will be called.
  Returns:
    `true` if aAnnot is compatible with this and `false` otherwise.

### isPartiallyCompatible

    public boolean isPartiallyCompatible(Annotation anAnnot)

  This method verifies if two annotation and are partially compatible. Partially compatible means that they overlap and the FeatureMap of this is incuded into FeatureMap of aAnnot.
  Specified by:
    `isPartiallyCompatible` in interface `Annotation`
  Parameters:
    `aAnnot` - a gate Annotation.
  Returns:
    `true` if this is partially compatible with aAnnot and `false` otherwise.

### isPartiallyCompatible

    public boolean isPartiallyCompatible(Annotation anAnnot,
                                         Set aFeatureNamesSet)

  This method verifies if two annotation and are partially compatible, given a set with certain keys. In this case, partially compatible means that they overlap and those keys from this's FeatureMap intersected with aFeatureNamesSet are incuded together with their values into the aAnnot's FeatureMap.
  Specified by:
    `isPartiallyCompatible` in interface `Annotation`
  Parameters:
    `anAnnot` - a gate Annotation. If param is null, the method will return false.
    `aFeatureNamesSet` - is a set containing certian key that will be intersected with this's FeatureMap's keys.If param is null then isPartiallyCompatible(Annotation) will be called.
  Returns:
    `true` if this is partially compatible with aAnnot and `false` otherwise.

### coextensive

    public boolean coextensive(Annotation anAnnot)

  Two Annotation are coextensive if their offsets are the same.
  Specified by:
    `coextensive` in interface `Annotation`
  Parameters:
    `anAnnot` - A Gate annotation.
  Returns:
    `true` if two annotation hit the same possition and `false` otherwise

### overlaps

    public boolean overlaps(Annotation aAnnot)

  This method tells if this overlaps aAnnot.
  Specified by:
    `overlaps` in interface `Annotation`
  Parameters:
    `aAnnot` - a gate Annotation.
  Returns:
    `true` if they overlap and `false` false if they don't.

### removeAnnotationListener

    public void removeAnnotationListener(AnnotationListener l)

  Removes an annotation listener
  Specified by:
    `removeAnnotationListener` in interface `Annotation`

### addAnnotationListener

    public void addAnnotationListener(AnnotationListener l)

  Adds an annotation listener
  Specified by:
    `addAnnotationListener` in interface `Annotation`

### fireAnnotationUpdated

    protected void fireAnnotationUpdated(AnnotationEvent e)

  Parameters:
    `e` -