Class ComplementRangeIterator

java.lang.Object
io.deephaven.engine.rowset.impl.ComplementRangeIterator
All Implemented Interfaces:
RowSet.RangeIterator, SafeCloseable, AutoCloseable

public class ComplementRangeIterator extends Object implements RowSet.RangeIterator
An iterator for the complement set over an universe of [0, Long.MAX_VALUE].
  • Constructor Details

  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface RowSet.RangeIterator
      Specified by:
      close in interface SafeCloseable
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface RowSet.RangeIterator
    • advance

      public boolean advance(long v)
      Description copied from interface: RowSet.RangeIterator

      Advance the current iterator position until currentRangeStart() and currentRangeEnd() are both greater than or equal to v. This may or may not move the iterator to the next range: if v is inside the current range (but to the right of currentRangeStart(), this will simply advance currentRangeStart(). Returns true if the operation was successful. Otherwise, returns false. In this case the iteration is over and the iterator is exhausted (calls to hasNext() will return false, any other operation is undefined).

      Although calls to advance() may be interleaved with calls to hasNext()/next() if necessary, this is not the common case, as they are separate protocols having little to do with each other. In particular, when iterating with advance(), you do not use next() to bring the next range into view, even at the start of the iteration. Many common usages only involve calls to advance().

      Example:

       {
           @code
           RangeIterator it = rowSet.getRangeIterator();
           if (!it.advance(100)) {
               return; // iteration done... no ranges at 100 or greater
           }
           assert (it.currentRangeStart() >= 100 && it.currentRangeEnd() >= 100);
           // do something with range
           if (!it.advance(500)) {
               return; // iteration done... no ranges at 500 or greater
           }
           assert (it.currentRangeStart() >= 500 && it.currentRangeEnd() >= 500);
           // do something with range
       }
       
      Specified by:
      advance in interface RowSet.RangeIterator
      Parameters:
      v - a value to search forward from the current iterator position
      Returns:
      false if iteration is exhausted, otherwise true.
    • postpone

      public void postpone(long v)
      Description copied from interface: RowSet.RangeIterator
      Given an iterator state with a current range of [start, end], and a value v such that start <= v <= end, postpone(v) makes the iterator current range [v, end]. This call is useful to code that may need to process parts of ranges from different call sites from the site iterator. The results of this call are undefined if the value provided is not contained in the current range.
      Specified by:
      postpone in interface RowSet.RangeIterator
      Parameters:
      v - A value contained in the current iterator range
    • currentRangeStart

      public long currentRangeStart()
      Specified by:
      currentRangeStart in interface RowSet.RangeIterator
    • currentRangeEnd

      public long currentRangeEnd()
      Specified by:
      currentRangeEnd in interface RowSet.RangeIterator
    • next

      public long next()
      Specified by:
      next in interface RowSet.RangeIterator