org.feijoas.mango.common.hash

BloomFilter

Related Docs: object BloomFilter | package hash

final case class BloomFilter[T] extends (T) ⇒ Boolean with Serializable with Product

A Bloom filter for instances of T. A Bloom filter offers an approximate containment test with one-sided error: if it claims that an element is contained in it, this might be in error, but if it claims that an element is not contained in it, then this is definitely true.

From the Guava BloomFilter tutorial:

implicit object PersonFunnel extends Funnel[Person] {
   override def funnel(from: Person, into: PrimitiveSink) = ...
}

val friends: BloomFilter[Person] = BloomFilter.create(500, 0.01)
friendsList.foreach { case p: Person => friends.put(p) }

// much later
if (friends.mightContain(dude)) {
   // the probability that dude reached this place if he isn't a friend is 1%
   // we might, for example, start asynchronously loading things for dude while we do a more expensive exact check
}

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

Annotations
@Beta() @SerialVersionUID()
Since

0.6 (copied from Guava-libraries)

Linear Supertypes
Product, Equals, Serializable, Serializable, (T) ⇒ Boolean, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. BloomFilter
  2. Product
  3. Equals
  4. Serializable
  5. Serializable
  6. Function1
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

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. def andThen[A](g: (Boolean) ⇒ A): (T) ⇒ A

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  5. def apply(input: T): Boolean

    Equivalent to #mightContain; provided only to satisfy the Predicate interface.

    Equivalent to #mightContain; provided only to satisfy the Predicate interface. When using a reference of type BloomFilter, always invoke #mightContain directly instead.

    Definition Classes
    BloomFilter → Function1
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def compose[A](g: (A) ⇒ T): (A) ⇒ Boolean

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  9. def copy(): BloomFilter[T]

    Creates a new BloomFilter that's a copy of this instance.

    Creates a new BloomFilter that's a copy of this instance. The new instance is equal to this instance but shares no mutable state.

  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def expectedFpp(): Double

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

    Returns the probability that #mightContain(T) will 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 #create(Integer, Double), or smaller. If it is significantly higher, it is usually the case that too many elements (more than expected) have been put in the BloomFilter, degenerating it.

  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. def mightContain(obj: T): Boolean

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

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

  16. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  19. def put(obj: T): Boolean

    Puts an element into this BloomFilter.

    Puts an element into this BloomFilter. Ensures that subsequent invocations of #mightContain(T) with the same element 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."

  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  21. def toString(): String

    Definition Classes
    BloomFilter → Function1 → AnyRef → Any
  22. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Product

Inherited from Equals

Inherited from Serializable

Inherited from Serializable

Inherited from (T) ⇒ Boolean

Inherited from AnyRef

Inherited from Any

Ungrouped