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