filehash (version 2.4-2)

queue-class: Class "queue"

Description

A queue implementation using a filehash database

Arguments

Objects from the Class

Objects can be created by calls of the form new("queue", ...) or by calling createQ. Existing queues can be initialized with initQ.

Slots

queue:

Object of class "filehashDB1"

name:

Object of class "character": the name of the queue (default is the file name in which the queue data are stored)

Methods

isEmpty

signature(db = "queue"): returns TRUE/FALSE depending on whether there are elements in the queue.

pop

signature(db = "queue"): returns the value of the "top" (i.e. head) of the queue and subsequently removes that element from the queue; an error is signaled if the queue is empty

push

signature(db = "queue"): adds an element to the tail ("bottom") of the queue

show

signature(object = "queue"): prints the name of the queue

top

signature(db = "queue"): returns the value of the "top" (i.e. head) of the queue; an error is signaled if the queue is empty

Examples

Run this code
# NOT RUN {
showClass("queue")
# }

Run the code above in your browser using DataCamp Workspace