/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
/**
 * RangeMap represents a mapping from keys of type K to values of type V or undefined.
 * The set of all possible keys is assumed to be fully ordered,
 * and for each key there should be a single next higher key.
 * The values for a range of consecutive keys can be changed or queried in a single operation.
 * The structure of the keys is described by the `offsetKey` and `subtractKeys` functions provided in the constructor.
 */
export declare class RangeMap<K, V> {
    private readonly offsetKey;
    private readonly subtractKeys;
    readonly offsetValue: (value: V, offset: number) => V;
    private tree;
    /**
     * @param offsetKey - Function which returns a new key which is `offset` keys after `key`.
     * When `offset` is negative, the returned key should come before `key`.
     *
     * @param subtractKeys - Function which returns the difference between `b` and `a`.
     * Offsetting `b` by this difference should return `a`.
     * The difference can be infinite if `a` cannot be reached from `b` by offsetting,
     * but the difference should still be positive if `a` is larger than `b` and negative if smaller.
     *
     * @param offsetValue - Function used to associate a range of values with a range of keys.
     * When writing to a range of keys starting with `start`, the value of the nth key is interpreted to be
     * `offsetValue(firstValue, n - 1)`.
     * The same logic should be used when interpreting the values for keys after the first in a
     * `RangeQueryResult` or `RangeQueryEntry`.
     *
     * If `offsetValue` is left unspecified, all keys in a block will be given the same value.
     */
    constructor(offsetKey: (key: K, offset: number) => K, subtractKeys: (a: K, b: K) => number, offsetValue?: (value: V, offset: number) => V);
    /**
     * Retrieves all entries from the RangeMap.
     */
    entries(): RangeQueryEntry<K, V>[];
    clear(): void;
    /**
     * Retrieves the values for all keys in the query range.
     *
     * @param start - The first key in the range being queried
     * @param length - The length of the query range
     * @returns A list of entries, each describing the value for some subrange of the query.
     * The entries are in the same order as the keys, and there is an entry for every key with a non `undefined` value.
     */
    getAll(start: K, length: number): RangeQueryEntry<K, V>[];
    /**
     * Retrieves the value for some prefix of the query range.
     *
     * @param start - The first key in the query range.
     * @param length - The length of the query range.
     * @returns A RangeQueryResult containing the value associated with `start`,
     * and the number of consecutive keys with that same value (at least 1, at most `length`).
     */
    getFirst(start: K, length: number): RangeQueryResult<K, V>;
    /**
     * Sets the value for a specified range.
     *
     * @param start - The first key in the range being set.
     * @param length - The length of the range.
     * @param value - The value to associate with the range.
     */
    set(start: K, length: number, value: V | undefined): void;
    /**
     * Deletes values within a specified range, updating or removing existing entries.
     *
     * 1. If an entry is completely included in the deletion range, the whole entry will be deleted
     * e.g.: map = [[1, 2], [4, 6]], delete range: [3, 6]
     * map becomes [[1, 2]] after deletion
     * (Note: the notation [a, b] represents start = a, end = b for simpler visualization, instead of `b`
     * representing the length)
     *
     * 2. If an entry is partially overlapped with the deletion range, the start or end point will be shifted
     * e.g.: map = [[1, 2], [4, 6]], delete range: [2, 4]
     * map becomes [[1, 1], [5, 6]] after deletion
     *
     * 3. If an entry completely includes the deletion range, the original entry may be split into two.
     * e.g.: map = [[1, 6]], delete range: [2, 4]
     * map becomes [[1, 1], [5, 6]]
     *
     * @param start - The start of the range to delete (inclusive).
     * @param length - The length of the range to delete.
     */
    delete(start: K, length: number): void;
    clone(): RangeMap<K, V>;
    /**
     * Returns a new map which contains the entries from both input maps.
     */
    static union<K, V>(a: RangeMap<K, V>, b: RangeMap<K, V>): RangeMap<K, V>;
    private getIntersectingEntries;
    private gt;
    private ge;
    private lt;
    private le;
}
/**
 * Describes the result of a range query, including the value and length of the matching prefix.
 */
export interface RangeQueryResult<K, V> {
    /**
     * The key for the first element in the range.
     */
    readonly start: K;
    /**
     * The value of the first key in the query range.
     * If no matching range is found, this will be undefined.
     */
    readonly value: V | undefined;
    /**
     * The length of the prefix of the query range which has the same value.
     * For example, if a RangeMap has the same value for keys 5, 6, and 7,
     * a query about the range [5, 10] would give a result with length 3.
     */
    readonly length: number;
}
export interface RangeQueryEntry<K, V> extends RangeQueryResult<K, V> {
    readonly value: V;
}
export declare function newIntegerRangeMap<V>(): RangeMap<number, V>;
//# sourceMappingURL=rangeMap.d.ts.map