Java Code Examples for org.apache.hadoop.util.hash.Hash#getInstance()

The following examples show how to use org.apache.hadoop.util.hash.Hash#getInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HashFunction.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor.
 * <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");
}
 
Example 2
Source File: HashFunction.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor.
 * <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");
}
 
Example 3
Source File: HashFunction.java    From streaminer with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor.
 * <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");
}
 
Example 4
Source File: HashFunction.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor.
 * <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");
}
 
Example 5
Source File: HashFunction.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor.
 * <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");
}