Jet.Tipster
Class Annotation

java.lang.Object
  extended byJet.Tipster.Annotation

public class Annotation
extends java.lang.Object

An Annotation assigns a type and a set of features to a portion of a Document.


Field Summary
static int MAX_ANNOTATION_DEPTH
          in converting an Annotation to a String, the maximum level of nesting of Annotations which will be printed.
 
Constructor Summary
Annotation(java.lang.String tp, Span sp, FeatureSet att)
           
 
Method Summary
 void assignId()
          if the Annotation does not already have an 'id' feature, assigns an 'id' feature whose value is the unique (to the Document) identifier obtained by Document.getNextAnnotationId().
 FeatureSet attributes()
           
 int end()
          returns the end of the span associated with the annotation.
 java.lang.Object get(java.lang.String feature)
          Returns the value of attribute feature of the annotation.
 int getId()
          returns the value of the 'id' feature (converted from an Integer or String to an int).
 void prepareToMakeString(int nestingLimit)
           
 void put(java.lang.String feature, java.lang.Object value)
          Sets the value of attribute feature of the annotation to value.
static void sort(java.util.Vector annotations)
          sorts a Vector of Annotations based on the end of the span of each Annotation, highest end value first.
 Span span()
          returns the span (of text) associated with the annotation.
 int start()
          returns the start of the span associated with the annotation.
 java.lang.String toSGMLString()
           
 java.lang.String toSGMLString(int nestingLimit, boolean quoteValues)
          returns a String representation of the Annotation, without information about the span of the annotation.
 java.lang.String toString()
          returns a String representation of the Annotation, including the type, span, and attributes, enclosed in '<' and '>'.
 java.lang.String type()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_ANNOTATION_DEPTH

public static final int MAX_ANNOTATION_DEPTH
in converting an Annotation to a String, the maximum level of nesting of Annotations which will be printed. Nesting occurs when the value of some attribute of an Annotation is itself an Annotation. When the maximum level is reached, the reference to the Annotation is represented by '#id'.

See Also:
Constant Field Values
Constructor Detail

Annotation

public Annotation(java.lang.String tp,
                  Span sp,
                  FeatureSet att)
Method Detail

type

public java.lang.String type()

span

public Span span()
returns the span (of text) associated with the annotation.


start

public int start()
returns the start of the span associated with the annotation.


end

public int end()
returns the end of the span associated with the annotation.


attributes

public FeatureSet attributes()

get

public java.lang.Object get(java.lang.String feature)
Returns the value of attribute feature of the annotation.


put

public void put(java.lang.String feature,
                java.lang.Object value)
Sets the value of attribute feature of the annotation to value.


assignId

public void assignId()
if the Annotation does not already have an 'id' feature, assigns an 'id' feature whose value is the unique (to the Document) identifier obtained by Document.getNextAnnotationId().


getId

public int getId()
returns the value of the 'id' feature (converted from an Integer or String to an int). Prints a message if the Annotation does not have an 'id' feature, or if the feature is not of the proper type.


prepareToMakeString

public void prepareToMakeString(int nestingLimit)

toString

public java.lang.String toString()
returns a String representation of the Annotation, including the type, span, and attributes, enclosed in '<' and '>'.


toSGMLString

public java.lang.String toSGMLString()

toSGMLString

public java.lang.String toSGMLString(int nestingLimit,
                                     boolean quoteValues)
returns a String representation of the Annotation, without information about the span of the annotation. The representation serves as the open tag in a SGML or XML represenation of the annotated document.


sort

public static void sort(java.util.Vector annotations)
sorts a Vector of Annotations based on the end of the span of each Annotation, highest end value first. Among annotations with the same end span, if the annotations are linked in a tree structure by 'children' attributes, the highest annotation in the tree is placed first in the sorted sequence.