Module lmdbjava
Package org.lmdbjava

Enum Class KeyRangeType

java.lang.Object
java.lang.Enum<KeyRangeType>
org.lmdbjava.KeyRangeType
All Implemented Interfaces:
Serializable, Comparable<KeyRangeType>, Constable

public enum KeyRangeType extends Enum<KeyRangeType>
Key range type.

The terminology used in this class is adapted from Google Guava's ranges. Refer to the Ranges Explained wiki page for more information. LmddJava prepends either "FORWARD" or "BACKWARD" to denote the iterator order.

In the examples below, it is assumed the table has keys 2, 4, 6 and 8.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Action now required with the cursor.
    static enum 
    Action now required with the iterator.

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Start on the last key and iterate backward until no keys remain.
    Start on the passed key (or the first key immediately preceding it) and iterate backward until no keys remain.
    Start on the last key and iterate backward until a key equal to it (or the first key immediately preceding it it) is reached.
    Iterate backward between the passed keys, matching on the first keys directly equal to the passed key (or immediately preceding it in the case of the "start" key, or immediately following it in the case of the "stop" key).
    Iterate backward between the passed keys, matching on the first keys directly equal to the passed key (or immediately preceding it in the case of the "start" key, or immediately following it in the case of the "stop" key).
    Start immediate prior to the passed key (but not equal to it) and iterate backward until no keys remain.
    Start on the last key and iterate backward until the last key greater than the passed "stop" key is reached.
    Iterate backward between the passed keys, but do not return the passed keys.
    Iterate backward between the passed keys.
    Starting on the first key and iterate forward until no keys remain.
    Start on the passed key (or the first key immediately after it) and iterate forward until no keys remain.
    Start on the first key and iterate forward until a key equal to it (or the first key immediately after it) is reached.
    Iterate forward between the passed keys, matching on the first keys directly equal to the passed key (or immediately following it in the case of the "start" key, or immediately preceding it in the case of the "stop" key).
    Iterate forward between the passed keys, matching on the first keys directly equal to the passed key (or immediately following it in the case of the "start" key, or immediately preceding it in the case of the "stop" key).
    Start after the passed key (but not equal to it) and iterate forward until no keys remain.
    Start on the first key and iterate forward until a key the passed key has been reached (but do not return that key).
    Iterate forward between the passed keys but not equal to either of them.
    Iterate forward between the passed keys.
  • Method Summary

    Modifier and Type
    Method
    Description
    Determine the iterator action to take when iterator first begins.
    boolean
    Whether the key space is iterated in the order provided by LMDB.
    boolean
    Whether the iteration requires a "start" key.
    boolean
    Whether the iteration requires a "stop" key.
    iteratorOp(T start, T stop, T buffer, C c)
    Determine the iterator's response to the presented key.
    Determine the iterator action to take when "next" is called or upon request of iteratorOp(Object, Object, Object, Comparator) }.
    Returns the enum constant of this class with the specified name.
    static KeyRangeType[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • FORWARD_ALL

      public static final KeyRangeType FORWARD_ALL
      Starting on the first key and iterate forward until no keys remain.

      The "start" and "stop" values are ignored.

      In our example, the returned keys would be 2, 4, 6 and 8.

    • FORWARD_AT_LEAST

      public static final KeyRangeType FORWARD_AT_LEAST
      Start on the passed key (or the first key immediately after it) and iterate forward until no keys remain.

      The "start" value is required. The "stop" value is ignored.

      In our example and with a passed search key of 5, the returned keys would be 6 and 8. With a passed key of 6, the returned keys would be 6 and 8.

    • FORWARD_AT_MOST

      public static final KeyRangeType FORWARD_AT_MOST
      Start on the first key and iterate forward until a key equal to it (or the first key immediately after it) is reached.

      The "stop" value is required. The "start" value is ignored.

      In our example and with a passed search key of 5, the returned keys would be 2 and 4. With a passed key of 6, the returned keys would be 2, 4 and 6.

    • FORWARD_CLOSED

      public static final KeyRangeType FORWARD_CLOSED
      Iterate forward between the passed keys, matching on the first keys directly equal to the passed key (or immediately following it in the case of the "start" key, or immediately preceding it in the case of the "stop" key).

      The "start" and "stop" values are both required.

      In our example and with a passed search range of 3 - 7, the returned keys would be 4 and 6. With a range of 2 - 6, the keys would be 2, 4 and 6.

    • FORWARD_CLOSED_OPEN

      public static final KeyRangeType FORWARD_CLOSED_OPEN
      Iterate forward between the passed keys, matching on the first keys directly equal to the passed key (or immediately following it in the case of the "start" key, or immediately preceding it in the case of the "stop" key). Do not return the "stop" key.

      The "start" and "stop" values are both required.

      In our example and with a passed search range of 3 - 8, the returned keys would be 4 and 6. With a range of 2 - 6, the keys would be 2 and 4.

    • FORWARD_GREATER_THAN

      public static final KeyRangeType FORWARD_GREATER_THAN
      Start after the passed key (but not equal to it) and iterate forward until no keys remain.

      The "start" value is required. The "stop" value is ignored.

      In our example and with a passed search key of 4, the returned keys would be 6 and 8. With a passed key of 3, the returned keys would be 4, 6 and 8.

    • FORWARD_LESS_THAN

      public static final KeyRangeType FORWARD_LESS_THAN
      Start on the first key and iterate forward until a key the passed key has been reached (but do not return that key).

      The "stop" value is required. The "start" value is ignored.

      In our example and with a passed search key of 5, the returned keys would be 2 and 4. With a passed key of 8, the returned keys would be 2, 4 and 6.

    • FORWARD_OPEN

      public static final KeyRangeType FORWARD_OPEN
      Iterate forward between the passed keys but not equal to either of them.

      The "start" and "stop" values are both required.

      In our example and with a passed search range of 3 - 7, the returned keys would be 4 and 6. With a range of 2 - 8, the key would be 4 and 6.

    • FORWARD_OPEN_CLOSED

      public static final KeyRangeType FORWARD_OPEN_CLOSED
      Iterate forward between the passed keys. Do not return the "start" key, but do return the "stop" key.

      The "start" and "stop" values are both required.

      In our example and with a passed search range of 3 - 8, the returned keys would be 4, 6 and 8. With a range of 2 - 6, the keys would be 4 and 6.

    • BACKWARD_ALL

      public static final KeyRangeType BACKWARD_ALL
      Start on the last key and iterate backward until no keys remain.

      The "start" and "stop" values are ignored.

      In our example, the returned keys would be 8, 6, 4 and 2.

    • BACKWARD_AT_LEAST

      public static final KeyRangeType BACKWARD_AT_LEAST
      Start on the passed key (or the first key immediately preceding it) and iterate backward until no keys remain.

      The "start" value is required. The "stop" value is ignored.

      In our example and with a passed search key of 5, the returned keys would be 4 and 2. With a passed key of 6, the returned keys would be 6, 4 and 2. With a passed key of 9, the returned keys would be 8, 6, 4 and 2.

    • BACKWARD_AT_MOST

      public static final KeyRangeType BACKWARD_AT_MOST
      Start on the last key and iterate backward until a key equal to it (or the first key immediately preceding it it) is reached.

      The "stop" value is required. The "start" value is ignored.

      In our example and with a passed search key of 5, the returned keys would be 8 and 6. With a passed key of 6, the returned keys would be 8 and 6.

    • BACKWARD_CLOSED

      public static final KeyRangeType BACKWARD_CLOSED
      Iterate backward between the passed keys, matching on the first keys directly equal to the passed key (or immediately preceding it in the case of the "start" key, or immediately following it in the case of the "stop" key).

      The "start" and "stop" values are both required.

      In our example and with a passed search range of 7 - 3, the returned keys would be 6 and 4. With a range of 6 - 2, the keys would be 6, 4 and 2. With a range of 9 - 3, the returned keys would be 8, 6 and 4.

    • BACKWARD_CLOSED_OPEN

      public static final KeyRangeType BACKWARD_CLOSED_OPEN
      Iterate backward between the passed keys, matching on the first keys directly equal to the passed key (or immediately preceding it in the case of the "start" key, or immediately following it in the case of the "stop" key). Do not return the "stop" key.

      The "start" and "stop" values are both required.

      In our example and with a passed search range of 8 - 3, the returned keys would be 8, 6 and 4. With a range of 7 - 2, the keys would be 6 and 4. With a range of 9 - 3, the keys would be 8, 6 and 4.

    • BACKWARD_GREATER_THAN

      public static final KeyRangeType BACKWARD_GREATER_THAN
      Start immediate prior to the passed key (but not equal to it) and iterate backward until no keys remain.

      The "start" value is required. The "stop" value is ignored.

      In our example and with a passed search key of 6, the returned keys would be 4 and 2. With a passed key of 7, the returned keys would be 6, 4 and 2. With a passed key of 9, the returned keys would be 8, 6, 4 and 2.

    • BACKWARD_LESS_THAN

      public static final KeyRangeType BACKWARD_LESS_THAN
      Start on the last key and iterate backward until the last key greater than the passed "stop" key is reached. Do not return the "stop" key.

      The "stop" value is required. The "start" value is ignored.

      In our example and with a passed search key of 5, the returned keys would be 8 and 6. With a passed key of 2, the returned keys would be 8, 6 and 4

    • BACKWARD_OPEN

      public static final KeyRangeType BACKWARD_OPEN
      Iterate backward between the passed keys, but do not return the passed keys.

      The "start" and "stop" values are both required.

      In our example and with a passed search range of 7 - 2, the returned keys would be 6 and 4. With a range of 8 - 1, the keys would be 6, 4 and 2. With a range of 9 - 4, the keys would be 8 and 6.

    • BACKWARD_OPEN_CLOSED

      public static final KeyRangeType BACKWARD_OPEN_CLOSED
      Iterate backward between the passed keys. Do not return the "start" key, but do return the "stop" key.

      The "start" and "stop" values are both required.

      In our example and with a passed search range of 7 - 2, the returned keys would be 6, 4 and 2. With a range of 8 - 4, the keys would be 6 and 4. With a range of 9 - 4, the keys would be 8, 6 and 4.

  • Method Details

    • values

      public static KeyRangeType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static KeyRangeType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isDirectionForward

      public boolean isDirectionForward()
      Whether the key space is iterated in the order provided by LMDB.
      Returns:
      true if forward, false if reverse
    • isStartKeyRequired

      public boolean isStartKeyRequired()
      Whether the iteration requires a "start" key.
      Returns:
      true if start key must be non-null
    • isStopKeyRequired

      public boolean isStopKeyRequired()
      Whether the iteration requires a "stop" key.
      Returns:
      true if stop key must be non-null
    • initialOp

      public KeyRangeType.CursorOp initialOp()
      Determine the iterator action to take when iterator first begins.

      The iterator will perform this action and present the resulting key to iteratorOp(Object, Object, Object, Comparator) for decision.

      Returns:
      appropriate action in response to this buffer
    • iteratorOp

      public <T, C extends Comparator<T>> KeyRangeType.IteratorOp iteratorOp(T start, T stop, T buffer, C c)
      Determine the iterator's response to the presented key.
      Type Parameters:
      T - buffer type
      C - comparator for the buffers
      Parameters:
      start - start buffer
      stop - stop buffer
      buffer - current key returned by LMDB (may be null)
      c - comparator (required)
      Returns:
      response to this key
    • nextOp

      public KeyRangeType.CursorOp nextOp()
      Determine the iterator action to take when "next" is called or upon request of iteratorOp(Object, Object, Object, Comparator) }.

      The iterator will perform this action and present the resulting key to iteratorOp(Object, Object, Object, Comparator) for decision.

      Returns:
      appropriate action for this key range type