com.coyotegulch.jisp

Class KeyObject

public abstract class KeyObject extends Object implements Externalizable

* KeyObject defines an characteristics of an object to be used as a key * in an ObjectIndex. Since Java lacks true generic types, it is up to * the programmer to ensure that all KeyObjects have the same concrete type * for a given ObjectIndex. Each ObjectIndex supports a single * concrete KeyObject type. *

* Concrete KeyObject classes must always produce a

See Also: ObjectIndex

Field Summary
static intKEY_EQUAL
Returned by compareTo when the invoking key is greater than the parameter key.
static intKEY_ERROR
Returned by compareTo when the invoking key has a different type from the parameter key.
static intKEY_LESS
Returned by compareTo when the invoking key is less than the parameter key.
static intKEY_MORE
Returned by compareTo when the invoking key equals the parameter key.
Method Summary
abstract intcompareTo(KeyObject key)
Compares the invoking object to key, returning one of the KEY_* constants based on the relationship of the two keys.
abstract KeyObjectmakeNullKey()
Returns a "null" (i.e., blank) key, to be used as a space-holder in certain kinds of ObjectIndexes.
StringtoString()
Returns the String representation of a KeyObject.

Field Detail

KEY_EQUAL

public static final int KEY_EQUAL
Returned by compareTo when the invoking key is greater than the parameter key.

KEY_ERROR

public static final int KEY_ERROR
Returned by compareTo when the invoking key has a different type from the parameter key.

KEY_LESS

public static final int KEY_LESS
Returned by compareTo when the invoking key is less than the parameter key.

KEY_MORE

public static final int KEY_MORE
Returned by compareTo when the invoking key equals the parameter key.

Method Detail

compareTo

public abstract int compareTo(KeyObject key)
Compares the invoking object to key, returning one of the KEY_* constants based on the relationship of the two keys.

Parameters: key The key value to be compared against the invoking key. * @return One of the KEY_* constants based on the relationship of the two keys.

makeNullKey

public abstract KeyObject makeNullKey()
Returns a "null" (i.e., blank) key, to be used as a space-holder in certain kinds of ObjectIndexes.

For example, a BTreeIndex maintains a set of index pages that must contain a set number of fixed-length keys. When creating a BTreeIndex, you must provide a "null" key, using the makeNullKey method.

Returns: A "null" (i.e., blank) key constant.

See Also: BTreeIndex

toString

public String toString()
Returns the String representation of a KeyObject.

Returns: The String representation of a KeyObject.