Class BloomFilterUtils
- java.lang.Object
-
- org.apache.sling.resourceresolver.impl.mapping.BloomFilterUtils
-
public class BloomFilterUtils extends Object
Bloom filter utilities.
-
-
Constructor Summary
Constructors Constructor Description BloomFilterUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
add(byte[] bloom, Object key)
Add the key.static byte[]
createFilter(int elementCount, int maxBytes)
Create a bloom filter array for the given number of elements.static boolean
probablyContains(byte[] bloom, Object key)
Check whether the given key is probably in the set.static void
remove(byte[] bloom, Object key)
Remove the key.
-
-
-
Method Detail
-
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
public static void add(byte[] bloom, Object key)
Add the key.- Parameters:
bloom
- the bloom filterkey
- the key
-
remove
public static void remove(byte[] bloom, Object key)
Remove the key.- Parameters:
bloom
- the bloom filterkey
- the key
-
probablyContains
public static boolean probablyContains(byte[] bloom, Object key)
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
-
-