Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.1.1SDK
-
None
-
None
Description
select.following() on a zero-width annotation returns other zero-width annotation at same location. The following test fails:
@Test
public void thatSelectFollowingDoesNotFindOtherZeroWidthAnnotationAtSameLocation()
{
Annotation a1 = cas.createAnnotation(cas.getAnnotationType(), 10, 10);
Annotation a2 = cas.createAnnotation(cas.getAnnotationType(), 10, 10);
asList(a1, a2).forEach(cas::addFsToIndexes);
List<Annotation> selection = cas.select(Annotation.class)
.following(a1)
.asList();
assertThat(selection)
.isEmpty();
}
In this case, a2 should not be considered as "following" a1 - it is not following, it is at the very same location.
Strictly speaking, the code does what the documentation of following says:
For AnnotationIndex, position to first Annotation whose begin <= fs.getEnd();
In this case, a2.getBegin() == fs.getEnd(). However, I believe it is an edge-case that was not considered when the documentation was written and the intended behavior should be that annotations that are at exactly the same position should never be considered to be following or preceding each other.
Attachments
Issue Links
- links to