stack-class {filehash} | R Documentation |
Class "stack"
Description
A stack implementation using a filehash
database
Objects from the Class
Objects can be created by calls of the form new("stack", ...)
or
by calling createS
. Existing queues can be initialized with
initS
.
Slots
stack
:Object of class
"filehashDB1"
name
:Object of class
"character"
: the name of the stack (default is the file name in which the stack data are stored)
Methods
- isEmpty
signature(db = "stack")
: returnsTRUE
/FALSE
depending on whether there are elements in the stack.- pop
signature(db = "stack")
: returns the value of the top of the stack and subsequently removes that element from the stack; an error is signaled if the stack is empty- push
signature(db = "stack")
: adds an element to the top of the stack- show
signature(object = "stack")
: prints the name of the stack- top
signature(db = "stack")
: returns the value of the top of the stack; an error is signaled if the stack is empty- mpush
signature(db = "stack")
: works likepush
except it can push multiple objects in a list on to the stack
Author(s)
Roger D. Peng rpeng@jhsph.edu
Examples
showClass("stack")