E
- The type of object the BloomFilter should containpublic class SimpleBloomFilter<E> extends Object implements Set<E>, Serializable
Constructor and Description |
---|
SimpleBloomFilter(byte[] rawBitArray)
Constructs a SimpleBloomFilter out of existing data.
|
SimpleBloomFilter(byte[] rawBitArray,
int offset,
int length)
Constructs a SimpleBloomFilter out of existing data.
|
SimpleBloomFilter(org.jboss.netty.buffer.ChannelBuffer channelBuffer,
int length) |
SimpleBloomFilter(int bitArraySize,
int expectedElements)
Construct an empty SimpleBloomFilter.
|
SimpleBloomFilter(int bitArraySize,
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) |
static int |
byteArrayToInt(byte[] me,
int offset) |
void |
clear()
Clear the Bloom Filter
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object obj) |
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 |
getExpectedElements()
Returns the expected elements that was provided by the user.
|
int |
hashCode() |
static byte[] |
intToByteArray(int value1,
int value2,
byte[] me) |
boolean |
isEmpty()
Not implemented
|
Iterator<E> |
iterator()
Not implemented
|
SimpleBloomFilter<E> |
merge(SimpleBloomFilter<E> toMerge) |
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
|
byte[] |
toByteArray()
Returns a byte array of at least length 8.
|
String |
toString() |
public SimpleBloomFilter(int bitArraySize, int expectedElements)
bitArraySize
- The number of bits 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(byte[] rawBitArray)
bitArraySize
- The number of bits 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').rawBitArray
- The data that will be used in the backing BitSetpublic SimpleBloomFilter(org.jboss.netty.buffer.ChannelBuffer channelBuffer, int length)
public SimpleBloomFilter(byte[] rawBitArray, int offset, int length)
bitArraySize
- The number of bits 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').rawBitArray
- The data that will be used in the backing BitSetoffset
- The offset of the arraylength
- The length of the arraypublic SimpleBloomFilter(int bitArraySize, int expectedElements, BitSet bitSet)
bitArraySize
- The number of bits 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 BitSetRuntimeException
- If bitArraySize is not a multiple of eight.public double expectedFalsePositiveProbability()
public int getExpectedElements()
public boolean add(E o)
public boolean addAll(Collection<? extends E> c)
public void clear()
public boolean contains(Object o)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
public 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 byte[] toByteArray()
public static final byte[] intToByteArray(int value1, int value2, byte[] me)
public static final int byteArrayToInt(byte[] me, int offset)
public SimpleBloomFilter<E> merge(SimpleBloomFilter<E> toMerge)
public boolean equals(Object obj)
public int hashCode()
Copyright © 2013. All Rights Reserved.