import SequentialContainer from './Base/index'; import { initContainer } from "../ContainerBase/index"; import { RandomIterator } from "./Base/RandomIterator"; export declare class DequeIterator extends RandomIterator { copy(): DequeIterator; } declare class Deque extends SequentialContainer { private first; private curFirst; private last; private curLast; private bucketNum; private readonly bucketSize; private map; constructor(container?: initContainer, bucketSize?: number); /** * @description Growth the Deque. * @private */ private reAllocate; /** * @description Get the bucket position of the element and the pointer position by index. * @param pos The element's index. * @private */ private getElementIndex; clear(): void; front(): T | undefined; back(): T | undefined; begin(): DequeIterator; end(): DequeIterator; rBegin(): DequeIterator; rEnd(): DequeIterator; pushBack(element: T): void; popBack(): void; /** * @description Push the element to the front. * @param element The element you want to push. */ pushFront(element: T): void; /** * @description Remove the first element. */ popFront(): void; forEach(callback: (element: T, index: number) => void): void; getElementByPos(pos: number): T; setElementByPos(pos: number, element: T): void; insert(pos: number, element: T, num?: number): void; /** * @description Remove all elements after the specified position (excluding the specified position). * @param pos The previous position of the first removed element. * @example deque.cut(1); // Then deque's size will be 2. deque -> [0, 1] */ cut(pos: number): void; eraseElementByPos(pos: number): void; eraseElementByValue(value: T): void; eraseElementByIterator(iter: DequeIterator): DequeIterator; find(element: T): DequeIterator; reverse(): void; unique(): void; sort(cmp?: (x: T, y: T) => number): void; /** * @description Remove as much useless space as possible. */ shrinkToFit(): void; [Symbol.iterator](): Generator; } export default Deque;