Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

stack-class

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"): returns TRUE/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 like push except it can push multiple objects in a list on to the stack

Author(s)

Roger D. Peng rpeng@jhsph.edu

Examples

showClass("stack")

filehash

Simple Key-Value Database

v2.4-2
GPL (>= 2)
Authors
Roger D. Peng <rdpeng@jhu.edu>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.