E - The type of object the BloomFilter should containpublic class SimpleBloomFilter<E> extends Object implements Set<E>, Serializable
| Modifier and Type | Field and Description |
|---|---|
static int |
SIZE_HEADER |
| Constructor and Description |
|---|
SimpleBloomFilter(io.netty.buffer.ByteBuf channelBuffer)
Constructs a SimpleBloomFilter out of existing data.
|
SimpleBloomFilter(double falsePositiveProbability,
int expectedElements) |
SimpleBloomFilter(int byteArraySize,
int expectedElements)
Construct an empty SimpleBloomFilter.
|
SimpleBloomFilter(int byteArraySize,
int expectedElements,
BitSet bitSet)
Constructs a SimpleBloomFilter out of existing data.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E o) |
boolean |
addAll(Collection<? extends E> c) |
void |
clear()
Clear the Bloom Filter.
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object obj) |
int |
expectedElements()
Returns the expected elements that was provided by the user.
|
double |
expectedFalsePositiveProbability()
Calculates the approximate probability of the contains() method returning
true for an object that had not previously been inserted into the bloom
filter.
|
BitSet |
getBitSet()
Returns the bitset that backs the bloom filter.
|
int |
hashCode() |
boolean |
isEmpty()
Not implemented.
|
Iterator<E> |
iterator()
Not implemented.
|
SimpleBloomFilter<E> |
merge(SimpleBloomFilter<E> toMerge) |
SimpleBloomFilter<Number160> |
not()
Invert the bloom filter
|
boolean |
remove(Object o)
Not implemented.
|
boolean |
removeAll(Collection<?> c)
Not implemented.
|
boolean |
retainAll(Collection<?> c)
Not implemented.
|
int |
size()
Not implemented.
|
Object[] |
toArray()
Not implemented.
|
<T> T[] |
toArray(T[] a)
Not implemented.
|
void |
toByteBuf(io.netty.buffer.ByteBuf buf)
Converts data to a byte buffer.
|
String |
toString() |
public static final int SIZE_HEADER
public SimpleBloomFilter(int byteArraySize,
int expectedElements)
byteArraySize - The number of bits in multiple of 8 in the bit array (often
called 'm' in the context of bloom filters).expectedElements - The typical number of items you expect to be added to the
SimpleBloomFilter (often called 'n').public SimpleBloomFilter(double falsePositiveProbability,
int expectedElements)
public SimpleBloomFilter(io.netty.buffer.ByteBuf channelBuffer)
channelBuffer - The byte buffer with the datapublic SimpleBloomFilter(int byteArraySize,
int expectedElements,
BitSet bitSet)
byteArraySize - The number of bits in multiple of 8 in the bit array (often
called 'm' in the context of bloom filters).expectedElements - he typical number of items you expect to be added to the
SimpleBloomFilter (often called 'n').bitSet - The data that will be used in the backing BitSetpublic double expectedFalsePositiveProbability()
public int expectedElements()
public boolean add(E o)
add in interface Collection<E>add in interface Set<E>o - Add elementSet.add(java.lang.Object)public boolean addAll(Collection<? extends E> c)
public void clear()
public boolean contains(Object o)
contains in interface Collection<E>contains in interface Set<E>o - The object to comparepublic boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface Set<E>c - The collection to checkpublic boolean isEmpty()
public boolean remove(Object o)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public int size()
public Object[] toArray()
public <T> T[] toArray(T[] a)
public BitSet getBitSet()
public void toByteBuf(io.netty.buffer.ByteBuf buf)
buf - The byte buffer where the bloom filter will be written.public SimpleBloomFilter<E> merge(SimpleBloomFilter<E> toMerge)
toMerge - Merge to bloom filters using ORpublic boolean equals(Object obj)
public int hashCode()
public SimpleBloomFilter<Number160> not()
Copyright © 2014. All rights reserved.