Interface KeySpan

All Superinterfaces:
Comparable<KeySpan>, Span<Long,KeySpan>
All Known Implementing Classes:
KeySpan.Empty, KeySpan.Impl

public sealed interface KeySpan extends Span<Long,KeySpan> permits KeySpan.Empty, KeySpan.Impl
An interval of database (primary) keys
  • Field Details

  • Method Details

    • sub

      static KeySpan sub(long from, boolean fromInclusive, long to, boolean toInclusive, DirectedIterator.Direction direction)
      Get the span for a sub collection

      from must precede to, unless direction is DirectedIterator.Direction.BACKWARD, in which case the opposite is required. The endpoints may be equal but unless both are inclusive, the result is EMPTY. The two endpoints are not automatically inverted to correct ordering. More often than not, accidental mis-ordering indicates an implementation flaw.

      Parameters:
      from - the lower bound
      fromInclusive - true if the bound includes from
      to - the upper bound
      toInclusive - true if the bound includes to
      direction - the direction, true to swap from and to
      Returns:
      the span
    • head

      static KeySpan head(long to, boolean toInclusive, DirectedIterator.Direction direction)
      Get the span for the head of a collection

      When direction is DirectedIterator.Direction.BACKWARD this behaves as if a tail collection; however, the implication is that iteration will start from the maximum and proceed toward the given bound.

      Parameters:
      to - the upper bound
      toInclusive - true if the bound includes to
      direction - the direction, true to create a tail instead
      Returns:
      the span
    • tail

      static KeySpan tail(long from, boolean fromInclusive, DirectedIterator.Direction direction)
      Get the span for the tail of a collection

      When direction is DirectedIterator.Direction.BACKWARD this behaves as if a head collection; however, the implication is that iteration will start from the bound and proceed toward the minimum.

      Parameters:
      from - the lower bound
      fromInclusive - true if the bound includes to
      direction - the direction, true to create a head instead
      Returns:
      the span
    • closed

      static KeySpan closed(long from, long to)
      Get the span for a closed interval
      Parameters:
      from - the lower endpoint
      to - the upper endpoint
      Returns:
      the interval
      Implementation Notes:
      this is used primarily in testing