org.apache.cassandra.utils

## Class LegacyBloomFilter

- java.lang.Object
- - org.apache.cassandra.utils.LegacyBloomFilter

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, IFilter

      public class LegacyBloomFilter
      extends java.lang.Object
      implements IFilter

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static LegacyBloomFilterSerializer` | `serializer`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(java.nio.ByteBuffer key)`
    `static LegacyBloomFilter` | `alwaysMatchingBloomFilter()`
    `void` | `clear()`
    `void` | `close()`
    `java.util.BitSet` | `getBitSet()`
    `static LegacyBloomFilter` | `getFilter(long numElements, double maxFalsePosProbability)`
    `static LegacyBloomFilter` | `getFilter(long numElements, int targetBucketsPerElem)`
    `int[]` | `getHashBuckets(java.nio.ByteBuffer key)`
    `boolean` | `isPresent(java.nio.ByteBuffer key)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### serializer

          public static final LegacyBloomFilterSerializer serializer

  - ### Method Detail

    - #### getFilter

          public static LegacyBloomFilter getFilter(long numElements,
                                    int targetBucketsPerElem)

      Returns:
        A LegacyBloomFilter with the lowest practical false positive probability for the given number of elements.

    - #### getFilter

          public static LegacyBloomFilter getFilter(long numElements,
                                    double maxFalsePosProbability)

      Returns:
        The smallest LegacyBloomFilter that can provide the given false positive probability rate for the given number of elements. Asserts that the given probability can be satisfied using this filter.

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `IFilter`

    - #### isPresent

          public boolean isPresent(java.nio.ByteBuffer key)

      Specified by:
        `isPresent` in interface `IFilter`

    - #### add

          public void add(java.nio.ByteBuffer key)

      Specified by:
        `add` in interface `IFilter`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### alwaysMatchingBloomFilter

          public static LegacyBloomFilter alwaysMatchingBloomFilter()

      Returns:
        a LegacyBloomFilter that always returns a positive match, for testing

    - #### getHashBuckets

          public int[] getHashBuckets(java.nio.ByteBuffer key)

    - #### getBitSet

          public java.util.BitSet getBitSet()

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Throws:
        `java.io.IOException`

Copyright © 2014 The Apache Software Foundation