org.archive.util
Interface BloomFilter

All Known Implementing Classes:
BloomFilter32bit, BloomFilter32bitSplit, BloomFilter32bp2, BloomFilter32bp2Split, BloomFilter64bit

public interface BloomFilter

Common interface for different Bloom filter implementations

Author:
Gordon Mohr

Method Summary
 boolean add(java.lang.CharSequence s)
          Adds a character sequence to the filter.
 boolean contains(java.lang.CharSequence s)
          Checks whether the given character sequence is in this filter.
 long getSizeBytes()
          The amount of memory in bytes consumed by the bloom bitfield.
 int size()
          The number of character sequences in the filter.
 

Method Detail

size

int size()
The number of character sequences in the filter.

Returns:
the number of character sequences in the filter (but see contains(CharSequence)).

contains

boolean contains(java.lang.CharSequence s)
Checks whether the given character sequence is in this filter.

Note that this method may return true on a character sequence that is has not been added to the filter. This will happen with probability 2-d, where d is the number of hash functions specified at creation time, if the number of the elements in the filter is less than n, the number of expected elements specified at creation time.

Parameters:
s - a character sequence.
Returns:
true if the sequence is in the filter (or if a sequence with the same hash sequence is in the filter).

add

boolean add(java.lang.CharSequence s)
Adds a character sequence to the filter.

Parameters:
s - a character sequence.
Returns:
true if the character sequence was not in the filter (but see contains(CharSequence)).

getSizeBytes

long getSizeBytes()
The amount of memory in bytes consumed by the bloom bitfield.

Returns:
memory used by bloom bitfield, in bytes


Copyright © 2003-2008 Internet Archive. All Rights Reserved.