Package org.apache.uima.cas.text
Interface AnnotationFS
- All Superinterfaces:
AnnotationBaseFS
,Cloneable
,FeatureStructure
- All Known Subinterfaces:
AnnotationImpl
- All Known Implementing Classes:
Annotation
,DocumentAnnotation
,SourceDocumentInformation
Interface for Annotation Feature Structures.
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
coveredBy
(int aBegin, int aEnd) default boolean
coveredBy
(AnnotationFS aOther) default boolean
covering
(int aBegin, int aEnd) default boolean
covering
(AnnotationFS aOther) default boolean
following
(int aBegin, int aEnd) default boolean
following
(AnnotationFS aOther) int
getBegin()
Get the start position of the annotation as character offset into the text.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
(int aBegin, int aEnd) default boolean
overlapping
(AnnotationFS aOther) default boolean
overlappingAtBegin
(int aBegin, int aEnd) default boolean
overlappingAtBegin
(AnnotationFS aOther) default boolean
overlappingAtEnd
(int aBegin, int aEnd) default boolean
overlappingAtEnd
(AnnotationFS aOther) default boolean
preceding
(int aBegin, int aEnd) default boolean
preceding
(AnnotationFS aOther) 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 Details
-
getBegin
int getBegin()Get the start position of the annotation as character offset into the text. The smallest possible start position is0
, 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 is0
, 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. IfdocText
is your document text andannot
an annotation, thenannot.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
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:
-
covering
default boolean covering(int aBegin, int aEnd) -
covering
-
coveredBy
default boolean coveredBy(int aBegin, int aEnd) -
coveredBy
-
overlapping
default boolean overlapping(int aBegin, int aEnd) -
overlapping
-
overlappingAtBegin
default boolean overlappingAtBegin(int aBegin, int aEnd) -
overlappingAtBegin
-
overlappingAtEnd
default boolean overlappingAtEnd(int aBegin, int aEnd) -
overlappingAtEnd
-
following
default boolean following(int aBegin, int aEnd) -
following
-
preceding
default boolean preceding(int aBegin, int aEnd) -
preceding
-