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:
ByteShortIntegerLongString
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.
- Alphabetic
- By Inheritance
- BloomFilter
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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
truefor an object that has not actually been put in theBloomFilter.Returns the probability that #mightContain(Object) erroneously return
truefor an object that has not actually been put in theBloomFilter.Ideally, this number should be close to the
fppparameter 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
IncompatibleMergeExceptionifisCompatible(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
IncompatibleMergeExceptionifisCompatible(other) == false
-
abstract
def
mightContain(item: Any): Boolean
Returns
trueif the element might have been put in this Bloom filter,falseif 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 testslongitems. -
abstract
def
mightContainString(item: String): Boolean
A specialized variant of
#mightContain(Object)that only testsStringitems. -
abstract
def
put(item: Any): 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
objecthas been added to the filter. If the bits haven't changed, this might be the first timeobjecthas 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 supportslongitems. -
abstract
def
putString(item: String): Boolean
A specialized variant of
#put(Object)that only supportsStringitems. -
abstract
def
writeTo(out: OutputStream): Unit
Writes out this
BloomFilterto an output stream in binary format.Writes out this
BloomFilterto 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( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @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
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()