Class KeyHasher
- java.lang.Object
-
- org.apache.derby.iapi.store.access.KeyHasher
-
public class KeyHasher extends java.lang.Object
Provides the ability to hash on multiple objects.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object[]
objects
-
Constructor Summary
Constructors Constructor Description KeyHasher(int size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
buildHashKey(java.lang.Object[] objects, int[] indexes)
Static method to return the object to hash on.boolean
equals(java.lang.Object obj)
java.lang.Object
getObject(int index)
Get the object stored at the specified index.int
hashCode()
void
setObject(int index, java.lang.Object object)
Set array element at the specified index to the specified object.
-
-
-
Method Detail
-
setObject
public void setObject(int index, java.lang.Object object)
Set array element at the specified index to the specified object.- Parameters:
index
- The specified indexobject
- The specified object.
-
getObject
public java.lang.Object getObject(int index)
Get the object stored at the specified index.- Parameters:
index
- The specified index.- Returns:
- The object stored in the array element.
-
buildHashKey
public static java.lang.Object buildHashKey(java.lang.Object[] objects, int[] indexes)
Static method to return the object to hash on. (Object stored in specifed array, if only a single object, otherwise a KeyHasher wrapping the objects to hash on. (NOTE: We optimize for in-memory hash tables, hence we only create a wrapper when needed.)- Parameters:
objects
- The array of objects to considerindexes
- The indexes of the objects in the hash key.- Returns:
- The object to hash on.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-