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
- Alphabetic
- By Inheritance
- BloomFilter
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new BloomFilter()
Abstract Value Members
- abstract def bitSize(): Long
Returns the number of bits in the underlying bit array.
- abstract def expectedFpp(): Double
Returns the probability that #mightContain(Object) erroneously return
true
for an object that has not actually been put in theBloomFilter
.Returns the probability that #mightContain(Object) erroneously return
true
for an object that has not actually been put in theBloomFilter
.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 theBloomFilter
, degenerating it. - 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
ifisCompatible(other) == false
- 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.
- 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
ifisCompatible(other) == false
- 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. - abstract def mightContainBinary(item: Array[Byte]): Boolean
A specialized variant of
#mightContain(Object)
that only tests byte array items. - abstract def mightContainLong(item: Long): Boolean
A specialized variant of
#mightContain(Object)
that only testslong
items. - abstract def mightContainString(item: String): Boolean
A specialized variant of
#mightContain(Object)
that only testsString
items. - 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 returntrue
.- 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 timeobject
has been added to the filter. Note thatput(t)
always returns the opposite result to whatmightContain(t)
would have returned at the time it is called.
- abstract def putBinary(item: Array[Byte]): Boolean
A specialized variant of
#put(Object)
that only supports byte array items. - abstract def putLong(item: Long): Boolean
A specialized variant of
#put(Object)
that only supportslong
items. - abstract def putString(item: String): Boolean
A specialized variant of
#put(Object)
that only supportsString
items. - 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
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def cardinality(): Long
- returns
the number of set bits in this
BloomFilter
.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)