java.lang.Object
Model.gameClasses.BloomFilter
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBloomFilter(int bits, String... algs) gets a string and hashes it using the hashFunctions that are passed in the constructor, then turn all these bits on to 1. -
Method Summary
-
Field Details
-
bitSet
-
hashFuncs
-
-
Constructor Details
-
BloomFilter
gets a string and hashes it using the hashFunctions that are passed in the constructor, then turn all these bits on to 1.- Parameters:
bits- the length of the bit vectoralgs- the name of the HashFunctions we will use
-
-
Method Details
-
add
put a given word in the bloom filter- Parameters:
word- the word we will put in the bloom filter
-
contains
Check if a given word exists in the bloom filter- Parameters:
word- the word we will check if it exists in the bloom filter- Returns:
- true if the word exists (may be false positive), false if the word doesn't exist.
-
toString
converts the bitset into a string
-