Interface SingleRangeMixin

All Superinterfaces:
AutoCloseable, LongSizedDataStructure, OrderedKeys, SafeCloseable
All Known Implementing Classes:
SingleRangeOrderedKeys

public interface SingleRangeMixin
extends OrderedKeys
This interface is really a mixin to avoid code duplication in the classes that implement it.
  • Method Details

    • forEachLong

      default boolean forEachLong​(LongAbortableConsumer lc)
      Description copied from interface: OrderedKeys
      For as long as the consumer wants more keys, call accept on the consumer with the individual key instances in this OrderedKeys, in increasing order.
      Specified by:
      forEachLong in interface OrderedKeys
      Parameters:
      lc - a consumer to feed the individual key values to.
      Returns:
      false if the consumer provided ever returned false, true otherwise.
    • forEachLongRange

      default boolean forEachLongRange​(LongRangeAbortableConsumer larc)
      Description copied from interface: OrderedKeys
      For as long as the consumer wants more ranges, call accept on the consumer with the individual key ranges in this OrderedKeys, in increasing order.
      Specified by:
      forEachLongRange in interface OrderedKeys
      Parameters:
      larc - a consumer to feed the individual key values to.
      Returns:
      false if the consumer provided ever returned false, true otherwise.
    • getOrderedKeysByPosition

      default OrderedKeys getOrderedKeysByPosition​(long startPositionInclusive, long length)
      Description copied from interface: OrderedKeys

      Get an ordered subset of the keys in this OrderedKeys for a position range. The result will contain the set of keys in this that lie at positions in the half-open range [startPositionInclusive, startPositionInclusive + length). The returned reference is owned by the caller, who should call close() when it is done with it.

      Specified by:
      getOrderedKeysByPosition in interface OrderedKeys
      Parameters:
      startPositionInclusive - The position of the first key to include
      length - The number of keys to include
      Returns:
      The subset as an OrderedKeys, which may be this
    • getOrderedKeysByKeyRange

      default OrderedKeys getOrderedKeysByKeyRange​(long startKeyInclusive, long endKeyInclusive)
      Description copied from interface: OrderedKeys

      Get an ordered subset of the keys in this OrderedKeys for a key range. The returned set will be the intersection of the keys in this with the keys in the closed interval [startKeyInclusive, endKeyInclusive]. The returned reference is owned by the caller, who should call close() when it is done with it.

      Specified by:
      getOrderedKeysByKeyRange in interface OrderedKeys
      Parameters:
      startKeyInclusive - The minimum key to include
      endKeyInclusive - The maximum key to include
      Returns:
      The subset as an OrderedKeys, which may be this
    • getOrderedKeysIterator

      default OrderedKeys.Iterator getOrderedKeysIterator()
      Description copied from interface: OrderedKeys
      Get an OrderedKeys.Iterator over this OrderedKeys.
      Specified by:
      getOrderedKeysIterator in interface OrderedKeys
      Returns:
      A new iterator, positioned at the first key
    • rangesCountUpperBound

      default long rangesCountUpperBound()
    • getAverageRunLengthEstimate

      default long getAverageRunLengthEstimate()
      Description copied from interface: OrderedKeys

      Get an estimate of the average (mean) length of runs of adjacent keys in this OrderedKeys.

      Implementations should strive to keep this method efficient (O(1) preferred) at the expense of accuracy.

      Empty OrderedKeys should return an arbitrary valid value, usually 1.

      Specified by:
      getAverageRunLengthEstimate in interface OrderedKeys
      Returns:
      An estimate of the average run length in this OrderedKeys, in [1, size()]
    • isContiguous

      default boolean isContiguous()
      Description copied from interface: OrderedKeys
      Helper to tell you if this is one contiguous range.
      Specified by:
      isContiguous in interface OrderedKeys
    • size

      long size()
      Description copied from interface: OrderedKeys
      Get the number of keys in this OrderedKeys.
      Specified by:
      size in interface LongSizedDataStructure
      Specified by:
      size in interface OrderedKeys
      Returns:
      The size, in [0, Long.MAX_VALUE]
    • rangeStart

      long rangeStart()
    • rangeEnd

      long rangeEnd()