org.h2.dev.hash
Class MinimalPerfectHash.LongHash

java.lang.Object
  extended by org.h2.dev.hash.MinimalPerfectHash.LongHash
All Implemented Interfaces:
MinimalPerfectHash.UniversalHash<java.lang.Long>
Enclosing class:
MinimalPerfectHash<K>

public static class MinimalPerfectHash.LongHash
extends java.lang.Object
implements MinimalPerfectHash.UniversalHash<java.lang.Long>

A sample hash implementation for long keys.


Constructor Summary
MinimalPerfectHash.LongHash()
           
 
Method Summary
 int hashCode(java.lang.Long o, int index, int seed)
          Calculate the hash of the given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MinimalPerfectHash.LongHash

public MinimalPerfectHash.LongHash()
Method Detail

hashCode

public int hashCode(java.lang.Long o,
                    int index,
                    int seed)
Description copied from interface: MinimalPerfectHash.UniversalHash
Calculate the hash of the given object.

Specified by:
hashCode in interface MinimalPerfectHash.UniversalHash<java.lang.Long>
Parameters:
o - the object
index - the hash function index (index 0 is used first, so the method should be very fast with index 0; index 1 and so on are only called when really needed)
seed - the random seed (always the same for a hash table)
Returns:
the hash value