Class MADMethodHashFunction

java.lang.Object
  |
  +--MADMethodHashFunction
All Implemented Interfaces:
IHashFunction

public class MADMethodHashFunction
extends Object
implements IHashFunction

IHashFunction implementation using the MAD method.


Field Summary
protected  int a
          Multiplier for the MAD method.
protected  int b
          Addend for the MAD method.
protected  int N
          Length of the array for hashtable using this.
 
Constructor Summary
MADMethodHashFunction(int aLength, int anA, int aB)
          Constructs a new hash function with the given array length.
 
Method Summary
 int hash(Object aKey)
          Returns the hash index for the given key object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

N

protected int N
Length of the array for hashtable using this.


a

protected int a
Multiplier for the MAD method.


b

protected int b
Addend for the MAD method.

Constructor Detail

MADMethodHashFunction

public MADMethodHashFunction(int aLength,
                             int anA,
                             int aB)
Constructs a new hash function with the given array length.

Parameters:
aLength - length of the array
anA - multiplier for the MAD method
aB - addend for the MAD method
Method Detail

hash

public int hash(Object aKey)
Returns the hash index for the given key object.

Specified by:
hash in interface IHashFunction
Parameters:
aKey - key to hash