public class BloomFilterCalculations
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
BloomFilterCalculations.BloomFilterSpecification
A wrapper class that holds two key parameters for a Bloom Filter: the
number of hash functions used, and the size of the bit set.
|
Modifier and Type | Field and Description |
---|---|
static double |
ARRAY_SIZE_DENOMINATOR_CALC |
static double |
ELEMENT_SIZE_NUMERATOR_CALC |
static long |
MAX_BIT_ARRAY_SIZE |
static double |
MAX_BITSET_SIZE_CHANGE |
static double |
OPTIMAL_NUM_HASH_FUNCTIONS_MULTIPLIER |
Constructor and Description |
---|
BloomFilterCalculations() |
Modifier and Type | Method and Description |
---|---|
static BloomFilterCalculations.BloomFilterSpecification |
computeBloomFilterSpec(long n,
double p) |
static long |
getMinBitArraySize(long n,
double falsePositiveProbability)
Returns the minimum bit array size (m) to satisfy the desired false
positive probability based on the number of elements expected for the
bloom filter.
|
static long |
maxNumberOfElementsForDesiredFalsePositiveProbability(double falsePositiveProbability)
Returns the maximum number of elements (n) the LongFastBloomFilter can hold
based on MAX_BIT_ARRAY_SIZE while still maintaining the desired false positive
probability.
|
static int |
optimalNumberOfHashFunctions(long bitSetSize,
long predictedNumElements) |
static BloomFilterCalculations.BloomFilterSpecification |
optimizeBloomFilterForSpeed(int k,
long m,
long n,
double p) |
public static final long MAX_BIT_ARRAY_SIZE
public static final double OPTIMAL_NUM_HASH_FUNCTIONS_MULTIPLIER
public static final double ARRAY_SIZE_DENOMINATOR_CALC
public static final double ELEMENT_SIZE_NUMERATOR_CALC
public static final double MAX_BITSET_SIZE_CHANGE
public static long getMinBitArraySize(long n, double falsePositiveProbability)
n
- - the number of expected elements for the bloom filterfalsePositiveProbability
- public static long maxNumberOfElementsForDesiredFalsePositiveProbability(double falsePositiveProbability)
falsePositiveProbability
- public static int optimalNumberOfHashFunctions(long bitSetSize, long predictedNumElements)
public static BloomFilterCalculations.BloomFilterSpecification computeBloomFilterSpec(long n, double p)
public static BloomFilterCalculations.BloomFilterSpecification optimizeBloomFilterForSpeed(int k, long m, long n, double p)