Interface RangeIterator

All Known Subinterfaces:
SearchRangeIterator
All Known Implementing Classes:
IndexRangeIteratorView, RangeIterator.ArrayBacked, RangeIterator.Single, RspRangeIterator.RangeIteratorView, SingletonContainer.SearchRangeIter

public interface RangeIterator
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
     
    static class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    end()
    End of the current range (exclusive).
    default boolean
    Call accept on the provided AbortableRangeConsumer until it returns false or we run out of values.
    boolean
    Checks if the iterator has more ranges.
    void
    Advance the iterator to the next range.
    default int
    next(short[] buffer, int offset, int maxRanges)
    Get the next batch of ranges.
    int
    Start of the current range.
  • Method Details

    • hasNext

      boolean hasNext()
      Checks if the iterator has more ranges. If hasNext() returns false, calling next thereafter results in undefined behavior.
      Returns:
      whether there is another range.
    • start

      int start()
      Start of the current range.

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

      Returns:
      the start of the current range.
    • end

      int end()
      End of the current range (exclusive).

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

      Returns:
      the end of the current range (exclusive).
    • next

      void next()
      Advance the iterator to the next range. Only call after hasNext() has returned true.
    • forEachRange

      default boolean forEachRange(AbortableRangeConsumer rc)
      Call accept on the provided AbortableRangeConsumer until it returns false or we run out of values.
      Parameters:
      rc - An AbortableRangeConsumer to feed ranges to.
      Returns:
      false if AbortableRangeConsumer returned false at any point, true otherwise.
    • next

      default int next(short[] buffer, int offset, int maxRanges)
      Get the next batch of ranges.
      Parameters:
      buffer - a short array where consecutive pairs of (start, end-1) values will be stored.
      offset - where in buffer to start storing range boundary values.
      maxRanges - maximum number of ranges that can be written to buffer; buffer should have at least space for 2*maxRanges shorts starting at offset.
      Returns:
      how many ranges were written in buffer; this is two times the individual elements written.