Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

com::sleepycat::collections::KeyRange Class Reference


Public Member Functions

String toString ()

Package Functions

 KeyRange (Comparator comparator)
KeyRange subRange (DatabaseEntry key) throws KeyRangeException
KeyRange subRange (DatabaseEntry beginKey, boolean beginInclusive, DatabaseEntry endKey, boolean endInclusive) throws KeyRangeException
final DatabaseEntry getSingleKey ()
final boolean hasBound ()
boolean check (DatabaseEntry key)
boolean check (DatabaseEntry key, boolean inclusive)
boolean checkBegin (DatabaseEntry key, boolean inclusive)
boolean checkEnd (DatabaseEntry key, boolean inclusive)
int compare (DatabaseEntry key1, DatabaseEntry key2)

Static Package Functions

static int compareBytes (byte[] data1, int offset1, int size1, byte[] data2, int offset2, int size2)
static DatabaseEntry copy (DatabaseEntry from)
static void copy (DatabaseEntry from, DatabaseEntry to)
static byte[] getByteArray (DatabaseEntry entry)
static boolean equalBytes (DatabaseEntry e1, DatabaseEntry e2)
static String toString (DatabaseEntry dbt)

Detailed Description

Encapsulates a key range for use with a RangeCursor.

Definition at line 19 of file KeyRange.java.


Constructor & Destructor Documentation

com::sleepycat::collections::KeyRange::KeyRange Comparator  comparator  )  [inline, package]
 

Creates an unconstrained key range.

Definition at line 31 of file KeyRange.java.

Referenced by subRange().


Member Function Documentation

boolean com::sleepycat::collections::KeyRange::check DatabaseEntry  key,
boolean  inclusive
[inline, package]
 

Returns whether a given key is within range.

Definition at line 123 of file KeyRange.java.

References checkBegin(), checkEnd(), and compare().

boolean com::sleepycat::collections::KeyRange::check DatabaseEntry  key  )  [inline, package]
 

Returns whether a given key is within range.

Definition at line 111 of file KeyRange.java.

References checkBegin(), checkEnd(), and compare().

Referenced by com::sleepycat::collections::DataView::append(), and subRange().

boolean com::sleepycat::collections::KeyRange::checkBegin DatabaseEntry  key,
boolean  inclusive
[inline, package]
 

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.

Definition at line 148 of file KeyRange.java.

References compare().

Referenced by check().

boolean com::sleepycat::collections::KeyRange::checkEnd DatabaseEntry  key,
boolean  inclusive
[inline, package]
 

Returns whether the given key is within range with respect to the end of the range. See checkBegin for details.

Definition at line 163 of file KeyRange.java.

References compare().

Referenced by check().

int com::sleepycat::collections::KeyRange::compare DatabaseEntry  key1,
DatabaseEntry  key2
[inline, package]
 

Compares two keys, using the user comparator if there is one.

Definition at line 177 of file KeyRange.java.

References compareBytes(), and getByteArray().

Referenced by check(), checkBegin(), and checkEnd().

static int com::sleepycat::collections::KeyRange::compareBytes byte[]  data1,
int  offset1,
int  size1,
byte[]  data2,
int  offset2,
int  size2
[inline, static, package]
 

Compares two keys as unsigned byte arrays, which is the default comparison used by JE/DB.

Definition at line 193 of file KeyRange.java.

Referenced by compare().

static void com::sleepycat::collections::KeyRange::copy DatabaseEntry  from,
DatabaseEntry  to
[inline, static, package]
 

Copies one entry to another.

Definition at line 224 of file KeyRange.java.

References getByteArray().

static DatabaseEntry com::sleepycat::collections::KeyRange::copy DatabaseEntry  from  )  [inline, static, package]
 

Returns a copy of an entry.

Definition at line 217 of file KeyRange.java.

References getByteArray().

static boolean com::sleepycat::collections::KeyRange::equalBytes DatabaseEntry  e1,
DatabaseEntry  e2
[inline, static, package]
 

Returns the two DatabaseEntry objects have the same data value.

Definition at line 246 of file KeyRange.java.

static byte [] com::sleepycat::collections::KeyRange::getByteArray DatabaseEntry  entry  )  [inline, static, package]
 

Returns an entry's byte array, copying it if the entry offset is non-zero.

Definition at line 233 of file KeyRange.java.

Referenced by compare(), and copy().

final DatabaseEntry com::sleepycat::collections::KeyRange::getSingleKey  )  [inline, package]
 

Returns the key of a single-key range, or null if not a single-key range.

Definition at line 85 of file KeyRange.java.

Referenced by com::sleepycat::collections::DataView::getSingleKeyThang().

final boolean com::sleepycat::collections::KeyRange::hasBound  )  [inline, package]
 

Returns whether this range has a begin or end bound.

Definition at line 93 of file KeyRange.java.

KeyRange com::sleepycat::collections::KeyRange::subRange DatabaseEntry  beginKey,
boolean  beginInclusive,
DatabaseEntry  endKey,
boolean  endInclusive
throws KeyRangeException [inline, package]
 

Creates a range that is the intersection of this range and the given range parameters.

Definition at line 57 of file KeyRange.java.

References beginInclusive, beginKey, check(), endInclusive, endKey, and KeyRange().

KeyRange com::sleepycat::collections::KeyRange::subRange DatabaseEntry  key  )  throws KeyRangeException [inline, package]
 

Creates a range for a single key.

Definition at line 38 of file KeyRange.java.

References beginInclusive, beginKey, check(), endInclusive, endKey, KeyRange(), and singleKey.

Referenced by com::sleepycat::collections::DataView::subRange().

static String com::sleepycat::collections::KeyRange::toString DatabaseEntry  dbt  )  [inline, static, package]
 

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.
the resulting string.

Definition at line 287 of file KeyRange.java.

String com::sleepycat::collections::KeyRange::toString  )  [inline]
 

Formats this range as a string for debugging.

Definition at line 101 of file KeyRange.java.


The documentation for this class was generated from the following file:
Generated on Sun Dec 25 12:15:00 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2