public class BloomFilterDictionary extends Object implements Dictionary
Constructor and Description |
---|
BloomFilterDictionary(com.google.common.hash.BloomFilter<String> bf)
Creates a new dictionary instance from the supplied
BloomFilter . |
Modifier and Type | Method and Description |
---|---|
com.google.common.hash.BloomFilter<String> |
getBloomFilter()
Returns the bloom filter used for searching.
|
boolean |
search(String word)
WARNING bloom filters may return true for a word that is NOT in the dictionary.
|
long |
size()
Returns an estimate for the number of words added to the dictionary.
|
String |
toString() |
public BloomFilterDictionary(com.google.common.hash.BloomFilter<String> bf)
BloomFilter
. The fpp (false-positive probability)
parameter of the given Bloom filter is a vitally important configuration concern. If it is too high, one risks user
frustration due to rejection of valid passwords; if it is too low, one risks excessive storage costs. Finding the
proper balance between acceptable user experience and storage costs is worth the time and effort required in
testing. The Guava default value of 3% is likely unsuitable for many if not most deployments.bf
- bloom filter used to determine if a word exists.public com.google.common.hash.BloomFilter<String> getBloomFilter()
public long size()
BloomFilter.approximateElementCount()
.size
in interface Dictionary
public boolean search(String word)
BloomFilter.mightContain(Object)
.search
in interface Dictionary
word
- to search forCopyright © 2003-2024 Virginia Tech. All Rights Reserved.