fivem-ts

a library to speed up the development of Fivem scripts and frameworks


Project maintained by Purpose-Dev Hosted on GitHub Pages — Theme by mattgraham

fivem-ts - Documentation v0.7.5Docs


fivem-ts - Documentation v0.7.5 / Shared / CircularQueue

Class: CircularQueue<T>

CircularQueue is a data structure that follows the First In First Out (FIFO) principle and efficiently manages queue operations within a fixed, circular buffer.

Type Parameters

T

The type of elements held in the queue.

Implements

Constructors

new CircularQueue()

new CircularQueue<T>(capacity): CircularQueue<T>

Parameters

capacity: number

Returns

CircularQueue<T>

Defined in

shared/ds/queue/CircularQueue.ts:16

Methods

dequeue()

dequeue(): T

Removes and returns the front element from the queue. If the queue is empty, returns undefined.

Returns

T

The front element of the queue if it exists, otherwise undefined.

Implementation of

ICircularQueue.dequeue

Defined in

shared/ds/queue/CircularQueue.ts:46


enqueue()

enqueue(item): void

Adds an item to the end of the queue.

Parameters

item: T

The item to be added to the queue.

Returns

void

Does not return a value.

Implementation of

ICircularQueue.enqueue

Defined in

shared/ds/queue/CircularQueue.ts:30


isEmpty()

isEmpty(): boolean

Checks if the collection is empty.

Returns

boolean

true if the collection has no elements; otherwise, false.

Implementation of

ICircularQueue.isEmpty

Defined in

shared/ds/queue/CircularQueue.ts:76


isFull()

isFull(): boolean

Checks if the current container is full.

Returns

boolean

Returns true if the container is full, otherwise false.

Implementation of

ICircularQueue.isFull

Defined in

shared/ds/queue/CircularQueue.ts:85


peek()

peek(): T

Retrieves, but does not remove, the front element of the queue.

Returns

T

The front element of the queue if present, otherwise undefined.

Implementation of

ICircularQueue.peek

Defined in

shared/ds/queue/CircularQueue.ts:63


size()

size(): number

Gets the current size or count of elements.

Returns

number

The number of elements.

Implementation of

ICircularQueue.size

Defined in

shared/ds/queue/CircularQueue.ts:94