Packages

abstract class BloomFilter extends AnyRef

A Bloom filter is a space-efficient probabilistic data structure that offers an approximate containment test with one-sided error: if it claims that an item is contained in it, this might be in error, but if it claims that an item is not contained in it, then this is definitely true. Currently supported data types include:

  • Byte
  • Short
  • Integer
  • Long
  • String

The false positive probability (FPP) of a Bloom filter is defined as the probability that #mightContain(Object) will erroneously return true for an object that has not actually been put in the BloomFilter.

The implementation is largely based on the BloomFilter class from Guava.

Source
BloomFilter.java
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BloomFilter
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new BloomFilter()

Abstract Value Members

  1. abstract def bitSize(): Long

    Returns the number of bits in the underlying bit array.

  2. abstract def expectedFpp(): Double

    Returns the probability that #mightContain(Object) erroneously return true for an object that has not actually been put in the BloomFilter.

    Returns the probability that #mightContain(Object) erroneously return true for an object that has not actually been put in the BloomFilter.

    Ideally, this number should be close to the fpp parameter passed in double), or smaller. If it is significantly higher, it is usually the case that too many items (more than expected) have been put in the BloomFilter, degenerating it.

  3. abstract def intersectInPlace(other: BloomFilter): BloomFilter

    Combines this bloom filter with another bloom filter by performing a bitwise AND of the underlying data.

    Combines this bloom filter with another bloom filter by performing a bitwise AND of the underlying data. The mutations happen to this instance. Callers must ensure the bloom filters are appropriately sized to avoid saturating them.

    other

    The bloom filter to combine this bloom filter with. It is not mutated.

    Exceptions thrown

    IncompatibleMergeException if isCompatible(other) == false

  4. abstract def isCompatible(other: BloomFilter): Boolean

    Determines whether a given bloom filter is compatible with this bloom filter.

    Determines whether a given bloom filter is compatible with this bloom filter. For two bloom filters to be compatible, they must have the same bit size.

    other

    The bloom filter to check for compatibility.

  5. abstract def mergeInPlace(other: BloomFilter): BloomFilter

    Combines this bloom filter with another bloom filter by performing a bitwise OR of the underlying data.

    Combines this bloom filter with another bloom filter by performing a bitwise OR of the underlying data. The mutations happen to this instance. Callers must ensure the bloom filters are appropriately sized to avoid saturating them.

    other

    The bloom filter to combine this bloom filter with. It is not mutated.

    Exceptions thrown

    IncompatibleMergeException if isCompatible(other) == false

  6. abstract def mightContain(item: AnyRef): Boolean

    Returns true if the element might have been put in this Bloom filter, false if this is definitely not the case.

  7. abstract def mightContainBinary(item: Array[Byte]): Boolean

    A specialized variant of #mightContain(Object) that only tests byte array items.

  8. abstract def mightContainLong(item: Long): Boolean

    A specialized variant of #mightContain(Object) that only tests long items.

  9. abstract def mightContainString(item: String): Boolean

    A specialized variant of #mightContain(Object) that only tests String items.

  10. abstract def put(item: AnyRef): Boolean

    Puts an item into this BloomFilter.

    Puts an item into this BloomFilter. Ensures that subsequent invocations of #mightContain(Object) with the same item will always return true.

    returns

    true if the bloom filter's bits changed as a result of this operation. If the bits changed, this is definitely the first time object has been added to the filter. If the bits haven't changed, this might be the first time object has been added to the filter. Note that put(t) always returns the opposite result to what mightContain(t) would have returned at the time it is called.

  11. abstract def putBinary(item: Array[Byte]): Boolean

    A specialized variant of #put(Object) that only supports byte array items.

  12. abstract def putLong(item: Long): Boolean

    A specialized variant of #put(Object) that only supports long items.

  13. abstract def putString(item: String): Boolean

    A specialized variant of #put(Object) that only supports String items.

  14. abstract def writeTo(out: OutputStream): Unit

    Writes out this BloomFilter to an output stream in binary format.

    Writes out this BloomFilter to an output stream in binary format. It is the caller's responsibility to close the stream.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def cardinality(): Long

    returns

    the number of set bits in this BloomFilter.

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  15. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  18. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped