public class SimpleBloomFilter extends Object implements BloomFilter
BloomFilter.| Constructor and Description |
|---|
SimpleBloomFilter(int numEntries,
double errorRate,
int hashType)
Create a new Bloom filter with the given configurations.
|
SimpleBloomFilter(String serString)
Create the bloom filter from serialized string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(String key)
Add a key to the
BloomFilter. |
BloomFilterTypeCode |
getBloomFilterTypeCode() |
boolean |
mightContain(String key)
Tests for key membership.
|
void |
readFields(DataInput in) |
String |
serializeToString()
Serialize the bloom filter as a string.
|
void |
write(DataOutput out) |
public SimpleBloomFilter(int numEntries,
double errorRate,
int hashType)
numEntries - The total number of entries.errorRate - maximum allowable error rate.hashType - type of the hashing function (see Hash).public SimpleBloomFilter(String serString)
serString - serialized string which represents the SimpleBloomFilterpublic void add(String key)
BloomFilterBloomFilter.add in interface BloomFilterkey - the key to the added to the BloomFilterpublic boolean mightContain(String key)
BloomFiltermightContain in interface BloomFilterkey - the key to be checked for membershiptrue if key may be found, false if key is not found for sure.public String serializeToString()
serializeToString in interface BloomFilterpublic void write(DataOutput out) throws IOException
IOExceptionpublic void readFields(DataInput in) throws IOException
IOExceptionpublic BloomFilterTypeCode getBloomFilterTypeCode()
getBloomFilterTypeCode in interface BloomFilterCopyright © 2021 The Apache Software Foundation. All rights reserved.