Class IndexRangeIteratorView

All Implemented Interfaces:
RangeIterator, SearchRangeIterator

public class IndexRangeIteratorView
extends Object
implements SearchRangeIterator
  • Constructor Details

    • IndexRangeIteratorView

      public IndexRangeIteratorView​(RowSet.RangeIterator it, long offset, long rangesEnd)
  • Method Details

    • hasNext

      public boolean hasNext()
      Description copied from interface: RangeIterator
      Checks if the iterator has more ranges. If hasNext() returns false, calling next thereafter results in undefined behavior.
      Specified by:
      hasNext in interface RangeIterator
      whether there is another range.
    • start

      public int start()
      Description copied from interface: RangeIterator
      Start of the current range.

      Calling start() without calling next() at least once results in undefined behavior.

      Specified by:
      start in interface RangeIterator
      the start of the current range.
    • end

      public int end()
      Description copied from interface: RangeIterator
      End of the current range (exclusive).

      Calling end() without calling next() at least once results in undefined behavior.

      Specified by:
      end in interface RangeIterator
      the end of the current range (exclusive).
    • next

      public void next()
      Description copied from interface: RangeIterator
      Advance the iterator to the next range. Only call after hasNext() has returned true.
      Specified by:
      next in interface RangeIterator
    • advance

      public boolean advance​(int v)
      Description copied from interface: SearchRangeIterator

      Advance the iterator position forward until the current range end's (exclusive) position is bigger (not equal) than the argument, or the iterator is exhausted. Note this should find a range that either contains the argument or, if there is no such a range, is the first range in the iterator after the argument. If a range containing the argument is found, and its start position is less than the argument, start is updated to the argument value.

      If no satisfying range is found, false is returned, and any subsequent call to hasNext returns false. Otherwise true is returned and the current range is updated

      Note the iterator is invalidated (exhausted) when this method returns false: there is no guarantee as to where the start and end positions are left in this case). Calling hasNext() on an invalidated iterator is guaranteed to return false; any other method call results in undefined behavior.

      Specified by:
      advance in interface SearchRangeIterator
      v - a value to search for starting from the current iterator position, which must be a valid one on entry.
      true if a range satisfying the constraints is found, false if the iterator was exhausted.
    • search

      public boolean search​(ContainerUtil.TargetComparator comp)
      Description copied from interface: SearchRangeIterator

      Advance the current iterator (start) position while the current value maintains comp.directionFrom(v) > 0. If next to the last such value there is a value for which comp.directionFrom(v) < 0, or no further values exist, then that last value satisfying comp,.directionFrom(v) > 0 is left as the current position and true is returned. If there are any elements for which comp.directionFrom(v) == 0, one of such elements, no guarantee which one, is left as the current position and true is returned. If at the call entry, the next range starts at a point where comp.directionFrom(v) < 0, false is returned and the current position is not moved.

      Note the iterator may not move if at the time of the call, the iterator's current range start position satisfies comp.directionFrom(v) >= 0 and there is no other value in the iterator that does.

      Part of the contract of this method is that comp.directionFrom will only be called with values that are in the underlying container.

      Specified by:
      search in interface SearchRangeIterator
      comp - a comparator used to search forward from the current iterator position
      false if the target was to the left of the initial position at the time of the call (iterator not changed); true otherwise. In the true case the current position is guaranteed to satisfy comp.directionFrom(v) >= 0 and if also comp.directionFrom(v) > 0, then v is the biggest such value for which comp.directionFrom(v) > 0. If there are multiple values for which comp.directionFrom(v) == 0, there is no guarantee as of which one will be left as current iterator position.
    • underlyingIterFinished

      public boolean underlyingIterFinished()