Queue: R6 Class - A First-In-First-Out Abstract Data Type

QueueR Documentation

R6 Class - A First-In-First-Out Abstract Data Type

Description

Abstract data type that stores and returns any number of elements.

Details

A Queue object stores all elements in a single vector, thus all data types can be stored, but silent coercion may occur.

Elements are returned in the same order that they were added.

Methods

Public methods


Queue$push()

Adds element(s) to Queue.

Usage
Queue$push(new_elements)
Arguments
new_elements

vector of elements to add.

Returns

self, invisibly.


Queue$get()

Returns all contents of the Queue object.

Usage
Queue$get()
Returns

Single vector containing all Queue contents.


Queue$pop()

Returns the first (oldest) element of the Queue and removes it.

Usage
Queue$pop()
Returns

vector of length 1 containing the first element of Queue or NULL if Queue is empty.


Queue$remove()

Removes the oldest occurrence of specified element(s) from Queue. Relies on implicit type conversions of R identify elements to remove.

Usage
Queue$remove(elements)
Arguments
elements

vector of elements to remove from Queue.

Returns

self, invisibly.


Queue$empty()

Removes all elements from Queue.

Usage
Queue$empty()
Returns

self, invisibly.


Queue$size()

Returns the number of elements in Queue.

Usage
Queue$size()
Returns

integer(1).


Queue$print()

Prints this Queue.

Usage
Queue$print(...)
Arguments
...

Additional arguments to this method, ignored.

Returns

self, invisibly.


Queue$clone()

The objects of this class are cloneable with this method.

Usage
Queue$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


teal.transform documentation built on June 29, 2026, 9:08 a.m.