Learn R Programming

filehash (version 2.4-5)

stack-class: Stack Class

Description

A stack implementation using a filehash database

Usage

# S4 method for stack
show(object)

createS(filename)

initS(filename)

# S4 method for stack push(db, val, ...)

mpush(db, vals, ...)

# S4 method for stack mpush(db, vals, ...)

# S4 method for stack isEmpty(db, ...)

# S4 method for stack top(db, ...)

# S4 method for stack pop(db, ...)

Value

a stack object

Arguments

object

a stack object

filename

name of file where stack is stored

db

a stack object

val

an R object to be added to the stack

...

arguments passed to other methods

vals

a list of R objects

Methods (by generic)

  • show(stack): Print a stack object.

  • push(stack): Push an object on to the stack

  • mpush(stack): Push a list of R objects on to the stack

  • isEmpty(stack): Indicate whether the stack is empty or not

  • top(stack): Return the top element of the stack

  • pop(stack): Return the top element of the stack and remove that element from the stack

Functions

  • createS(): Create a filehash Stack

  • initS(): Initialize and existing filehash stack

  • mpush(): Push multiple R objects on to a stack

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)

Details

Objects can be created by calls of the form new("stack", ...) or by calling createS. Existing queues can be initialized with initS.