- java.lang.Object
-
- com.pervasive.datarush.util.HashMixer
-
public final class HashMixer extends Object
A representation of a partially completed hash of a sequence of values. The internal state contains more bits than the final 32-bit hash code.This implementation is based on C code placed in the public domain by Bob Jenkins. It is advertised as strong enough to allow the use of
hash & mask
instead ofhash % prime
for computing a hash bucket.
-
-
Constructor Summary
Constructors Constructor Description HashMixer()
Constructs a mixer by initializing the internal state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
finalMix(int i, int j, int k)
Performs the final "mix" of the internal state with the given parameters, resets the state, and returns the resulting hash code.void
mix(int i, int j, int k)
Replicates the computation of Bob Jenkins' "mix" macro.
-
-
-
Method Detail
-
mix
public void mix(int i, int j, int k)
Replicates the computation of Bob Jenkins' "mix" macro.- Parameters:
i
- the first input to the macroj
- the second input to the macrok
- the third input to the macro
-
finalMix
public int finalMix(int i, int j, int k)
Performs the final "mix" of the internal state with the given parameters, resets the state, and returns the resulting hash code.- Parameters:
i
- the first four bytes to includej
- the second four bytes to includek
- the final four bytes to include- Returns:
- the hash code produced by "mixing" initial state, parameters to each call of
mix(int, int, int)
, and parameters tofinalMix(int, int, int)
-
-