org.edg.data.util
Class SimpleBloomFilter

java.lang.Object
  |
  +--org.edg.data.util.BloomFilter
        |
        +--org.edg.data.util.SimpleBloomFilter
All Implemented Interfaces:
java.io.Serializable

public final class SimpleBloomFilter
extends BloomFilter

A Representation of a Bloom Filter. See The Math of Bloom Filters for how to tune the Filter. Note you must specify the size of the filter a priori (i.e. set m), but it can tell you when it has too many entries, and will start to degrade (i.e. more than n entries. We use MD5 to compute the hash functions, which are fixed to 4.

Version:
$ Id:$
Author:
James Casey
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.edg.data.util.BloomFilter
m_bits
 
Constructor Summary
SimpleBloomFilter(byte[] bits, int entries, int numBits, int optimalNumKeys)
           
SimpleBloomFilter(int bitsPerEntry, int optimalNumKeys)
           
 
Method Summary
protected  void clearBit(int bit)
           
protected  boolean isSet(int bit)
           
protected  void setBit(int bit)
           
 
Methods inherited from class org.edg.data.util.BloomFilter
add, contains, delete, equals, getNumberOfHashes, getNumBits, getNumEntries, getOptimalNumKeys, hashCode, isFull, toString, writeBits
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleBloomFilter

public SimpleBloomFilter(int bitsPerEntry,
                         int optimalNumKeys)

SimpleBloomFilter

public SimpleBloomFilter(byte[] bits,
                         int entries,
                         int numBits,
                         int optimalNumKeys)
Method Detail

setBit

protected void setBit(int bit)
Specified by:
setBit in class BloomFilter

clearBit

protected void clearBit(int bit)
Specified by:
clearBit in class BloomFilter

isSet

protected boolean isSet(int bit)
Specified by:
isSet in class BloomFilter