Class BloomFilterUtils
java.lang.Object
org.apache.sling.resourceresolver.impl.mapping.BloomFilterUtils
Bloom filter utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdd the key.static byte[]createFilter(int elementCount, int maxBytes) Create a bloom filter array for the given number of elements.static booleanprobablyContains(byte[] bloom, Object key) Check whether the given key is probably in the set.static voidRemove the key.
-
Constructor Details
-
BloomFilterUtils
public BloomFilterUtils()
-
-
Method Details
-
createFilter
public static byte[] createFilter(int elementCount, int maxBytes) Create a bloom filter array for the given number of elements.- Parameters:
elementCount- the number of entriesmaxBytes- the maximum number of bytes- Returns:
- the empty bloom filter
-
add
Add the key.- Parameters:
bloom- the bloom filterkey- the key
-
remove
Remove the key.- Parameters:
bloom- the bloom filterkey- the key
-
probablyContains
Check whether the given key is probably in the set. This method never returns false if the key is in the set, but possibly returns true even if it isn't.- Parameters:
bloom- the bloom filterkey- the key- Returns:
- true if the given key is probably in the set
-