Interface BloomFilter.Strategy

All Superinterfaces:
Serializable
All Known Implementing Classes:
BloomFilterStrategies
Enclosing class:
BloomFilter<T>

static interface BloomFilter.Strategy extends Serializable
A strategy to translate T instances, to numHashFunctions bit indexes.

Implementations should be collections of pure functions (i.e. stateless).

  • Method Summary

    Modifier and Type
    Method
    Description
    <T> boolean
    mightContain(T object, Funnel<? super T> funnel, int numHashFunctions, BloomFilterStrategies.LockFreeBitArray bits)
    Queries numHashFunctions bits of the given bit array, by hashing a user element; returns true if and only if all selected bits are set.
    int
    Identifier used to encode this strategy, when marshalled as part of a BloomFilter.
    <T> boolean
    put(T object, Funnel<? super T> funnel, int numHashFunctions, BloomFilterStrategies.LockFreeBitArray bits)
    Sets numHashFunctions bits of the given bit array, by hashing a user element.
  • Method Details

    • put

      <T> boolean put(T object, Funnel<? super T> funnel, int numHashFunctions, BloomFilterStrategies.LockFreeBitArray bits)
      Sets numHashFunctions bits of the given bit array, by hashing a user element.

      Returns whether any bits changed as a result of this operation.

    • mightContain

      <T> boolean mightContain(T object, Funnel<? super T> funnel, int numHashFunctions, BloomFilterStrategies.LockFreeBitArray bits)
      Queries numHashFunctions bits of the given bit array, by hashing a user element; returns true if and only if all selected bits are set.
    • ordinal

      int ordinal()
      Identifier used to encode this strategy, when marshalled as part of a BloomFilter. Only values in the [-128, 127] range are valid for the compact serial form. Non-negative values are reserved for enums defined in BloomFilterStrategies; negative values are reserved for any custom, stateful strategy we may define (e.g. any kind of strategy that would depend on user input).