Enum KeyRangeType
- java.lang.Object
-
- java.lang.Enum<KeyRangeType>
-
- org.lmdbjava.KeyRangeType
-
- All Implemented Interfaces:
Serializable
,Comparable<KeyRangeType>
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.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BACKWARD_ALL
Start on the last key and iterate backward until no keys remain.BACKWARD_AT_LEAST
Start on the passed key (or the first key immediately preceding it) and iterate backward until no keys remain.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.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).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).BACKWARD_GREATER_THAN
Start immediate prior to the passed key (but not equal to it) and iterate backward until no keys remain.BACKWARD_LESS_THAN
Start on the last key and iterate backward until the last key greater than the passed "stop" key is reached.BACKWARD_OPEN
Iterate backward between the passed keys, but do not return the passed keys.BACKWARD_OPEN_CLOSED
Iterate backward between the passed keys.FORWARD_ALL
Starting on the first key and iterate forward until no keys remain.FORWARD_AT_LEAST
Start on the passed key (or the first key immediately after it) and iterate forward until no keys remain.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.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).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).FORWARD_GREATER_THAN
Start after the passed key (but not equal to it) and iterate forward until no keys remain.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).FORWARD_OPEN
Iterate forward between the passed keys but not equal to either of them.FORWARD_OPEN_CLOSED
Iterate forward between the passed keys.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isDirectionForward()
Whether the key space is iterated in the order provided by LMDB.boolean
isStartKeyRequired()
Whether the iteration requires a "start" key.boolean
isStopKeyRequired()
Whether the iteration requires a "stop" key.static KeyRangeType
valueOf(String name)
Returns the enum constant of this type with the specified name.static KeyRangeType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
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 Detail
-
values
public static KeyRangeType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (KeyRangeType c : KeyRangeType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static KeyRangeType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- 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
-
-