RangeIterator (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.index.sasi.utils

## Class RangeIterator<K extends java.lang.Comparable<K>,T extends CombinedValue<K>>

- java.lang.Object
- - org.apache.cassandra.index.sasi.utils.AbstractIterator<T>
  - - org.apache.cassandra.index.sasi.utils.RangeIterator<K,T>

- All Implemented Interfaces:
    com.google.common.collect.PeekingIterator<T>, java.io.Closeable, java.lang.AutoCloseable, java.util.Iterator<T>
  Direct Known Subclasses:
    KeyRangeIterator, OnDiskIndexIterator, Operation, RangeIntersectionIterator.BounceIntersectionIterator, RangeIntersectionIterator.LookupIntersectionIterator, RangeIterator.Builder.EmptyRangeIterator, RangeUnionIterator, TermIterator, TokenTree.TokenTreeIterator

      public abstract class RangeIterator<K extends java.lang.Comparable<K>,T extends CombinedValue<K>>
      extends AbstractIterator<T>
      implements java.io.Closeable

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `RangeIterator.Builder<K extends java.lang.Comparable<K>,D extends CombinedValue<K>>`

    - ### Nested classes/interfaces inherited from class org.apache.cassandra.index.sasi.utils.AbstractIterator

      `AbstractIterator.State`

  - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.index.sasi.utils.AbstractIterator

      `next, state`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `RangeIterator(K min, K max, long count)`
    `protected` | `RangeIterator(RangeIterator.Builder.Statistics<K,T> statistics)`
    `` | `RangeIterator(RangeIterator<K,T> range)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getCount()`
    `K` | `getCurrent()`
    `K` | `getMaximum()`
    `K` | `getMinimum()`
    `protected static <K extends java.lang.Comparable<K>,D extends CombinedValue<K>> boolean` | `isOverlapping(K min, K max, RangeIterator<K,D> b)` Ranges are overlapping the following cases: * When they have a common subrange: min b.current max b.max +---------|--------------+------------| b.current min max b.max |--------------+---------+------------| min b.current b.max max +----------|-------------|------------+ If either range is empty, they're disjoint.
    `protected static <K extends java.lang.Comparable<K>,D extends CombinedValue<K>> boolean` | `isOverlapping(RangeIterator<K,D> a, RangeIterator<K,D> b)`
    `protected abstract void` | `performSkipTo(K nextToken)`
    `protected T` | `recomputeNext()`
    `T` | `skipTo(K nextToken)` When called, this iterators current position should be skipped forwards until finding either: 1) an element equal to or bigger than next 2) the end of the iterator
    `protected boolean` | `tryToComputeNext()`

    - ### Methods inherited from class org.apache.cassandra.index.sasi.utils.AbstractIterator

      `computeNext, endOfData, hasNext, next, peek, remove`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.io.Closeable

      `close`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining`

- - ### Constructor Detail

    - #### RangeIterator

          protected RangeIterator(RangeIterator.Builder.Statistics<K,T> statistics)

    - #### RangeIterator

          public RangeIterator(RangeIterator<K,T> range)

    - #### RangeIterator

          public RangeIterator(K min,
                               K max,
                               long count)

  - ### Method Detail

    - #### getMinimum

          public final K getMinimum()

    - #### getCurrent

          public final K getCurrent()

    - #### getMaximum

          public final K getMaximum()

    - #### getCount

          public final long getCount()

    - #### skipTo

          public final T skipTo(K nextToken)

      When called, this iterators current position should be skipped forwards until finding either: 1) an element equal to or bigger than next 2) the end of the iterator
      Parameters:
        `nextToken` - value to skip the iterator forward until matching
      Returns:
        The next current token after the skip was performed

    - #### performSkipTo

          protected abstract void performSkipTo(K nextToken)

    - #### recomputeNext

          protected T recomputeNext()

    - #### tryToComputeNext

          protected boolean tryToComputeNext()

      Overrides:
        `tryToComputeNext` in class `AbstractIterator<T extends CombinedValue<K>>`

    - #### isOverlapping

          protected static <K extends java.lang.Comparable<K>,D extends CombinedValue<K>> boolean isOverlapping(RangeIterator<K,D> a,
                                                                                                                RangeIterator<K,D> b)

    - #### isOverlapping

          protected static <K extends java.lang.Comparable<K>,D extends CombinedValue<K>> boolean isOverlapping(K min,
                                                                                                                K max,
                                                                                                                RangeIterator<K,D> b)

      Ranges are overlapping the following cases: * When they have a common subrange: min b.current max b.max +---------|--------------+------------| b.current min max b.max |--------------+---------+------------| min b.current b.max max +----------|-------------|------------+ If either range is empty, they're disjoint.

Copyright © 2018 The Apache Software Foundation