Class KeyHasher

java.lang.Object
org.apache.derby.iapi.store.access.KeyHasher

public class KeyHasher extends Object
Provides the ability to hash on multiple objects.
  • Field Details

    • objects

      private final Object[] objects
  • Constructor Details

    • KeyHasher

      public KeyHasher(int size)
  • Method Details

    • setObject

      public void setObject(int index, Object object)
      Set array element at the specified index to the specified object.
      Parameters:
      index - The specified index
      object - The specified object.
    • getObject

      public 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 Object buildHashKey(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 consider
      indexes - The indexes of the objects in the hash key.
      Returns:
      The object to hash on.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object