Class Subiterator<T extends AnnotationFS>

java.lang.Object
org.apache.uima.cas.impl.FSIteratorImplBase<T>
org.apache.uima.cas.impl.Subiterator<T>
All Implemented Interfaces:
Iterator<T>, FSIterator<T>

public class Subiterator<T extends AnnotationFS> extends FSIteratorImplBase<T>
Subiterator implementation. There are two bounding styles and 2 underlying forms. The 2nd form is produced lazily when needed, and is made by a one-time forward traversal to compute unambigious subsets and store them into a list. - The 2nd form is needed only for unambiguous style if backwards or moveto(fs) operation. The 1st form uses the underlying iterator directly, and does skipping as needed, while iterating - going forward: skip if unambigious and start is within prev span skip if strict and end lies outside of scope span - going backward: if unambiguous - convert to form 2 skip if strict and end lies outside of scope span - going to particular fs (left most match) if unambiguous - convert to form 2 skip (forward) if strict and end lies outside of scope span - going to first: unambiguous - no testing needed, no prior span skip if strict and end lies outside of scope span - going to last: unambigious - convert to 2nd form skip backwards if strict and end lies outside of scope span There are two styles of the bounding information. - the traditional one uses the standard comparator for annotations: begin (ascending), end (descending) and type priority ordering - the 2nd style uses just a begin value and an end value, no type priority ordering.
  • Method Details

    • isValid

      public boolean isValid()
      Description copied from interface: FSIterator
      Check if this iterator is valid.
      Returns:
      true if the iterator is valid.
    • get

      public T get() throws NoSuchElementException
      Description copied from interface: FSIterator
      Get the structure the iterator is pointing at.
      Returns:
      The structure the iterator is pointing at.
      Throws:
      NoSuchElementException - If the iterator is not valid.
    • moveToNext

      public void moveToNext()
      Description copied from interface: FSIterator
      Advance the iterator. This may invalidate the iterator.
    • moveToPrevious

      public void moveToPrevious()
      Description copied from interface: FSIterator
      Move the iterator one element back. This may invalidate the iterator.
    • moveToFirst

      public void moveToFirst()
      Description copied from interface: FSIterator
      Move the iterator to the first element. The iterator will be valid iff the underlying collection is non-empty. Allowed even if the underlying indexes being iterated over were modified.
    • moveToLast

      public void moveToLast()
      Description copied from interface: FSIterator
      Move the iterator to the last element. The iterator will be valid iff the underlying collection is non-empty. Allowed even if the underlying indexes being iterated over were modified.
    • moveTo

      public void moveTo(FeatureStructure fs)
      Description copied from interface: FSIterator
      Move the iterator to the first Feature Structure that is equal to fs. First means the earliest one occurring in the index, in case multiple FSs that are "equal" to fs are in the index. If no such feature structure exists in the underlying collection, set the iterator to the "insertion point" for fs, i.e., to a point where the current feature structure is greater than fs, and the previous one is less than fs.

      If the fs is greater than all of the entries in the index, the moveTo cannot set the iterator to an insertion point where the current feature structure is greater than fs, so it marks the iterator "invalid".

      If the underlying index is a bag index, no ordering is present, and the moveTo operation moves to the fs which is the same identical fs as the key. If no such fs is in the index, the iterator is marked invalid.

      Parameters:
      fs - The feature structure the iterator that supplies the comparison information. It must be of type T or a subtype of T.
    • copy

      public FSIterator<T> copy()
      Description copied from interface: FSIterator
      Copy this iterator.
      Returns:
      A copy of this iterator, pointing at the same element.