Package com.coyotegulch.jisp
Class KeyObject
- java.lang.Object
-
- com.coyotegulch.jisp.KeyObject
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable
public abstract class KeyObject extends java.lang.Object implements java.io.ExternalizableKeyObjectdefines an characteristics of an object to be used as a key * in anObjectIndex. Since Java lacks true generic types, it is up to * the programmer to ensure that allKeyObjects have the same concrete type * for a givenObjectIndex. EachObjectIndexsupports a single * concreteKeyObjecttype. ** Concrete
KeyObjectclasses must always produce a- See Also:
ObjectIndex, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intKEY_EQUALReturned bycompareTowhen the invoking key is greater than the parameter key.static intKEY_ERRORReturned bycompareTowhen the invoking key has a different type from the parameter key.static intKEY_LESSReturned bycompareTowhen the invoking key is less than the parameter key.static intKEY_MOREReturned bycompareTowhen the invoking key equals the parameter key.
-
Constructor Summary
Constructors Constructor Description KeyObject()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract intcompareTo(KeyObject key)Compares the invoking object tokey, returning one of theKEY_*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 ofObjectIndexes.java.lang.StringtoString()Returns theStringrepresentation of aKeyObject.
-
-
-
Field Detail
-
KEY_LESS
public static final int KEY_LESS
Returned bycompareTowhen the invoking key is less than the parameter key.- See Also:
- Constant Field Values
-
KEY_EQUAL
public static final int KEY_EQUAL
Returned bycompareTowhen the invoking key is greater than the parameter key.- See Also:
- Constant Field Values
-
KEY_MORE
public static final int KEY_MORE
Returned bycompareTowhen the invoking key equals the parameter key.- See Also:
- Constant Field Values
-
KEY_ERROR
public static final int KEY_ERROR
Returned bycompareTowhen the invoking key has a different type from the parameter key.- See Also:
- Constant Field Values
-
-
Method Detail
-
compareTo
public abstract int compareTo(KeyObject key)
Compares the invoking object tokey, returning one of theKEY_*constants based on the relationship of the two keys.- Parameters:
key- The key value to be compared against the invoking key. * @return One of theKEY_*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 ofObjectIndexes.For example, a
BTreeIndexmaintains a set of index pages that must contain a set number of fixed-length keys. When creating aBTreeIndex, you must provide a "null" key, using themakeNullKeymethod.- Returns:
- A "null" (i.e., blank) key constant.
- See Also:
BTreeIndex
-
toString
public java.lang.String toString()
Returns theStringrepresentation of aKeyObject.- Overrides:
toStringin classjava.lang.Object- Returns:
- The
Stringrepresentation of aKeyObject.
-
-