import { Compare } from "../../util/function/Compare";
import { Element } from "../Collection";
/**
 * Abstract parent class for Min and Max Heaps.
 * In computer science, a _heap_ is a specialized tree-based data structure that satisfies the heap property described below.
 * In a _min_ heap, if `P` is a parent node of `C`, then the key (the value) of `P` is less than or equal to the key of `C`.
 * In a _max_ heap, the key of `P` is greater than or equal to the key of `C`.
 * @abstract
 */
export declare abstract class Heap<T> {
    private _heapContainer;
    protected _compare: Compare<T>;
    constructor(compare?: Compare<T>);
    /**
     * Returns the size of the heap structure
     */
    get length(): number;
    /**
     * @param {number} parentIndex
     * @returns {number}
     */
    protected getLeftChildIndex(parentIndex: number): number;
    /**
     * @param {number} parentIndex
     * @returns {number}
     */
    protected getRightChildIndex(parentIndex: number): number;
    /**
     * @param {number} childIndex
     * @returns {number}
     */
    protected getParentIndex(childIndex: number): number;
    /**
     * @param {number} childIndex
     * @returns {boolean}
     */
    protected hasParent(childIndex: number): boolean;
    /**
     * @param {number} parentIndex
     * @returns {boolean}
     */
    protected hasLeftChild(parentIndex: number): boolean;
    /**
     * @param {number} parentIndex
     * @returns {boolean}
     */
    protected hasRightChild(parentIndex: number): boolean;
    /**
     * @param {number} parentIndex
     * @returns {*}
     */
    protected leftChild(parentIndex: number): Element<T>;
    /**
     * @param {number} parentIndex
     * @returns {*}
     */
    protected rightChild(parentIndex: number): Element<T>;
    /**
     * @param {number} childIndex
     * @returns {*}
     */
    protected parent(childIndex: number): Element<T>;
    /**
     * @param {number} indexOne
     * @param {number} indexTwo
     */
    protected swap(indexOne: number, indexTwo: number): void;
    /**
     * Gets the heap item by its numeric index value
     * @param index The ordered number of the item
     * @returns The heap item, if the `index` in the bounds of the heap container, otherwise throws exception
     * @throws IndexOutOfBoundsException
     */
    get(index: number): Element<T>;
    /**
     * Gets the size of the current heap
     * @returns
     */
    size(): number;
    /**
     * Retrieves, but does not remove the head of this heap, or returns `undefined` if this heap is empty
     * @return {*}
     */
    peek(): Element<T> | undefined;
    /**
     * Retrieves and removes the head of this heap, or returns `undefined` if this heap is empty
     * @return {*}
     */
    poll(): Element<T> | undefined;
    /**
     * Inserts the specified element into this heap
     * @param {CollectionItem} item
     * @returns {boolean}
     */
    add(item: Element<T>): boolean;
    /**
     * Removes all of the elements from this heap
     */
    clear(): void;
    /**
     * Returns true if this heap contains the specified element
     * @param item
     * @returns
     */
    contains(item: Element<T>): boolean;
    /**
     * Removes the item in the specified position in the heap
     * @param indexToRemove The ordered number of the item
     * @returns An old item in the removed position
     * @throws IndexOutOfBoundsException
     */
    removeAt(indexToRemove: number): Element<T>;
    /**
     * Removes a single instance of the specified element from this heap, if it is present
     * @param {*} item The item to remove
     * @returns {boolean} _true_ if the `item` was removed, else _false_
     */
    remove(item: Element<T>): boolean;
    /**
     * @param {*} item
     * @param {Comparator} [comparator]
     * @return {Number[]}
     */
    protected find(item: Element<T>): number[];
    /**
     * @returns {boolean}
     */
    isEmpty(): boolean;
    /**
     * Returns an array containing all of the elements in this heap
     * @returns
     */
    toArray(): Array<Element<T>>;
    /**
     * @returns {string}
     */
    toString(): string;
    /**
     *
     * @returns
     */
    toJSON(): Element<T>[];
    /**
     * @param {number} [customStartIndex]
     */
    heapifyUp(customStartIndex?: number): void;
    /**
     * @param {number} [customStartIndex]
     */
    heapifyDown(customStartIndex?: number): void;
    /**
     * Checks if pair of heap elements is in correct order.
     * For MinHeap the first element must be always smaller or equal.
     * For MaxHeap the first element must be always bigger or equal.
     * @param {*} firstElement
     * @param {*} secondElement
     * @return {boolean}
     */
    abstract pairIsInCorrectOrder(firstElement: Element<T>, secondElement: Element<T>): boolean;
}
