/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import * as Base from "./base";
export declare class Stack<T> {
    items: T[];
    push(val: T): void;
    empty(): boolean;
    top(): T | undefined;
    pop(): T | undefined;
}
export declare function ListRemoveEntry<U>(entry: List<U>): List<U> | undefined;
export declare function ListMakeEntry<U>(data: U): List<U>;
export declare function ListMakeHead<U>(): List<U>;
export declare class List<T> {
    isHead: boolean;
    data: T | undefined;
    next: List<T>;
    prev: List<T>;
    constructor(isHead: boolean, data: T | undefined);
    clear(): void;
    add(data: T): List<T>;
    dequeue(): T | undefined;
    enqueue(data: T): List<T>;
    walk(fn: (data: T, l: List<T>) => void): void;
    some(fn: (data: T, l: List<T>) => boolean, rev?: boolean): T[];
    count(): number;
    first(): T | undefined;
    last(): T | undefined;
    empty(): boolean;
    pushEntry(entry: List<T>): void;
    push(data: T): void;
    popEntry(head: List<T>): List<T> | undefined;
    insertEntry(entry: List<T>): List<T>;
    insertAfter(data: T): List<T>;
    insertBefore(data: T): List<T>;
    insertEntryBefore(entry: List<T>): List<T>;
}
export interface Comparer<T> {
    compare(a: T, b: T): number;
    min: T;
}
export declare const numberComparer: Comparer<number>;
export declare class Heap<T> {
    comp: Comparer<T>;
    L: T[];
    count(): number;
    constructor(a: T[], comp: Comparer<T>);
    peek(): T;
    get(): T;
    add(x: T): void;
    private fixup;
    private fixdown;
}
export declare function LinearDictionary<TKey, TData>(compareKeys: Base.KeyComparer<TKey>): Base.SortedDictionary<TKey, TData>;
export declare const enum RBColor {
    RED = 0,
    BLACK = 1
}
export interface RBNode<TKey, TData> {
    key: TKey;
    data: TData;
    left: RBNode<TKey, TData> | undefined;
    right: RBNode<TKey, TData> | undefined;
    color: RBColor;
    size: number;
}
export interface IRBAugmentation<TKey, TData> {
    update(node: RBNode<TKey, TData>): any;
    init?(node: RBNode<TKey, TData>): any;
}
export interface IRBMatcher<TKey, TData> {
    continueSubtree(node: RBNode<TKey, TData> | undefined, key: TKey): boolean;
    matchNode(node: RBNode<TKey, TData> | undefined, key: TKey): boolean;
}
export interface RBNodeActions<TKey, TData> {
    infix?(node: RBNode<TKey, TData>): boolean;
    pre?(node: RBNode<TKey, TData>): boolean;
    post?(node: RBNode<TKey, TData>): boolean;
    showStructure?: boolean;
}
export declare class RedBlackTree<TKey, TData> implements Base.SortedDictionary<TKey, TData> {
    compareKeys: Base.KeyComparer<TKey>;
    aug?: IRBAugmentation<TKey, TData> | undefined;
    root: RBNode<TKey, TData> | undefined;
    constructor(compareKeys: Base.KeyComparer<TKey>, aug?: IRBAugmentation<TKey, TData> | undefined);
    makeNode(key: TKey, data: TData, color: RBColor, size: number): RBNode<TKey, TData>;
    isRed(node: RBNode<TKey, TData> | undefined): boolean;
    nodeSize(node: RBNode<TKey, TData> | undefined): number;
    size(): number;
    isEmpty(): boolean;
    get(key: TKey): RBNode<TKey, TData> | undefined;
    nodeGet(node: RBNode<TKey, TData> | undefined, key: TKey): RBNode<TKey, TData> | undefined;
    contains(key: TKey): RBNode<TKey, TData> | undefined;
    gather(key: TKey, matcher: IRBMatcher<TKey, TData>): RBNode<TKey, TData>[];
    nodeGather(node: RBNode<TKey, TData> | undefined, results: RBNode<TKey, TData>[], key: TKey, matcher: IRBMatcher<TKey, TData>): void;
    walkExactMatchesForward(compareFn: (node: RBNode<TKey, TData>) => number, actionFn: (node: RBNode<TKey, TData>) => void, continueLeftFn: (number: any) => boolean, continueRightFn: (number: any) => boolean): void;
    nodeWalkExactMatchesForward(node: RBNode<TKey, TData> | undefined, compareFn: (node: RBNode<TKey, TData>) => number, actionFn: (node: RBNode<TKey, TData>) => void, continueLeftFn: (number: any) => boolean, continueRightFn: (number: any) => boolean): void;
    walkExactMatchesBackward(compareFn: (node: RBNode<TKey, TData>) => number, actionFn: (node: RBNode<TKey, TData>) => void, continueLeftFn: (number: any) => boolean, continueRightFn: (number: any) => boolean): void;
    nodeWalkExactMatchesBackward(node: RBNode<TKey, TData> | undefined, compareFn: (node: RBNode<TKey, TData>) => number, actionFn: (node: RBNode<TKey, TData>) => void, continueLeftFn: (cmp: number) => boolean, continueRightFn: (cmp: number) => boolean): void;
    put(key: TKey, data: TData, conflict?: Base.ConflictAction<TKey, TData>): void;
    nodePut(node: RBNode<TKey, TData> | undefined, key: TKey, data: TData, conflict?: Base.ConflictAction<TKey, TData>): RBNode<TKey, TData>;
    updateLocal(node: RBNode<TKey, TData>): void;
    removeMin(): void;
    nodeRemoveMin(node: RBNode<TKey, TData>): RBNode<TKey, TData> | undefined;
    removeMax(): void;
    nodeRemoveMax(node: RBNode<TKey, TData>): RBNode<TKey, TData> | undefined;
    remove(key: TKey): void;
    removeExisting(key: TKey): void;
    nodeRemove(node: RBNode<TKey, TData>, key: TKey): RBNode<TKey, TData> | undefined;
    height(): number;
    nodeHeight(node: RBNode<TKey, TData> | undefined): number;
    floor(key: TKey): RBNode<TKey, TData> | undefined;
    nodeFloor(node: RBNode<TKey, TData> | undefined, key: TKey): RBNode<TKey, TData> | undefined;
    ceil(key: TKey): RBNode<TKey, TData> | undefined;
    nodeCeil(node: RBNode<TKey, TData> | undefined, key: TKey): RBNode<TKey, TData> | undefined;
    min(): RBNode<TKey, TData> | undefined;
    nodeMin(node: RBNode<TKey, TData>): RBNode<TKey, TData>;
    max(): RBNode<TKey, TData> | undefined;
    nodeMax(node: RBNode<TKey, TData>): RBNode<TKey, TData>;
    rotateRight(node: RBNode<TKey, TData>): RBNode<TKey, TData>;
    rotateLeft(node: RBNode<TKey, TData>): RBNode<TKey, TData>;
    oppositeColor(c: RBColor): RBColor;
    flipColors(node: RBNode<TKey, TData>): void;
    moveRedLeft(node: RBNode<TKey, TData>): RBNode<TKey, TData>;
    moveRedRight(node: RBNode<TKey, TData>): RBNode<TKey, TData>;
    balance(input: RBNode<TKey, TData>): RBNode<TKey, TData>;
    mapRange<TAccum>(action: Base.PropertyAction<TKey, TData>, accum?: TAccum, start?: TKey, end?: TKey): void;
    map<TAccum>(action: Base.PropertyAction<TKey, TData>, accum?: TAccum): void;
    keys(): TKey[];
    /**
     * Depth-first traversal with custom action; if action returns
     * false, traversal is halted.
     * @param action - action to apply to each node
     */
    walk(actions: RBNodeActions<TKey, TData>): void;
    walkBackward(actions: RBNodeActions<TKey, TData>): void;
    nodeWalk(node: RBNode<TKey, TData> | undefined, actions: RBNodeActions<TKey, TData>): any;
    nodeWalkBackward(node: RBNode<TKey, TData> | undefined, actions: RBNodeActions<TKey, TData>): any;
    nodeMap<TAccum>(node: RBNode<TKey, TData> | undefined, action: Base.PropertyAction<TKey, TData>, accum?: TAccum, start?: TKey, end?: TKey): any;
    diag(): void;
}
export interface AugIntegerRangeNode {
    minmax: Base.IIntegerRange;
}
export interface AugmentedIntervalNode {
    minmax: IInterval;
}
/**
 * Union of two ranges; assumes for both ranges start \<= end.
 * @param a - A range
 * @param b - A range
 */
export declare function integerRangeUnion(a: Base.IIntegerRange, b: Base.IIntegerRange): Base.IIntegerRange;
export declare function integerRangeOverlaps(a: Base.IIntegerRange, b: Base.IIntegerRange): boolean;
export declare function integerRangeComparer(a: Base.IIntegerRange, b: Base.IIntegerRange): number;
export declare const integerRangeCopy: (r: Base.IIntegerRange) => Base.IIntegerRange;
export declare const integerRangeToString: (range: Base.IIntegerRange) => string;
export declare type IntegerRangeNode = RBNode<Base.IIntegerRange, AugIntegerRangeNode>;
export declare class IntegerRangeTree implements IRBAugmentation<Base.IIntegerRange, AugIntegerRangeNode>, IRBMatcher<Base.IIntegerRange, AugIntegerRangeNode> {
    ranges: RedBlackTree<Base.IIntegerRange, AugIntegerRangeNode>;
    diag: boolean;
    remove(r: Base.IIntegerRange): void;
    put(r: Base.IIntegerRange): void;
    toString(): string;
    nodeToString(node: IntegerRangeNode | undefined): string;
    matchPos(pos: number): RBNode<Base.IIntegerRange, AugIntegerRangeNode>[];
    match(r: Base.IIntegerRange): RBNode<Base.IIntegerRange, AugIntegerRangeNode>[];
    matchNode(node: IntegerRangeNode | undefined, key: Base.IIntegerRange): boolean;
    continueSubtree(node: IntegerRangeNode | undefined, key: Base.IIntegerRange): boolean;
    update(node: IntegerRangeNode): void;
}
export interface IInterval {
    clone(): IInterval;
    compare(b: IInterval): number;
    compareStart(b: IInterval): number;
    compareEnd(b: IInterval): number;
    modify(label: string, start: number, end: number): any;
    overlaps(b: IInterval): boolean;
    union(b: IInterval): IInterval;
}
export declare const intervalComparer: (a: IInterval, b: IInterval) => number;
export declare type IntervalNode<T extends IInterval> = RBNode<T, AugmentedIntervalNode>;
export declare type IntervalConflictResolver<TInterval> = (a: TInterval, b: TInterval) => TInterval;
export declare class IntervalTree<T extends IInterval> implements IRBAugmentation<T, AugmentedIntervalNode>, IRBMatcher<T, AugmentedIntervalNode> {
    intervals: RedBlackTree<T, AugmentedIntervalNode>;
    diag: boolean;
    timePut: boolean;
    putTime: number;
    putCount: number;
    printTiming(): void;
    remove(x: T): void;
    removeExisting(x: T): void;
    put(x: T, conflict?: IntervalConflictResolver<T>): void;
    map(fn: (x: T) => void): void;
    mapUntil(fn: (X: T) => boolean): void;
    mapBackward(fn: (x: T) => void): void;
    match(x: T): RBNode<T, AugmentedIntervalNode>[];
    matchNode(node: IntervalNode<T> | undefined, key: T): boolean;
    continueSubtree(node: IntervalNode<T> | undefined, key: T): boolean;
    update(node: IntervalNode<T>): void;
}
export interface TSTResult<T> {
    key: string;
    val: T;
}
export interface TSTNode<T> {
    c: string;
    left?: TSTNode<T>;
    mid?: TSTNode<T>;
    right?: TSTNode<T>;
    val?: T;
}
export interface TSTPrefix {
    text: string;
}
export interface ProxString<T> {
    text: string;
    invDistance: number;
    val: T;
}
export declare class TST<T> {
    private n;
    private root;
    constructor();
    size(): number;
    contains(key: string): T | undefined;
    get(key: string): T | undefined;
    nodeGet(x: TSTNode<T> | undefined, key: string, d: number): TSTNode<T> | undefined;
    put(key: string, val: T): void;
    nodePut(x: TSTNode<T> | undefined, key: string, val: T, d: number): TSTNode<T>;
    neighbors(text: string, distance?: number): ProxString<T>[];
    keysWithPrefix(text: string): string[];
    collect(x: TSTNode<T> | undefined, prefix: TSTPrefix, q: string[]): void;
    mapNode(x: TSTNode<T> | undefined, prefix: TSTPrefix, fn: (key: string, val: T) => void): void;
    map(fn: (key: string, val: T) => void): void;
    pairsWithPrefix(text: string): TSTResult<T>[];
    collectPairs(x: TSTNode<T> | undefined, prefix: TSTPrefix, q: TSTResult<T>[]): void;
    patternCollect(x: TSTNode<T> | undefined, prefix: TSTPrefix, d: number, pattern: string, q: string[]): void;
    nodeProximity(x: TSTNode<T> | undefined, prefix: TSTPrefix, d: number, pattern: string, distance: number, q: ProxString<T>[]): void;
    match(pattern: string): string[];
}
//# sourceMappingURL=collections.d.ts.map