Package com.google.common.hash
Enum Class BloomFilterStrategies
- All Implemented Interfaces:
BloomFilter.Strategy
,Serializable
,Comparable<BloomFilterStrategies>
,Constable
Collections of strategies of generating the k * log(M) bits required for an element to be mapped
to a BloomFilter of M bits and k hash functions. These strategies are part of the serialized form
of the Bloom filters that use them, thus they must be preserved as is (no updates allowed, only
introduction of new versions).
Important: the order of the constants cannot change, and they cannot be deleted - we depend on their ordinal for BloomFilter serialization.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
Models a lock-free array of bits.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionSee "Less Hashing, Same Performance: Building a Better Bloom Filter" by Adam Kirsch and Michael Mitzenmacher.This strategy uses all 128 bits ofHashing.murmur3_128(int)
when hashing. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BloomFilterStrategies
Returns the enum constant of this class with the specified name.static BloomFilterStrategies[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Methods inherited from interface com.google.common.hash.BloomFilter.Strategy
mightContain, ordinal, put
-
Enum Constant Details
-
MURMUR128_MITZ_32
See "Less Hashing, Same Performance: Building a Better Bloom Filter" by Adam Kirsch and Michael Mitzenmacher. The paper argues that this trick doesn't significantly deteriorate the performance of a Bloom filter (yet only needs two 32bit hash functions). -
MURMUR128_MITZ_64
This strategy uses all 128 bits ofHashing.murmur3_128(int)
when hashing. It looks different from the implementation in MURMUR128_MITZ_32 because we're avoiding the multiplication in the loop and doing a (much simpler) += hash2. We're also changing the index to a positive number by AND'ing with Long.MAX_VALUE instead of flipping the bits.
-
-
Constructor Details
-
BloomFilterStrategies
private BloomFilterStrategies()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-