| java.lang.Object com.sleepycat.util.keyrange.KeyRange
KeyRange | public class KeyRange (Code) | | Encapsulates a key range for use with a RangeCursor.
|
Constructor Summary | |
public | KeyRange(Comparator comparator) Creates an unconstrained key range. |
Method Summary | |
public boolean | check(DatabaseEntry key) Returns whether a given key is within range. | public boolean | check(DatabaseEntry key, boolean inclusive) Returns whether a given key is within range. | public boolean | checkBegin(DatabaseEntry key, boolean inclusive) Returns whether the given key is within range with respect to the
beginning of the range.
The inclusive parameter should be true for checking a key read from
the database; this will require that the key is within range. | public boolean | checkEnd(DatabaseEntry key, boolean inclusive) Returns whether the given key is within range with respect to the
end of the range. | public int | compare(DatabaseEntry key1, DatabaseEntry key2) Compares two keys, using the user comparator if there is one. | public static int | compareBytes(byte[] data1, int offset1, int size1, byte[] data2, int offset2, int size2) Compares two keys as unsigned byte arrays, which is the default
comparison used by JE/DB. | public static DatabaseEntry | copy(DatabaseEntry from) Returns a copy of an entry. | public static void | copy(DatabaseEntry from, DatabaseEntry to) Copies one entry to another. | public static byte[] | copyBytes(byte[] bytes) Copies a byte array. | public static boolean | equalBytes(byte[] data1, int offset1, int size1, byte[] data2, int offset2, int size2) Compares two byte arrays for equality. | public static boolean | equalBytes(DatabaseEntry e1, DatabaseEntry e2) Returns the two DatabaseEntry objects have the same data value. | public static byte[] | getByteArray(DatabaseEntry entry) Returns an entry's byte array, copying it if the entry offset is
non-zero. | public static byte[] | getByteArray(DatabaseEntry entry, int maxBytes) | final public DatabaseEntry | getSingleKey() Returns the key of a single-key range, or null if not a single-key
range. | final public boolean | hasBound() Returns whether this range has a begin or end bound. | final public boolean | isSingleKey() Returns whether this is a single-key range. | public KeyRange | subRange(DatabaseEntry key) Creates a range for a single key. | public KeyRange | subRange(DatabaseEntry beginKey, boolean beginInclusive, DatabaseEntry endKey, boolean endInclusive) Creates a range that is the intersection of this range and the given
range parameters. | public String | toString() Formats this range as a string for debugging. | public static String | toString(DatabaseEntry dbt) Converts the byte array of this thang to space-separated integers,
and suffixed by the record number if applicable. |
ZERO_LENGTH_BYTE_ARRAY | final public static byte[] ZERO_LENGTH_BYTE_ARRAY(Code) | | |
beginInclusive | boolean beginInclusive(Code) | | |
endInclusive | boolean endInclusive(Code) | | |
singleKey | boolean singleKey(Code) | | |
KeyRange | public KeyRange(Comparator comparator)(Code) | | Creates an unconstrained key range.
|
check | public boolean check(DatabaseEntry key)(Code) | | Returns whether a given key is within range.
|
check | public boolean check(DatabaseEntry key, boolean inclusive)(Code) | | Returns whether a given key is within range.
|
checkBegin | public boolean checkBegin(DatabaseEntry key, boolean inclusive)(Code) | | Returns whether the given key is within range with respect to the
beginning of the range.
The inclusive parameter should be true for checking a key read from
the database; this will require that the key is within range. When
inclusive=false the key is allowed to be equal to the beginKey for the
range; this is used for checking a new exclusive bound of a
sub-range.
Note that when inclusive=false and beginInclusive=true our check is
not exactly correct because in theory we should allow the key to be "one
less" than the existing bound; however, checking for "one less" is
impossible so we do the best we can and test the bounds
conservatively.
|
checkEnd | public boolean checkEnd(DatabaseEntry key, boolean inclusive)(Code) | | Returns whether the given key is within range with respect to the
end of the range. See checkBegin for details.
|
compareBytes | public static int compareBytes(byte[] data1, int offset1, int size1, byte[] data2, int offset2, int size2)(Code) | | Compares two keys as unsigned byte arrays, which is the default
comparison used by JE/DB.
|
copyBytes | public static byte[] copyBytes(byte[] bytes)(Code) | | Copies a byte array.
|
equalBytes | public static boolean equalBytes(byte[] data1, int offset1, int size1, byte[] data2, int offset2, int size2)(Code) | | Compares two byte arrays for equality.
|
getByteArray | public static byte[] getByteArray(DatabaseEntry entry)(Code) | | Returns an entry's byte array, copying it if the entry offset is
non-zero.
|
getSingleKey | final public DatabaseEntry getSingleKey()(Code) | | Returns the key of a single-key range, or null if not a single-key
range.
|
hasBound | final public boolean hasBound()(Code) | | Returns whether this range has a begin or end bound.
|
isSingleKey | final public boolean isSingleKey()(Code) | | Returns whether this is a single-key range.
|
toString | public String toString()(Code) | | Formats this range as a string for debugging.
|
toString | public static String toString(DatabaseEntry dbt)(Code) | | Converts the byte array of this thang to space-separated integers,
and suffixed by the record number if applicable.
Parameters: dbt - the thang to convert. Parameters: the - resulting string. |
|
|