Package {liqueueR}


Type: Package
Title: Implements Queue, PriorityQueue and Stack Classes
Version: 0.0.5
Description: Provides three classes: Queue, PriorityQueue and Stack. Queue is just a "plain vanilla" FIFO queue; PriorityQueue orders items according to priority. Stack implements LIFO.
URL: https://github.com/DataWookie/liqueueR
BugReports: https://github.com/DataWookie/liqueueR/issues
License: GPL-3
Encoding: UTF-8
Imports: itertools, methods
Suggests: testthat, iterators
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2026-05-29 12:13:44 UTC; wookie
Author: Andrew Collier [aut, cre]
Maintainer: Andrew Collier <andrew.b.collier@gmail.com>
Repository: CRAN
Date/Publication: 2026-05-30 05:12:49 UTC

A PriorityQueue reference class

Description

Derived from the Queue class.

Fields

data

Initial data to populate the queue.

priorities

Numeric queue priorities.

prioritise

Function to calculate priorities from items.

Methods

pop(N = 1)

Removes and returns head of queue (or raises error if queue is empty). N is number of items to pop.

push(item)

Inserts element at back of the queue.

See Also

Queue-class for information on base class.


A Queue reference class

Description

A Queue reference class

Fields

data

Initial data to populate the queue.

Methods

peek(pos = c(1), as.list = FALSE)

Returns (but does not remove) specified positions in queue (or NULL if any one of them is not available). The as.list argument will cause a list to be returned even if only one element requested.

poll()

Removes and returns head of queue (or NULL if queue is empty).

pop(N = 1)

Removes and returns head of queue (or raises error if queue is empty). N is number of items to pop.

push(item)

Inserts element at back of the queue.

size()

Returns the number of items in the queue.

Examples

queue <- Queue$new()
queue$push("one")
queue$push(2)
queue$push("three")
queue$size()
queue$pop()
queue$poll()

A Stack reference class

Description

Derived from the Queue class.

Fields

data

Initial data to populate the stack.

Methods

push(item)

Inserts element at back of the queue.

See Also

Queue-class for information on base class.