public class CBloomFilter<T> extends BloomFilter<T>
Modifier and Type | Class and Description |
---|---|
static interface |
CBloomFilter.OverflowHandler |
BloomFilter.CustomHashFunction, BloomFilter.HashMethod
Constructor and Description |
---|
CBloomFilter(double n,
double p,
int c)
Constructs a new counting bloom filter by determining the optimal bloom filter size n in bits and the
number of hash functions k based on the expected number n of elements in the bloom filter and the
tolerable false positive rate p.
|
CBloomFilter(int m,
int k,
int c)
Constructs an new Counting Bloom Filter.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(byte[] value) |
void |
clear() |
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object obj) |
int |
getC()
Returns the number of bits used for counting
|
int |
hashCode() |
boolean |
intersect(BloomFilter<T> other)
Performs the intersection operation on two compatible bloom filters.
|
void |
remove(byte[] value)
Removes the object from the counting bloom filter.
|
void |
remove(T value)
Removes the object from the counting bloom filter.
|
void |
removeAll(java.util.Collection<T> values)
Removes the objects from the counting bloom filter.
|
void |
setOverflowHandler(CBloomFilter.OverflowHandler callback)
Set an overflow hand which is called every time a counter has an overflow.
|
java.lang.String |
toString() |
boolean |
union(BloomFilter<T> other)
Performs the union operation on two compatible bloom filters.
|
add, addAll, contains, contains, containsAll, getBitSet, getBitsPerElement, getBitZeroProbability, getCryptographicHashFunctionName, getFalsePositiveProbability, getHashMethod, getK, getM, hash, isEmpty, optimalK, optimalM, setCryptographicHashFunction, setCusomtHashFunction, setHashMethod, size
public CBloomFilter(double n, double p, int c)
n
- Expected number of elements inserted in the bloom filterp
- Tolerable false positive ratec
- Number of bits used for countingpublic CBloomFilter(int m, int k, int c)
remove(Object)
. Elements can thus be added and removed from the bloom filter without loss of
information.m
- The size of the bloom filter in bits.k
- The number of hash functions to use.c
- Number of bits used for countingpublic void setOverflowHandler(CBloomFilter.OverflowHandler callback)
callback
- the overflow callback to be executedpublic boolean add(byte[] value)
add
in class BloomFilter<T>
public void remove(byte[] value)
value
- object to be deletedpublic void remove(T value)
value
- object to be deletedpublic void removeAll(java.util.Collection<T> values)
values
- objects to be deletedpublic int getC()
public boolean union(BloomFilter<T> other)
BloomFilter
union
in class BloomFilter<T>
other
- the other bloom filterpublic boolean intersect(BloomFilter<T> other)
BloomFilter
intersect
in class BloomFilter<T>
other
- the other bloom filterpublic java.lang.String toString()
toString
in class BloomFilter<T>
public java.lang.Object clone()
clone
in class BloomFilter<T>
public int hashCode()
hashCode
in class BloomFilter<T>
public boolean equals(java.lang.Object obj)
equals
in class BloomFilter<T>
public void clear()
clear
in class BloomFilter<T>