org.apache.cassandra.utils
Class BloomFilter

java.lang.Object
  extended by org.apache.cassandra.utils.Filter
      extended by org.apache.cassandra.utils.BloomFilter

public class BloomFilter
extends Filter


Method Summary
 void add(byte[] key)
           
 void add(java.lang.String key)
           
static BloomFilter alwaysMatchingBloomFilter()
           
 void clear()
           
static BloomFilter getFilter(long numElements, double maxFalsePosProbability)
           
static BloomFilter getFilter(long numElements, int targetBucketsPerElem)
           
 boolean isPresent(byte[] key)
           
 boolean isPresent(java.lang.String key)
           
static ICompactSerializer<BloomFilter> serializer()
           
 java.lang.String toString()
           
 
Methods inherited from class org.apache.cassandra.utils.Filter
getHashBuckets, getHashBuckets
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

serializer

public static ICompactSerializer<BloomFilter> serializer()

getFilter

public static BloomFilter getFilter(long numElements,
                                    int targetBucketsPerElem)
Returns:
A BloomFilter with the lowest practical false positive probability for the given number of elements.

getFilter

public static BloomFilter getFilter(long numElements,
                                    double maxFalsePosProbability)
Returns:
The smallest BloomFilter that can provide the given false positive probability rate for the given number of elements. Asserts that the given probability can be satisfied using this filter.

clear

public void clear()

isPresent

public boolean isPresent(java.lang.String key)
Specified by:
isPresent in class Filter

isPresent

public boolean isPresent(byte[] key)

add

public void add(java.lang.String key)
Specified by:
add in class Filter

add

public void add(byte[] key)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

alwaysMatchingBloomFilter

public static BloomFilter alwaysMatchingBloomFilter()
Returns:
a BloomFilter that always returns a positive match, for testing


Copyright © 2010 The Apache Software Foundation