org.apache.lucene.util.hash
Class HashFunction

java.lang.Object
  extended by org.apache.lucene.util.hash.HashFunction
All Implemented Interfaces:
NamedSPILoader.NamedSPI
Direct Known Subclasses:
MurmurHash2

public abstract class HashFunction
extends Object
implements NamedSPILoader.NamedSPI

Base class for hashing functions that can be referred to by name. Subclasses are expected to provide threadsafe implementations of the hash function on the range of bytes referenced in the provided BytesRef

WARNING: This API is experimental and might change in incompatible ways in the next release.

Constructor Summary
HashFunction(String name)
           
 
Method Summary
static Set<String> availableHashFunctionNames()
          returns a list of all available hash function names
static HashFunction forName(String name)
          looks up a hash function by name
 String getName()
          Returns this codec's name
abstract  int hash(BytesRef bytes)
          Hashes the contents of the referenced bytes
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HashFunction

public HashFunction(String name)
Method Detail

hash

public abstract int hash(BytesRef bytes)
Hashes the contents of the referenced bytes

Parameters:
bytes - the data to be hashed
Returns:
the hash of the bytes referenced by bytes.offset and length bytes.length

getName

public final String getName()
Returns this codec's name

Specified by:
getName in interface NamedSPILoader.NamedSPI

forName

public static HashFunction forName(String name)
looks up a hash function by name


availableHashFunctionNames

public static Set<String> availableHashFunctionNames()
returns a list of all available hash function names


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.