in uimaj-core/src/main/java/org/apache/uima/cas/impl/SelectFSs_impl.java [574:637]
private void prepareTerminalOp() {
if (boundsUse == null) {
boundsUse = BoundsUse.notBounded;
}
maybeValidateAltSource();
final boolean isUseAnnotationIndex = ((index != null) && (index instanceof AnnotationIndex))
|| isNonOverlapping ||
// isPositionUsesType || REMOVED see https://issues.apache.org/jira/browse/UIMA-5536
isTypePriority || isIncludeAnnotBeyondBounds || boundsUse != BoundsUse.notBounded
|| isFollowing || isPreceding;
if (isUseAnnotationIndex) {
forceAnnotationIndex(); // throws if non-null index not an annotation index
}
// REMOVED see https://issues.apache.org/jira/browse/UIMA-5536
// if (isTypePriority) {
// isPositionUsesType = true;
// }
if (ti == null) {
if (index != null) {
ti = (TypeImpl) index.getType();
}
} else {
// type is specified
if (index != null) {
if (((TypeImpl) index.getType()).subsumes(ti)) {
index = ((LowLevelIndex) index).getSubIndex(ti);
}
} else {
if (ti.isAnnotationType() && !isAltSource) {
forceAnnotationIndex(); // when index is null, but ti is not null and is annotation
}
}
}
if (isUseAnnotationIndex && null == ti) {
ti = (TypeImpl) view.getAnnotationType();
}
if (ti == null) {
ti = view.getTypeSystemImpl().getTopType();
}
if (boundsUse == BoundsUse.covering) {
isIncludeAnnotBeyondBounds = true;
}
// force ordering
boolean orderingNeeded = !isUnordered || shift != 0 || boundsUse != BoundsUse.notBounded
|| isFollowing || isPreceding;
isUnordered = !orderingNeeded;
// If there is a boundary for the selection start and the shift would try to cross this
// boundary, it would result in an invalid iterator causing the selection operation to return
// an empty result. To avoid this potentially surprising behavior, reduce the shift to 0 in
// such a case.
if ((isFollowing || isPreceding || boundsUse != BoundsUse.notBounded) && shift < 0) {
shift = 0;
}
}