org.apache.uima.cas.text

## Interface AnnotationFS

- All Superinterfaces:
    AnnotationBaseFS, Cloneable, FeatureStructure
  All Known Subinterfaces:
    AnnotationImpl
  All Known Implementing Classes:
    Annotation, DocumentAnnotation, SourceDocumentInformation

      public interface AnnotationFS
      extends AnnotationBaseFS

  Interface for Annotation Feature Structures.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default boolean` | `coveredBy(AnnotationFS aOther)`
    `default boolean` | `coveredBy(int aBegin, int aEnd)`
    `default boolean` | `covering(AnnotationFS aOther)`
    `default boolean` | `covering(int aBegin, int aEnd)`
    `default boolean` | `following(AnnotationFS aOther)`
    `default boolean` | `following(int aBegin, int aEnd)`
    `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.
    `default boolean` | `overlapping(AnnotationFS aOther)`
    `default boolean` | `overlapping(int aBegin, int aEnd)`
    `default boolean` | `overlappingAtBegin(AnnotationFS aOther)`
    `default boolean` | `overlappingAtBegin(int aBegin, int aEnd)`
    `default boolean` | `overlappingAtEnd(AnnotationFS aOther)`
    `default boolean` | `overlappingAtEnd(int aBegin, int aEnd)`
    `default boolean` | `preceding(AnnotationFS aOther)`
    `default boolean` | `preceding(int aBegin, int aEnd)`
    `void` | `setBegin(int begin)` Set the start position of the annotation as character offset into the text.
    `void` | `setEnd(int end)` Set the end position of the annotation as character offset into the text.
    `default void` | `trim()` Strips leading and trailing whitespace by increasing/decreasing the begin/end offsets.
    `void` | `trim(IntPredicate aPredicate)` Strips leading and trailing characters matching the given predicate by increasing/decreasing the begin/end offsets.

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

      `getView`

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

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

- - ### Method Detail

    - #### getBegin

          int getBegin()

      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.
      Returns:
        The start position.

    - #### getEnd

          int getEnd()

      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()`.
      Returns:
        The end position.

    - #### setBegin

          void setBegin(int begin)

      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.
      Parameters:
        `begin` - The start position.

    - #### setEnd

          void setEnd(int end)

      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()`.
      Parameters:
        `end` - The end position position.

    - #### getCoveredText

          String getCoveredText()

      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()))`.
      Returns:
        the covered text.

    - #### trim

          default void trim()

      Strips leading and trailing whitespace by increasing/decreasing the begin/end offsets. This method is aware of Unicode codepoints. It expects that the begin/end offsets point to valid codepoints.

    - #### trim

          void trim(IntPredicate aPredicate)

      Strips leading and trailing characters matching the given predicate by increasing/decreasing the begin/end offsets.
      Parameters:
        `aPredicate` - the predicate used to identify whether a given codepoint is whitespace.
      See Also:
        `trim()`

    - #### covering

          default boolean covering(int aBegin,
                                   int aEnd)

      See Also:
        `AnnotationPredicates.covering(AnnotationFS, AnnotationFS)`

    - #### covering

          default boolean covering(AnnotationFS aOther)

      See Also:
        `AnnotationPredicates.covering(AnnotationFS, AnnotationFS)`

    - #### coveredBy

          default boolean coveredBy(int aBegin,
                                    int aEnd)

      See Also:
        `AnnotationPredicates.coveredBy(AnnotationFS, AnnotationFS)`

    - #### coveredBy

          default boolean coveredBy(AnnotationFS aOther)

      See Also:
        `AnnotationPredicates.coveredBy(AnnotationFS, AnnotationFS)`

    - #### overlapping

          default boolean overlapping(int aBegin,
                                      int aEnd)

      See Also:
        `AnnotationPredicates.overlapping(AnnotationFS, AnnotationFS)`

    - #### overlapping

          default boolean overlapping(AnnotationFS aOther)

      See Also:
        `AnnotationPredicates.overlapping(AnnotationFS, AnnotationFS)`

    - #### overlappingAtBegin

          default boolean overlappingAtBegin(int aBegin,
                                             int aEnd)

      See Also:
        `AnnotationPredicates.overlappingAtBegin(AnnotationFS, AnnotationFS)`

    - #### overlappingAtBegin

          default boolean overlappingAtBegin(AnnotationFS aOther)

      See Also:
        `AnnotationPredicates.overlappingAtBegin(AnnotationFS, AnnotationFS)`

    - #### overlappingAtEnd

          default boolean overlappingAtEnd(int aBegin,
                                           int aEnd)

      See Also:
        `AnnotationPredicates.overlappingAtEnd(AnnotationFS, AnnotationFS)`

    - #### overlappingAtEnd

          default boolean overlappingAtEnd(AnnotationFS aOther)

      See Also:
        `AnnotationPredicates.overlappingAtEnd(AnnotationFS, AnnotationFS)`

    - #### following

          default boolean following(int aBegin,
                                    int aEnd)

      See Also:
        `AnnotationPredicates.following(AnnotationFS, AnnotationFS)`

    - #### following

          default boolean following(AnnotationFS aOther)

      See Also:
        `AnnotationPredicates.following(AnnotationFS, AnnotationFS)`

    - #### preceding

          default boolean preceding(int aBegin,
                                    int aEnd)

      See Also:
        `AnnotationPredicates.preceding(AnnotationFS, AnnotationFS)`

    - #### preceding

          default boolean preceding(AnnotationFS aOther)

      See Also:
        `AnnotationPredicates.preceding(AnnotationFS, AnnotationFS)`

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