/** * Constructor. * @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(int vectorSize, int nbHash, int hashType) { this.vectorSize = vectorSize; this.nbHash = nbHash; this.hashType = hashType; this.hash = new HashFunction(this.vectorSize, this.nbHash, this.hashType); }
@Override public void readFields(DataInput in) throws IOException { int ver = in.readInt(); if (ver > 0) { // old unversioned format this.nbHash = ver; this.hashType = Hash.JENKINS_HASH; } else if (ver == VERSION) { 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); } }//end class
/** * Constructor. * * @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); }
@Override public void readFields(final DataInput in) throws IOException { final int ver = in.readInt(); rVersion = ver; if (ver > 0) { // old unversioned format this.nbHash = ver; this.hashType = Hash.JENKINS_HASH; } else if (ver == VERSION | ver == VERSION + 1) { // Support for directly serializing 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); } }// end class
/** * Constructor. * @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(int vectorSize, int nbHash, int hashType) { this.vectorSize = vectorSize; this.nbHash = nbHash; this.hashType = hashType; this.hash = new HashFunction(this.vectorSize, this.nbHash, this.hashType); }
/** * Constructor. * @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(int vectorSize, int nbHash, int hashType) { this.vectorSize = vectorSize; this.nbHash = nbHash; this.hashType = hashType; this.hash = new HashFunction(this.vectorSize, this.nbHash, this.hashType); }
/** * Constructor. * @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(int vectorSize, int nbHash, int hashType) { this.vectorSize = vectorSize; this.nbHash = nbHash; this.hashType = hashType; this.hash = new HashFunction(this.vectorSize, this.nbHash, this.hashType); }
/** * Constructor. * @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(int vectorSize, int nbHash, int hashType) { this.vectorSize = vectorSize; this.nbHash = nbHash; this.hashType = hashType; this.hash = new HashFunction(this.vectorSize, this.nbHash, this.hashType); }
/** * Constructor. * @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(int vectorSize, int nbHash, int hashType) { this.vectorSize = vectorSize; this.nbHash = nbHash; this.hashType = hashType; this.hash = new HashFunction(this.vectorSize, this.nbHash, this.hashType); }
/** * Constructor. * * @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); }
/** * Constructor * * @param vectorSize The vector size of <i>this</i> filter. * @param nbHash The number of hash function to consider. */ public BloomFilter(int vectorSize, int nbHash) { this.vectorSize = vectorSize; this.nbHash = nbHash; this.hash = new HashFunction(this.vectorSize, this.nbHash); bits = new BitSet(this.vectorSize); }
@Override public void readFields(DataInput in) throws IOException { int ver = in.readInt(); if (ver > 0) { // old unversioned format this.nbHash = ver; this.hashType = Hash.JENKINS_HASH; } else if (ver == VERSION) { 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); } }//end class
public void readFields(DataInput in) throws IOException { int ver = in.readInt(); if (ver > 0) { // old unversioned format this.nbHash = ver; this.hashType = Hash.JENKINS_HASH; } else if (ver == VERSION) { 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); } }//end class
@Override public void readFields(DataInput in) throws IOException { int ver = in.readInt(); if (ver > 0) { // old unversioned format this.nbHash = ver; this.hashType = Hash.JENKINS_HASH; } else if (ver == VERSION) { 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); } }//end class
@Override public void readFields(final DataInput in) throws IOException { final int ver = in.readInt(); rVersion = ver; 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); } }// end class
@Override public void readFields(DataInput in) throws IOException { int ver = in.readInt(); if (ver > 0) { // old unversioned format this.nbHash = ver; this.hashType = Hash.JENKINS_HASH; } else if (ver == VERSION) { 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); } }//end class
@Override public void readFields(DataInput in) throws IOException { int ver = in.readInt(); if (ver > 0) { // old unversioned format this.nbHash = ver; this.hashType = Hash.JENKINS_HASH; } else if (ver == VERSION) { 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); } }//end class
@Override public void readFields(DataInput in) throws IOException { this.blockletNo = in.readInt(); this.nbHash = in.readInt(); this.hashType = in.readByte(); this.vectorSize = in.readInt(); this.compress = in.readBoolean(); if (!compress) { int len = in.readInt(); byte[] bytes = new byte[len]; in.readFully(bytes); setBitSet(BitSet.valueOf(bytes)); } else { this.bitmap = new RoaringBitmap(); bitmap.deserialize(in); } this.hash = new HashFunction(this.vectorSize, this.nbHash, this.hashType); }
public void read(Kryo kryo, Input input) { this.nbHash = input.readInt(); this.vectorSize = input.readInt(); this.hash = new HashFunction(this.vectorSize, this.nbHash); bits = new BitSet(this.vectorSize); byte[] bytes = new byte[getNBytes()]; input.read(bytes); for (int i = 0, byteIndex = 0, bitIndex = 0; i < vectorSize; i++, bitIndex++) { if (bitIndex == 8) { bitIndex = 0; byteIndex++; } if ((bytes[byteIndex] & bitvalues[bitIndex]) != 0) { bits.set(i); } } } }//end class