Package gnu.kawa.util
Class HashUtils
- java.lang.Object
-
- gnu.kawa.util.HashUtils
-
public class HashUtils extends Object
Various static helper methods for calculating hash-codes. These are designed to tolerate cyclic data structrues, by using a recursive/iteration limit. The actual hash functions used (unless we fall back to Object#hashCode) is the MurmurHash3 algorithm: http://en.wikipedia.org/wiki/MurmurHash https://code.google.com/p/smhasher/wiki/MurmurHash3
-
-
Constructor Summary
Constructors Constructor Description HashUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
boundedHash(Array arr, int seed, int limit)
static int
boundedHash(Object object)
static int
boundedHash(Object object, int seed, int limit)
Generic hash method.static int
boundedHash(List object, int seed, int limit)
static int
boundedHashArray(Object object, int seed, int limit)
static int
hashInt(int seed, int value)
static int
murmur3finish(int hash, int length)
static int
murmur3step(int h1, int k1)
-
-
-
Method Detail
-
boundedHash
public static int boundedHash(Object object)
-
boundedHash
public static int boundedHash(Object object, int seed, int limit)
Generic hash method. See BoundedHashable for a discussion of the parameters.
-
hashInt
public static int hashInt(int seed, int value)
-
boundedHash
public static int boundedHash(List object, int seed, int limit)
-
boundedHashArray
public static int boundedHashArray(Object object, int seed, int limit)
-
boundedHash
public static int boundedHash(Array arr, int seed, int limit)
-
murmur3step
public static int murmur3step(int h1, int k1)
-
murmur3finish
public static int murmur3finish(int hash, int length)
-
-