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

Field Summary
private static boolean DEBUG
          Debug flag
(package private)  Node end
          The end node
(package private)  FeatureMap features
          The features of the annotation
(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
 
Constructor Summary
(package private) AnnotationImpl(Integer id, Node start, Node end, String type, FeatureMap features)
          Constructor.
 
Method Summary
 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.
 FeatureMap getFeatures()
          The features, or content of this arc (corresponds to TIPSTER "attributes", and to LDC "label", which is the simplest case).
 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 aAnnot)
          This verifies if this annotation is compatible with another one.
 boolean isPartiallyCompatible(Annotation aAnnot)
          This method verifies if two annotation and are partially compatible.
 boolean overlaps(Annotation aAnnot)
          This method tells if this overlaps aAnnot.
 void setFeatures(FeatureMap features)
          Set the feature set
 String toString()
          String representation of hte annotation
 
Methods inherited from class gate.util.AbstractFeatureBearer
getName, setName
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface gate.util.FeatureBearer
getName, setName
 

Field Detail

DEBUG

private static final boolean DEBUG
Debug flag

serialVersionUID

static final long serialVersionUID
Freeze the serialization UID.

id

Integer id
The id of this annotation (for persitency resons)

type

String type
The type of the annotation

features

FeatureMap features
The features 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

getFeatures

public FeatureMap getFeatures()
The features, or content of this arc (corresponds to TIPSTER "attributes", and to LDC "label", which is the simplest case).
Specified by:
getFeatures in interface FeatureBearer
Overrides:
getFeatures in class AbstractFeatureBearer

setFeatures

public void setFeatures(FeatureMap features)
Set the feature set
Specified by:
setFeatures in interface FeatureBearer
Overrides:
setFeatures in class AbstractFeatureBearer

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

isCompatible

public boolean isCompatible(Annotation aAnnot)
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:
aAnnot - a gate Annotation.
Returns:
true if aAnnot is compatible with this and false otherwise.

isPartiallyCompatible

public boolean isPartiallyCompatible(Annotation aAnnot)
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.

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.