Example usage for org.apache.hadoop.util.hash Hash getInstance

List of usage examples for org.apache.hadoop.util.hash Hash getInstance

Introduction

In this page you can find the example usage for org.apache.hadoop.util.hash Hash getInstance.

Prototype

public static Hash getInstance(Configuration conf) 

Source Link

Document

Get a singleton instance of hash function of a type defined in the configuration.

Usage

From source file:org.apache.giraph.utils.bloom.HashFunction.java

License:Open Source License

/**
 * Constructor./*  www .  j a v  a2  s  .com*/
 * <p>
 * Builds a hash function that must obey to a given maximum number of returned values and a highest value.
 * @param maxValue The maximum highest returned value.
 * @param nbHash The number of resulting hashed values.
 * @param hashType type of the hashing function (see {@link Hash}).
 */
public HashFunction(int maxValue, int nbHash, int hashType) {
    if (maxValue <= 0) {
        throw new IllegalArgumentException("maxValue must be > 0");
    }

    if (nbHash <= 0) {
        throw new IllegalArgumentException("nbHash must be > 0");
    }

    this.maxValue = maxValue;
    this.nbHash = nbHash;
    this.hashFunction = Hash.getInstance(hashType);
    if (this.hashFunction == null)
        throw new IllegalArgumentException("hashType must be known");
}