|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object global.SearchKey
public class SearchKey
Provides a general and type-safe way to store and compare index search keys.
Field Summary | |
---|---|
protected static byte |
FLOAT_KEY
Internal type number for Float keys. |
protected static byte |
INTEGER_KEY
Internal type number for Integer keys. |
protected short |
size
The size of the key value (in bytes). |
protected static byte |
STRING_KEY
Internal type number for String keys. |
protected byte |
type
The type of the key value. |
protected java.lang.Object |
value
The actual key value. |
Constructor Summary | |
---|---|
SearchKey(byte[] data,
short offset)
Constructs a SearchKey stored in the given data buffer. |
|
SearchKey(java.lang.Float value)
Constructs a new float search key. |
|
SearchKey(java.lang.Integer value)
Constructs a new integer search key. |
|
SearchKey(java.lang.Object value)
Constructs a search key from a generic value. |
|
SearchKey(SearchKey key)
Copy constructor for a search key. |
|
SearchKey(java.lang.String value)
Constructs a new string search key. |
Method Summary | |
---|---|
int |
compareTo(SearchKey key)
Generically compares two search keys. |
boolean |
equals(java.lang.Object obj)
True if obj is a SearchKey with the same values; false otherwise. |
int |
getHash(int depth)
Gets the hash value for the search key, given the depth (i.e. |
short |
getLength()
Gets the total length of the search key (in bytes). |
int |
hashCode()
Returns a generic hash code for the key value. |
boolean |
isHash(int hash)
Returns true if the search key matches the given hash value, false otherwise. |
void |
writeData(byte[] data,
short offset)
Writes the SearchKey into the given data buffer. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final byte INTEGER_KEY
protected static final byte FLOAT_KEY
protected static final byte STRING_KEY
protected byte type
protected short size
protected java.lang.Object value
Constructor Detail |
---|
public SearchKey(java.lang.Integer value)
public SearchKey(java.lang.Float value)
public SearchKey(java.lang.String value)
public SearchKey(java.lang.Object value)
java.lang.IllegalArgumentException
- if value's type is invalidpublic SearchKey(SearchKey key)
public SearchKey(byte[] data, short offset)
Method Detail |
---|
public void writeData(byte[] data, short offset)
public short getLength()
public int getHash(int depth)
public boolean isHash(int hash)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int compareTo(SearchKey key)
compareTo
in interface java.lang.Comparable<SearchKey>
java.lang.IllegalArgumentException
- if the search keys are not comparable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |