/**
 * Space-efficient probabilistic data structure that allows testing whether a key is included in the set or not
 * Provides definite "not in set" answer and a probabilistic "is in set" answer, certainty probability of which can be controlled
 * @see https://en.wikipedia.org/wiki/Cuckoo_filter
 * @description Inspired by MGunlogson's CuckooFilter4J library
 */
export class CuckooFilter {
    /**
     *
     * @param {number} fpp False Positive Probability, this is the expected chance that filter will return a false-positive
     * @param {number} maxKeys Expected number of entries in the filter for the given fpp, beyond this value fpp will sharply decrease
     */
    constructor({ fpp, maxKeys }?: number);
    /**
     * how many bits are needed per tag
     * @readonly
     * @type {number}
     */
    readonly bits_per_tag: number;
    /**
     * @readonly
     * @type {number}
     */
    readonly tag_hash_mask: number;
    /**
     * compute how many buckets we'll need
     * @readonly
     * @type {number}
     */
    readonly bucket_count: number;
    /**
     * Actual data storage
     * @readonly
     * @type {BitSet}
     */
    readonly data: BitSet;
    /**
     * @private
     * @type {number}
     */
    private __count;
    /**
     *
     * @type {boolean}
     * @private
     */
    private __victim_exists;
    /**
     *
     * @type {number}
     * @private
     */
    private __victim_tag;
    /**
     *
     * @type {number}
     * @private
     */
    private __victim_index;
    /**
     *
     * @returns {number}
     */
    get count(): number;
    /**
     *
     * @param {number} bucket_index
     * @param {number} position_in_bucket
     * @returns {number}
     * @private
     */
    private __getTagOffset;
    /**
     * Check if a tag in a given position in a bucket matches the tag you passed
     * it. Faster than regular read because it stops checking if it finds a
     * non-matching bit.
     * @param {number} bucket_index
     * @param {number} position_in_bucket
     * @param {number} tag
     * @returns {boolean}
     * @private
     */
    private __checkTag;
    /**
     *
     * @param {number} bucket_index
     * @param {number} tag
     * @returns {boolean}
     * @private
     */
    private __insertToBucket;
    /**
     *
     * @param {number} bucket_index
     * @param {number} pos_in_bucket
     * @param {number} tag
     * @private
     */
    private __writeTagNoClear;
    /**
     * Deletes (clears) a tag at a specific bucket index and position
     * @param {number} bucket_index
     * @param {number} position_in_bucket
     * @private
     */
    private __deleteTag;
    /**
     * Deletes an item from the table if it is found in the bucket
     * @param {number} bucket_index
     * @param {number} tag
     * @returns {boolean}
     * @private
     */
    private __deleteFromBucket;
    /**
     * Similar to checkTag() except it counts the number of matches in the
     * buckets.
     * @param {number} bucket_index_a First bucket to look for tag in
     * @param {number} bucket_index_b Second bucket to look for tag in
     * @param {number} tag
     * @returns {number}
     */
    __countTag(bucket_index_a: number, bucket_index_b: number, tag: number): number;
    /**
     * Finds a tag if present in two buckets.
     * @param {number} bucket_index_a First bucket to look for tag in
     * @param {number} bucket_index_b Second bucket to look for tag in
     * @param {number} tag
     * @returns {boolean}
     */
    __findTag(bucket_index_a: number, bucket_index_b: number, tag: number): boolean;
    /**
     * Reads a tag and sets the bits to a new tag at same time for max
     * speedification
     * @param {number} bucket_index
     * @param {number} position_in_bucket
     * @param {number} new_tag
     * @returns {number} existing tag
     * @private
     */
    private __readTagAndSet;
    /**
     * Replaces a tag in a random position in the given bucket and returns the
     * tag that was replaced.
     * @param {number} bucket_index bucket index
     * @param {number} tag
     * @returns {number} replaced tag
     * @private
     */
    private __swapRandomTagInBucket;
    /**
     * Given an item hash, provide a bucket index where the said item should go
     * @param {number} hash
     * @returns {number}
     * @private
     */
    private __compute_bucket_index_from_hash;
    /**
     * For cuckoo filtering to work correctly, this method must produce reversible result,
     * given tag X and input index A, result must always be B and,
     * given tag X and input index B, result must always be A.
     * see the original paper for more in-depth explanation
     * @see "Cuckoo Filter: Practically Better Than Bloom" by Bin Fan et al. 2014
     * @param {number} index
     * @param {number} tag
     * @returns {number}
     * @private
     */
    private __compute_alt_bucket_index;
    /**
     *
     * @param {number} hash
     * @returns {number}
     * @private
     */
    private __compute_tag_from_hash;
    /**
     * Puts an element into this {@link CuckooFilter}. Ensures that subsequent
     * invocations of {@link #mightContain(Object)} with the same element will
     * always return `true`.
     *
     * Note that the filter should be considered full after insertion failure.
     * Further inserts <i>may</i> fail, although deleting items can also make
     * the filter usable again.
     *
     * Also note that inserting the same item more than 8 times will cause an
     * insertion failure.
     *
     * @param {number} hash hash of item to insert
     * @returns {boolean} `true` if the cuckoo filter inserts this item successfully.
     *         Returns `false` if insertion failed.
     */
    insert(hash: number): boolean;
    __insertVictimIfExists(): void;
    /**
     *
     * @param {number} i1
     * @param {number} i2
     * @param {number} tag
     * @returns {boolean}
     * @private
     */
    private __checkVictim;
    /**
     * Deletes an element from this {@link CuckooFilter}. In most cases you
     * should only delete items that have been previously added to the filter.
     * Attempting to delete non-existent items may successfully delete the wrong
     * item in the filter, causing a false negative. False negatives are defined
     * as( {@link #mightContain(Object)} returning false for an item that
     * <i>has</i> been added to the filter. Deleting non-existent items doesn't
     * otherwise adversely affect the state of the filter, so attempting to
     * delete items that <i>may not</i> have been inserted is fine if false
     * negatives are acceptable. The false-delete rate is similar to the false
     * positive rate. False deletes can also cause the
     * {@link #approximateCount(Object)} to return both lower and higher than
     * the real count
     *
     * @param {number} hash
     * @returns {boolean} `true` if the cuckoo filter deleted this item successfully.
     *         Returns `false` if the item was not found.
     */
    remove(hash: number): boolean;
    /**
     * Returns `true` if the element <i>might</i> have been put in this
     * Cuckoo filter, `false` if this is <i>definitely</i> not the case.
     *
     * @param {number} hash
     * @returns {boolean}
     */
    mightContain(hash: number): boolean;
}
import { BitSet } from "../binary/BitSet.js";
//# sourceMappingURL=CuckooFilter.d.ts.map