Class Annotation

All Implemented Interfaces:
Cloneable, AnnotationBaseFS, FeatureStructure, AnnotationBaseImpl, AnnotationImpl, FeatureStructureImpl, AnnotationFS
Direct Known Subclasses:
DocumentAnnotation, SourceDocumentInformation

public class Annotation extends AnnotationBase implements AnnotationImpl
the JCas class model for the CAS type uima.cas.Annotation. It defines two integer valued features indicating the begin and end of the span being annotated. There is also a method to retrieve the spanned text as a string.
  • Field Details

  • Constructor Details

    • Annotation

      @Deprecated protected Annotation()
      Deprecated.
    • Annotation

      public Annotation(JCas jcas)
    • Annotation

      public Annotation(TypeImpl t, CASImpl c)
      used by generator Make a new AnnotationBase
      Parameters:
      c - -
      t - -
    • Annotation

      public Annotation(JCas jcas, int begin, int end)
      Constructor with begin and end passed as arguments
      Parameters:
      jcas - JCas
      begin - begin offset
      end - end offset
  • Method Details

    • getTypeIndexID

      public int getTypeIndexID()
      Overrides:
      getTypeIndexID in class AnnotationBase
      Returns:
      the type array index
    • getBegin

      public final int getBegin()
      Description copied from interface: AnnotationFS
      Get the start position of the annotation as character offset into the text. The smallest possible start position is 0, the offset of the first character in the text.
      Specified by:
      getBegin in interface AnnotationFS
      Returns:
      The start position.
    • setBegin

      public final void setBegin(int v)
      Description copied from interface: AnnotationFS
      Set the start position of the annotation as character offset into the text. The smallest possible start position is 0, the offset of the first character in the text.
      Specified by:
      setBegin in interface AnnotationFS
      Parameters:
      v - The start position.
    • getEnd

      public final int getEnd()
      Description copied from interface: AnnotationFS
      Get the end position of the annotation as character offset into the text. The end position points at the first character after the annotation, such that (getEnd()-getBegin()) == getCoveredText().length().
      Specified by:
      getEnd in interface AnnotationFS
      Returns:
      The end position.
    • setEnd

      public final void setEnd(int v)
      Description copied from interface: AnnotationFS
      Set the end position of the annotation as character offset into the text. The end position points at the first character after the annotation, such that (getEnd()-getBegin()) == getCoveredText().length().
      Specified by:
      setEnd in interface AnnotationFS
      Parameters:
      v - The end position position.
    • getCoveredText

      public String getCoveredText()
      Description copied from interface: AnnotationFS
      Get the text covered by an annotation as a string. If docText is your document text and annot an annotation, then annot.getCoveredText().equals(docText.substring(annot.getBegin(), annot.getEnd())).
      Specified by:
      getCoveredText in interface AnnotationFS
      Returns:
      -
      See Also:
    • getStart

      @Deprecated public int getStart()
      Deprecated.
      Use getBegin() instead.
      Returns:
      the Annotation "begin" feature value
    • compareAnnotation

      public final int compareAnnotation(Annotation other)
      Compare two annotations, no type order
      Parameters:
      other - -
      Returns:
      -
    • compareAnnotation

      public final int compareAnnotation(Annotation other, LinearTypeOrder lto)
      Compare two annotations incl type order
      Parameters:
      other - -
      lto - -
      Returns:
      -
    • compareAnnotationWithId

      public final int compareAnnotationWithId(Annotation other)
      Compare two annotations, with id compare
      Parameters:
      other - -
      Returns:
      -
    • compareAnnotationWithId

      public final int compareAnnotationWithId(Annotation other, LinearTypeOrder lto)
      Compare two annotations, with type order, with id compare
      Parameters:
      other - -
      lto - -
      Returns:
      -
    • trim

      public void trim(IntPredicate aIsTrimChar)
      Description copied from interface: AnnotationFS
      Strips leading and trailing characters matching the given predicate by increasing/decreasing the begin/end offsets.
      Specified by:
      trim in interface AnnotationFS
      Parameters:
      aIsTrimChar - the predicate used to identify whether a given codepoint is whitespace.
      See Also:
    • _createMarkerAnnotation

      public static Annotation _createMarkerAnnotation(JCas aJCas, int aBegin, int aEnd)
      For internal use by SelectFSs_impl