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

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.
 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
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures
 

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