Package org.antlr.v4.runtime.misc
Class MurmurHash
- java.lang.Object
-
- org.antlr.v4.runtime.misc.MurmurHash
-
public final class MurmurHash extends Object
- Author:
- Sam Harwell
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
finish(int hash, int numberOfWords)
Apply the final computation steps to the intermediate valuehash
to form the final result of the MurmurHash 3 hash function.static <T> int
hashCode(T[] data, int seed)
Utility function to compute the hash code of an array using the MurmurHash algorithm.static int
initialize()
Initialize the hash using the default seed value.static int
initialize(int seed)
Initialize the hash using the specifiedseed
.static int
update(int hash, int value)
Update the intermediate hash value for the next inputvalue
.static int
update(int hash, Object value)
Update the intermediate hash value for the next inputvalue
.
-
-
-
Method Detail
-
initialize
public static int initialize()
Initialize the hash using the default seed value.- Returns:
- the intermediate hash value
-
initialize
public static int initialize(int seed)
Initialize the hash using the specifiedseed
.- Parameters:
seed
- the seed- Returns:
- the intermediate hash value
-
update
public static int update(int hash, int value)
Update the intermediate hash value for the next inputvalue
.- Parameters:
hash
- the intermediate hash valuevalue
- the value to add to the current hash- Returns:
- the updated intermediate hash value
-
update
public static int update(int hash, Object value)
Update the intermediate hash value for the next inputvalue
.- Parameters:
hash
- the intermediate hash valuevalue
- the value to add to the current hash- Returns:
- the updated intermediate hash value
-
finish
public static int finish(int hash, int numberOfWords)
Apply the final computation steps to the intermediate valuehash
to form the final result of the MurmurHash 3 hash function.- Parameters:
hash
- the intermediate hash valuenumberOfWords
- the number of integer values added to the hash- Returns:
- the final hash result
-
hashCode
public static <T> int hashCode(T[] data, int seed)
Utility function to compute the hash code of an array using the MurmurHash algorithm.- Type Parameters:
T
- the array element type- Parameters:
data
- the array dataseed
- the seed for the MurmurHash algorithm- Returns:
- the hash code of the data
-
-