Array-based implementation of circular FIFO data structure.
new CircularArrayBuffer()
/**
* Creates an instance of CircularArrayBuffer.
*
* @param len Buffer total capacity.
* @param elements List of elements to create the buffer with.
* @param overwritable Flag allowing to overwrite the buffer if it is full. Is FALSE by default.
*/
constructor(len: number, elements: T[] = [], protected overwritable = false)
length
/**
* Number of elements in the queue.
*
* @readonly
*/
get length(): number;
maxLength
/**
* Maximum size of a sequence the buffer can store without overwriting itself.
*
* @readonly
*/
get maxLength(): number;
clear()
/**
* Clears the queue.
*/
clear(): void;
dequeue()
/**
* Removes the first element from the front of the queue and returns it.
* Throws an error if the queue is empty.
*
* @returns Removed element.
*/
dequeue(): T;
enqueue()
/**
* Adds element at the rear of the queue.
*
* @param element Element to add.
*/
enqueue(element: T): void;
getFirst()
/**
* Gets element from the front of the queue without its removal.
*
* @returns Queue element.
*/
getFirst(): T;
isEmpty()
/**
* Checks whether the queue is empty or not.
*
* @returns TRUE if the queue is empty, FALSE otherwise.
*/
isEmpty(): boolean;
isFull()
/**
* Checks whether the buffer can store any more values without overwriting itself.
*
* @returns TRUE if the buffer is full, FALSE otherwise.
*/
isFull(): boolean;
isOverwritable()
/**
* Checks whether the buffer can store any more values without overwriting itself.
*
* @returns TRUE if the buffer is full, FALSE otherwise.
*/
isFull(): boolean;