@javelin/net
Version:
Networking protocol and utilities for Javelin ECS.
27 lines • 1.17 kB
TypeScript
import { Comparator, CompareFunction } from "./comparator";
export declare class Heap<$Value> {
heapContainer: $Value[];
compare: Comparator<$Value>;
constructor(comparatorFunction?: CompareFunction<$Value>);
getLeftChildIndex(parentIndex: number): number;
getRightChildIndex(parentIndex: number): number;
getParentIndex(childIndex: number): number;
hasParent(childIndex: number): boolean;
hasLeftChild(parentIndex: number): boolean;
hasRightChild(parentIndex: number): boolean;
leftChild(parentIndex: number): $Value;
rightChild(parentIndex: number): $Value;
parent(childIndex: number): $Value;
swap(indexOne: number, indexTwo: number): void;
peek(): $Value | null;
poll(): $Value | null;
add(item: $Value): this;
remove(item: $Value, comparator?: Comparator<$Value>): this;
find(item: $Value, comparator?: Comparator<$Value>): number[];
isEmpty(): boolean;
toString(): string;
heapifyUp(startIndex?: number): void;
heapifyDown(customStartIndex?: number): void;
pairIsInCorrectOrder(firstElement: $Value, secondElement: $Value): boolean;
}
//# sourceMappingURL=heap.d.ts.map