@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
17 lines (16 loc) • 591 B
TypeScript
/**
* A FIFO queue over a growable array with amortized O(1) dequeue.
* Entries are consumed via an index (instead of costly `Array#shift` calls),
* and the consumed prefix is dropped once it dominates the array,
* bounding the memory overhead to twice the live queue size.
*/
export declare class ArrayQueue<T> {
private elements;
private idx;
constructor(initial?: readonly T[]);
enqueue(item: T): void;
/** Returns the oldest element, or `undefined` if the queue {@link isEmpty}. */
dequeue(): T | undefined;
get size(): number;
isEmpty(): boolean;
}