export interface DequeOptions { /** * Maximum number of items in the queue. * When the queue is full, adding new items will remove the items * at the other end of the queue. */ capacity?: number; } /** * Custom implementation of a double ended queue. */ export declare class Deque { #private; protected _list: (T | undefined)[]; protected _head: number; protected _tail: number; protected _capacityMask: number; protected _capacity?: number; constructor(array?: ArrayLike, options?: DequeOptions); /** * Return the number of items on the list, or 0 if empty. */ get length(): number; /** * Returns the item at the specified index from the list. * 0 is the first element, 1 is the second, and so on... * Elements at negative values are that many from the end: -1 is one before the end * (the last element), -2 is two before the end (one before last), etc. * Returns undefined if the index is out of bounds. * * @param index */ at(index: number): T | undefined; /** * Returns the first item in the list without removing it. */ peekFront(): T | undefined; /** * Returns the last item in the list without removing it. */ peekBack(): T | undefined; /** * Add an item at the beginning of the list. * @param item */ pushFront(item: T): number; /** * Add an item to the end of the list. * @param item */ pushBack(item: T): number; /** * Remove and return the last item on the list. * Returns undefined if the list is empty. */ popBack(): T | undefined; /** * Remove and return the first item on the list, * Returns undefined if the list is empty. */ popFront(): T | undefined; /** * Remove and return the item at the specified index from the list. * Returns undefined if the list is empty. * @param index */ removeOne(index: number): T | undefined; removeBy(predicate: (item: T) => boolean): void; /** * Soft clear - does not reset capacity. */ clear(): void; indexOf(item: T): number; findIndex(predicate: (item: T) => boolean): number; find(predicate: (item: T) => boolean): T | undefined; includes(item: T): boolean; /** * Returns true or false whether the list is empty. */ isEmpty(): boolean; /** * Returns an array of all queue items. */ toArray(): T[]; [Symbol.iterator](): Iterator; }