export interface MutableQueue {
/**
* The '''maximum''' number of elements that a queue can hold.
*
* @note that unbounded queues can still implement this interface
* with `capacity = MAX_NUMBER`.
*/
readonly capacity: number;
/**
* A non-blocking enqueue.
*
* @return whether the enqueue was successful or not.
*/
readonly offer: (a: A) => boolean;
/**
* A non-blocking dequeue.
*
* @return either an element from the queue, or the `default`
* param.
*
* @note that if there's no meaningful default for your type, you
* can always use `poll(undefined)`. Not the best, but reasonable price
* to pay for lower heap churn.
*/
readonly poll: (a: A | undefined) => A | undefined;
/**
* @return the '''current''' number of elements inside the queue.
*
* @note that this method can be non-atomic and return the
* approximate number in a concurrent setting.
*/
readonly size: number;
/**
* @return if the queue is empty
*/
readonly isEmpty: boolean;
/**
* @return if the queue is full
*/
readonly isFull: boolean;
}
export declare class Unbounded implements MutableQueue {
private queue;
get size(): number;
get isEmpty(): boolean;
get isFull(): boolean;
get capacity(): number;
offer(a: A): boolean;
poll(a: A | undefined): A | undefined;
}
export declare class Bounded implements MutableQueue {
private queue;
private n;
constructor(n: number);
get size(): number;
get isEmpty(): boolean;
get isFull(): boolean;
get capacity(): number;
offer(a: A): boolean;
poll(a: A | undefined): A | undefined;
}
//# sourceMappingURL=MutableQueue.d.ts.map