Infinispan Distribution 5.2.6.Final-redhat-2

org.infinispan.commons.hash
Class MurmurHash2

java.lang.Object
  extended by org.infinispan.commons.hash.MurmurHash2
All Implemented Interfaces:
Hash

@ThreadSafe
@Immutable
public class MurmurHash2
extends Object
implements Hash

An implementation of Austin Appleby's MurmurHash2.0 algorithm, as documented on his website.

This implementation is based on the slower, endian-neutral version of the algorithm as documented on the site, ported from Austin Appleby's original C++ version MurmurHashNeutral2.cpp.

Other implementations are documented on Wikipedia's MurmurHash page.

Version:
4.1
Author:
Manik Surtani
See Also:
MurmurHash website, MurmurHash entry on Wikipedia, MurmurHash2Compat

Nested Class Summary
static class MurmurHash2.Externalizer
           
 
Constructor Summary
MurmurHash2()
           
 
Method Summary
 boolean equals(Object other)
           
 int hash(byte[] payload)
          Hashes a byte array efficiently.
 int hash(int hashcode)
          An incremental version of the hash function, that spreads a pre-calculated hash code, such as one derived from Object.hashCode().
 int hash(Object o)
          A helper that calculates the hashcode of an object, choosing the optimal mechanism of hash calculation after considering the type of the object (byte array, String or Object).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MurmurHash2

public MurmurHash2()
Method Detail

hash

public final int hash(byte[] payload)
Description copied from interface: Hash
Hashes a byte array efficiently.

Specified by:
hash in interface Hash
Parameters:
payload - a byte array to hash
Returns:
a hash code for the byte array

hash

public final int hash(int hashcode)
Description copied from interface: Hash
An incremental version of the hash function, that spreads a pre-calculated hash code, such as one derived from Object.hashCode().

Specified by:
hash in interface Hash
Parameters:
hashcode - an object's hashcode
Returns:
a spread and hashed version of the hashcode

hash

public final int hash(Object o)
Description copied from interface: Hash
A helper that calculates the hashcode of an object, choosing the optimal mechanism of hash calculation after considering the type of the object (byte array, String or Object).

Specified by:
hash in interface Hash
Parameters:
o - object to hash
Returns:
a hashcode

equals

public boolean equals(Object other)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

Infinispan Distribution 5.2.6.Final-redhat-2

Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.