Enum BloomFilterStrategies

  • All Implemented Interfaces:
    BloomFilter.Strategy, java.io.Serializable, java.lang.Comparable<BloomFilterStrategies>

    enum BloomFilterStrategies
    extends java.lang.Enum<BloomFilterStrategies>
    implements BloomFilter.Strategy
    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.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static BloomFilterStrategies valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static BloomFilterStrategies[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • MURMUR128_MITZ_32

        public static final BloomFilterStrategies 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

        public static final BloomFilterStrategies MURMUR128_MITZ_64
        This strategy uses all 128 bits of Hashing.murmur3_128(int) when hashing. It looks different than 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 Detail

      • BloomFilterStrategies

        private BloomFilterStrategies()
    • Method Detail

      • values

        public static BloomFilterStrategies[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (BloomFilterStrategies c : BloomFilterStrategies.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static BloomFilterStrategies valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null