import { IIterable, IIterator, IterableOrArrayLike } from '../algorithm/iteration'; /** * A generic double ended queue data structure. */ export declare class Deque implements IIterable { /** * Construct a new deque. * * @param values - The initial values for the deque. */ constructor(values?: IterableOrArrayLike); /** * Test whether the deque is empty. * * @returns `true` if the deque is empty, `false` otherwise. * * #### Notes * This is a read-only property. * * #### Complexity * Constant. * * #### Iterator Validity * No changes. */ readonly isEmpty: boolean; /** * Get the length of the deque. * * @return The number of values in the deque. * * #### Notes * This is a read-only property. * * #### Complexity * Constant. * * #### Iterator Validity * No changes. */ readonly length: number; /** * Get the value at the front of the deque. * * @returns The value at the front of the deque, or `undefined` if * the deque is empty. * * #### Notes * This is a read-only property. * * #### Complexity * Constant. * * #### Iterator Validity * No changes. */ readonly front: T; /** * Get the value at the back of the deque. * * @returns The value at the back of the deque, or `undefined` if * the deque is empty. * * #### Notes * This is a read-only property. * * #### Complexity * Constant. * * #### Iterator Validity * No changes. */ readonly back: T; /** * Create an iterator over the values in the deque. * * @returns A new iterator starting at the front of the deque. * * #### Complexity * Constant. * * #### Iterator Validity * No changes. */ iter(): IIterator; /** * Add a value to the front of the deque. * * @param value - The value to add to the front of the deque. * * @returns The new length of the deque. * * #### Complexity * Constant. * * #### Iterator Validity * No changes. */ pushFront(value: T): number; /** * Add a value to the back of the deque. * * @param value - The value to add to the back of the deque. * * @returns The new length of the deque. * * #### Complexity * Constant. * * #### Iterator Validity * No changes. */ pushBack(value: T): number; /** * Remove and return the value at the front of the deque. * * @returns The value at the front of the deque, or `undefined` if * the deque is empty. * * #### Complexity * Constant. * * #### Iterator Validity * Iterators pointing at the removed value are invalidated. */ popFront(): T; /** * Remove and return the value at the back of the deque. * * @returns The value at the back of the deque, or `undefined` if * the deque is empty. * * #### Complexity * Constant. * * #### Iterator Validity * Iterators pointing at the removed value are invalidated. */ popBack(): T; /** * Remove all values from the deque. * * #### Complexity * Linear. * * #### Iterator Validity * All current iterators are invalidated. */ clear(): void; /** * Swap the contents of the deque with the contents of another. * * @param other - The other deque holding the contents to swap. * * #### Complexity * Constant. * * #### Iterator Validity * All current iterators remain valid, but will now point to the * contents of the other deque involved in the swap. */ swap(other: Deque): void; private _length; private _front; private _back; }