List of usage examples for org.apache.hadoop.util.bloom HashFunction HashFunction
public HashFunction(int maxValue, int nbHash, int hashType)
From source file:org.apache.accumulo.core.bloomfilter.Filter.java
License:Open Source License
/** * Constructor.//from w ww . jav a 2 s .c o m * * @param vectorSize * The vector size of <i>this</i> filter. * @param nbHash * The number of hash functions to consider. * @param hashType * type of the hashing function (see {@link Hash}). */ protected Filter(final int vectorSize, final int nbHash, final int hashType) { this.vectorSize = vectorSize; this.nbHash = nbHash; this.hashType = hashType; this.hash = new HashFunction(this.vectorSize, this.nbHash, this.hashType); }
From source file:org.apache.accumulo.core.bloomfilter.Filter.java
License:Open Source License
@Override public void readFields(final DataInput in) throws IOException { final int ver = in.readInt(); rVersion = ver;/* w ww. java2 s . c om*/ if (ver > 0) { // old unversioned format this.nbHash = ver; this.hashType = Hash.JENKINS_HASH; } else if (ver == VERSION | ver == VERSION + 1) { // Support for directly serialzing the bitset this.nbHash = in.readInt(); this.hashType = in.readByte(); } else { throw new IOException("Unsupported version: " + ver); } this.vectorSize = in.readInt(); this.hash = new HashFunction(this.vectorSize, this.nbHash, this.hashType); }