import '../../../assert/js/assert.js';
import '../../../globals.js';
import Pool from '../../../phet-core/js/Pool.js';
type SegmentInfo<T> = {
    getMinX: (item: T, epsilon: number) => number;
    getMaxX: (item: T, epsilon: number) => number;
};
export default abstract class SegmentTree<T> implements SegmentInfo<T> {
    rootNode: SegmentNode<T>;
    private readonly epsilon;
    private readonly items;
    /**
     * @param epsilon - Used to expand the bounds of segments so we have some non-zero amount of "overlap" for our
     *                  segments
     */
    constructor(epsilon?: number);
    abstract getMinX(item: T, epsilon: number): number;
    abstract getMaxX(item: T, epsilon: number): number;
    /**
     * Calls interruptableCallback in turn for every "possibly overlapping" item stored in this tree.
     *
     * @param item - The item to use for the bounds range.
     * @param interruptableCallback - When this returns true, the search will be aborted
     */
    query(item: T, interruptableCallback: (item: T) => boolean): boolean;
    addItem(item: T): void;
    removeItem(item: T): void;
    /**
     * For assertion purposes
     */
    audit(): void;
    toString(): string;
}
declare class SegmentNode<T> {
    min: number;
    max: number;
    left: SegmentNode<T> | null;
    right: SegmentNode<T> | null;
    parent: SegmentNode<T> | null;
    splitValue: number | null;
    items: T[];
    isBlack: boolean;
    tree: SegmentTree<T>;
    constructor(tree: SegmentTree<T>, min: number, max: number);
    initialize(tree: SegmentTree<T>, min: number, max: number): this;
    contains(n: number): boolean;
    hasChildren(): boolean;
    /**
     * Iterates through interruptableCallback for every potentially overlapping edge - aborts when it returns true
     *
     * @param item
     * @param min - computed min for the item
     * @param max - computed max for the item
     * @param id - our 1-time id that we use to not repeat calls with the same item
     * @param interruptableCallback
     * @returns whether we were aborted
     */
    query(item: T, min: number, max: number, id: number, interruptableCallback: (item: T) => boolean): boolean;
    /**
     * Replaces one child with another
     */
    swapChild(oldChild: SegmentNode<T>, newChild: SegmentNode<T>): void;
    hasChild(node: SegmentNode<T>): boolean;
    otherChild(node: SegmentNode<T>): SegmentNode<T>;
    /**
     * Tree operation needed for red-black self-balancing
     */
    leftRotate(tree: SegmentTree<T>): void;
    /**
     * Tree operation needed for red-black self-balancing
     */
    rightRotate(tree: SegmentTree<T>): void;
    /**
     * Called after an insertion (or potentially deletion in the future) that handles red-black tree rebalancing.
     */
    fixRedBlack(tree: SegmentTree<T>): void;
    /**
     * Triggers a split of whatever interval contains this value (or is a no-op if we already split at it before).
     */
    split(n: number, tree: SegmentTree<T>): void;
    /**
     * Recursively adds an item
     */
    addItem(item: T, min: number, max: number): void;
    /**
     * Recursively removes an item
     */
    removeItem(item: T, min: number, max: number): void;
    /**
     * Recursively audits with assertions, checking all of our assumptions.
     *
     * @param epsilon
     * @param allItems - All items in the tree
     * @param presentItems - Edges that were present in ancestors
     */
    audit(epsilon: number, allItems: Set<T>, presentItems?: T[]): void;
    toString(): string;
    freeToPool(): void;
    static readonly pool: Pool<typeof SegmentNode>;
}
export {};
//# sourceMappingURL=SegmentTree.d.ts.map