in uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java [882:983]
private void moveTo_iterators(FeatureStructure fs, boolean initialPositioning) {
it.moveToNoReinit(fs);
// CASE: If the iterator is pointing on the bounds annotation, we must first skip this in
// forward direction to ensure we find a potentially matching FSes occurring in the indexes
// after the bounds annotation.
if (it.isValid()) {
// Check if the move went outside the bounds
if (!initialPositioning) {
switch (boundsUse) {
case covering:
if (is_beyond_bounds_chk_coveringNvc()) {
return;
}
break;
case coveredBy:
if (is_beyond_bounds_chk_coveredByNvc()) {
return;
}
break;
case sameBeginEnd:
if (is_beyond_bounds_chk_sameBeginEnd()) {
return;
}
break;
case notBounded:
default:
// No check necessary
break;
}
}
if (equalToBounds(it.getNvc())) {
it.moveToNext();
if (!it.isValid()) {
it.moveToLastNoReinit();
}
}
}
switch (boundsUse) {
case sameBeginEnd:
maybeAdjustForAmbiguityAndIgnoringTypePriorities_forward(!initialPositioning);
if (it.isValid()) {
// no need for mimic position if type priorities are in effect; moveTo will either
// find equal match and position to left most of the equal, including types, or
// not find equal match and position to next greater one, which won't match next test
if (is_beyond_bounds_chk_sameBeginEnd()) {
isEmpty = true; // iterator was made invalid
return;
}
// skip over bounding annotation
while (equalToBounds(it.getNvc())) {
it.moveToNextNvc();
if (is_beyond_bounds_chk_sameBeginEnd()) {
return;
}
}
}
return; // skip setting prev end - not used for sameBeginEnd
case coveredBy:
maybeAdjustForAmbiguityAndIgnoringTypePriorities_forward(!initialPositioning);
// If an annotation is present (found), position is on it, and if not,
// position is at the next annotation that is higher than (or invalid, if there
// is none). Note that the next found position could be beyond the end.
if (it.isValid()) {
// skip over bounding annotation
while (equalToBounds(it.getNvc())) {
it.moveToNextNvc();
if (!it.isValid()) {
return;
}
}
// adjust for strict
if (adjustForStrictNvc_forward()) {
if (is_beyond_bounds_chk_coveredByNvc()) { // is beyond end iff annot.begin > boundEnd
return; // iterator became invalid
}
}
}
break;
case covering:
if (it.isValid()) {
adjustForCovering_forward();
}
is_beyond_bounds_chk_covering(); // make invalid if ran off end
return; // skip setting prev end - not used for covering;
case notBounded:
default:
if (!it.isValid()) {
return;
}
break;
}
maybeSetPrevBounds(); // used for unambiguous
}