org.anarres.jperf
Class PerfectObjectMapGenerator<K,V>

java.lang.Object
  extended by org.anarres.jperf.PerfectMapGenerator<K,V>
      extended by org.anarres.jperf.PerfectObjectMapGenerator<K,V>

public class PerfectObjectMapGenerator<K,V>
extends PerfectMapGenerator<K,V>


Constructor Summary
PerfectObjectMapGenerator()
           
 
Method Summary
 void add(K k, V v)
          Adds a key-value pair to the perfect map.
 int toHashCode(K key, int rem)
          Evaluates the hash function.
 Map<K,V> toMap()
          Returns an optimal map based on the given key-value pairs.
 int toRemainder()
          Generates the remainder for the perfect hash function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerfectObjectMapGenerator

public PerfectObjectMapGenerator()
Method Detail

add

public void add(K k,
                V v)
Description copied from class: PerfectMapGenerator
Adds a key-value pair to the perfect map.

Specified by:
add in class PerfectMapGenerator<K,V>

toHashCode

public int toHashCode(K key,
                      int rem)
Evaluates the hash function. The hash function is key.hashCode() & 0x7FFFFFFF) % rem


toRemainder

public int toRemainder()
Generates the remainder for the perfect hash function.


toMap

public Map<K,V> toMap()
Description copied from class: PerfectMapGenerator
Returns an optimal map based on the given key-value pairs. This method may take some time to execute. The time tradeoff happens here: to get faster runtime speed, time is sacrified here. The object returned from this method is not necessarily an instance or subclass of PerfectMap - it might, for example, be returned from Collections.emptyMap().

Specified by:
toMap in class PerfectMapGenerator<K,V>


Copyright © 2002-2008 Shevek, Anarres. All Rights Reserved.