Interface LastPositionFinder

All Known Implementing Classes:
ARegexIterator, ArrayIterator, ArrayIterator.Of, ArrayIterator.OfNodes, AscendingRangeIterator, BigRangeIterator, DescendingRangeIterator, EmptyIterator, FocusTrackingIterator, GroupAdjacentIterator, GroupByIterator, GroupEndingIterator, GroupMatchingIterator, GroupStartingIterator, ItemCheckingIterator, ItemMappingIterator, JRegexIterator, ListIterator, ListIterator.Of, ListIterator.OfAtomic, ManualGroupIterator, ManualIterator, ManualRegexIterator, MemoSequence.ProgressiveIterator, MergeGroupingIterator, MultiIndex.SelectedItemsIterator, MultithreadedFocusTrackingIterator, MultithreadedItemMappingIterator, NodeListIterator, Remove.RemoveIterator, ReportingSingletonIterator, Reverse.ReverseListIterator, SingleAtomicIterator, SingleNodeIterator, SingletonIterator, SortedGroupIterator, SortedIterator, SubsequenceIterator, TailIterator, TwoItemIterator, UntypedAtomizingIterator, ZenoSequence.ZenoSequenceIterator

public interface LastPositionFinder
A LastPositionFinder is an interface implemented by any SequenceIterator that is able to return the position of the last item in the sequence.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the last position (that is, the number of items in the sequence).
    boolean
    Ask whether this iterator supports use of the getLength() method.
  • Method Details

    • supportsGetLength

      boolean supportsGetLength()
      Ask whether this iterator supports use of the getLength() method. This method should always be called before calling getLength(), because an iterator that implements this interface may support use of getLength() in some situations and not in others
      Returns:
      true if the getLength() method can be called to determine the length of the underlying sequence.
    • getLength

      int getLength()
      Get the last position (that is, the number of items in the sequence). This method is non-destructive: it does not change the state of the iterator. The result is undefined if the next() method of the iterator has already returned null. This method must not be called unless the supportsGetLength() has been called and has returned true.
      Returns:
      the number of items in the sequence
      Throws:
      UncheckedXPathException - if an error occurs evaluating the sequence in order to determine the number of items
      ClassCastException - if the capability is not available. (This exception is not guaranteed.)