org.apache.uima.jcas.tcas

## Class Annotation

- java.lang.Object
- - org.apache.uima.cas.impl.FeatureStructureImpl
  - - org.apache.uima.jcas.cas.TOP
    - - org.apache.uima.jcas.cas.AnnotationBase
      - - org.apache.uima.jcas.tcas.Annotation

- All Implemented Interfaces:
    Cloneable, AnnotationBaseFS, FeatureStructure, AnnotationFS
  Direct Known Subclasses:
    DocumentAnnotation, SourceDocumentInformation

      public class Annotation
      extends AnnotationBase
      implements AnnotationFS

  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 Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `type`
    `static int` | `typeIndexID`

    - ### Fields inherited from class org.apache.uima.jcas.cas.TOP

      `addr, jcasType`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Annotation()`
    `` | `Annotation(int addr, TOP_Type type)`
    `` | `Annotation(JCas jcas)`
    `` | `Annotation(JCas jcas, int begin, int end)` Constructor with begin and end passed as arguments

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getBegin()` Get the start position of the annotation as character offset into the text.
    `String` | `getCoveredText()` Get the text covered by an annotation as a string.
    `int` | `getEnd()` Get the end position of the annotation as character offset into the text.
    `int` | `getStart()` Deprecated. Use `getBegin()` instead.
    `int` | `getTypeIndexID()` used to obtain reference to the TOP_Type instance
    `void` | `setBegin(int v)`
    `void` | `setEnd(int v)`

    - ### Methods inherited from class org.apache.uima.jcas.cas.AnnotationBase

      `getSofa, getView`

    - ### Methods inherited from class org.apache.uima.jcas.cas.TOP

      `addToIndexes, addToIndexes, equals, getAddress, getCAS, getCASImpl, getLowLevelCas, hashCode, removeFromIndexes, removeFromIndexes`

    - ### Methods inherited from class org.apache.uima.cas.impl.FeatureStructureImpl

      `clone, getavoidcollisionTypeCode, getBooleanValue, getByteValue, getDoubleValue, getFeatureValue, getFeatureValueAsString, getFloatValue, getIntValue, getLongValue, getShortValue, getStringValue, getType, prettyPrint, prettyPrint, prettyPrint, setBooleanValue, setByteValue, setDoubleValue, setFeatureValue, setFeatureValueFromString, setFloatValue, setIntValue, setLongValue, setShortValue, setStringValue, toString, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.uima.cas.AnnotationBaseFS

      `getView`

    - ### Methods inherited from interface org.apache.uima.cas.FeatureStructure

      `clone, equals, getBooleanValue, getByteValue, getCAS, getDoubleValue, getFeatureValue, getFeatureValueAsString, getFloatValue, getIntValue, getLongValue, getShortValue, getStringValue, getType, hashCode, setBooleanValue, setByteValue, setDoubleValue, setFeatureValue, setFeatureValueFromString, setFloatValue, setIntValue, setLongValue, setShortValue, setStringValue`

- - ### Field Detail

    - #### typeIndexID

          public static final int typeIndexID

    - #### type

          public static final int type

  - ### Constructor Detail

    - #### Annotation

          protected Annotation()

    - #### Annotation

          public Annotation(int addr,
                            TOP_Type type)

    - #### Annotation

          public Annotation(JCas jcas)

    - #### 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 Detail

    - #### getTypeIndexID

          public int getTypeIndexID()

      Description copied from class: `TOP`
      used to obtain reference to the TOP_Type instance
      Overrides:
        `getTypeIndexID` in class `AnnotationBase`
      Returns:
        the type array index

    - #### getBegin

          public 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 void setBegin(int v)

    - #### getEnd

          public 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 void setEnd(int v)

    - #### 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:
        String
      See Also:
        `AnnotationFS.getCoveredText()`

    - #### getStart

          @Deprecated
          public int getStart()

      Deprecated. Use `getBegin()` instead.
      Returns:
        the Annotation "begin" feature value

Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.