Moving iterator beyond bounds does not invalidate it
Only check bounds if iterator is valid
@@ -873,6 +873,10 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
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) {
@@ -898,15 +902,13 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
}
}
- // 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() && equalToBounds(it.getNvc())) {
+ if (equalToBounds(it.getNvc())) {
it.moveToNext();
if (!it.isValid()) {
it.moveToLastNoReinit();
}
}
+ }
switch (boundsUse) {
case sameBeginEnd:
