Opus5
Class StackAsLinkedList

java.lang.Object
  |
  +--Opus5.AbstractObject
        |
        +--Opus5.AbstractContainer
              |
              +--Opus5.StackAsLinkedList
All Implemented Interfaces:
Comparable, Container, Stack

public class StackAsLinkedList
extends AbstractContainer
implements Stack

A stack implemented using a linked list.

Version:
$Id: StackAsLinkedList.java,v 3.5 1998/07/28 12:30:15 brpreiss Exp $
Author:
Bruno R. Preiss, P.Eng.

Field Summary
protected  LinkedList list
          The linked list.
 
Fields inherited from class Opus5.AbstractContainer
count
 
Fields inherited from interface Opus5.Stack
copyright
 
Constructor Summary
StackAsLinkedList()
          Constructs a StackAsLinkedList.
 
Method Summary
 void accept(Visitor visitor)
          Accepts a visitor and makes it visit the objects in this stack.
protected  int compareTo(Comparable arg)
          Compares this object with the specified comparable object.
 Enumeration getEnumeration()
          Returns an enumeration that enumerates the objects in this stack.
 java.lang.Object getTop()
          Returns the object at the top of this stack.
 java.lang.Object pop()
          Pops and returns the object from the top of this stack.
 void purge()
          Purges this stack, making it empty.
 void push(java.lang.Object object)
          Pushes the specified object onto this stack.
 
Methods inherited from class Opus5.AbstractContainer
getCount, hashCode, isEmpty, isFull, toString
 
Methods inherited from class Opus5.AbstractObject
compare, equals, isEQ, isGE, isGT, isLE, isLT, isNE
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Opus5.Container
getCount, isEmpty, isFull
 
Methods inherited from interface Opus5.Comparable
compare, isEQ, isGE, isGT, isLE, isLT, isNE
 

Field Detail

list

protected LinkedList list
The linked list.
Constructor Detail

StackAsLinkedList

public StackAsLinkedList()
Constructs a StackAsLinkedList.
Method Detail

purge

public void purge()
Purges this stack, making it empty.
Specified by:
purge in interface Container

push

public void push(java.lang.Object object)
Pushes the specified object onto this stack.
Specified by:
push in interface Stack
Parameters:
object - The object to be pushed onto this stack.

pop

public java.lang.Object pop()
Pops and returns the object from the top of this stack.
Specified by:
pop in interface Stack
Returns:
The object from the top of this stack.
Throws:
ContainerEmptyException - If this stack is empty.

getTop

public java.lang.Object getTop()
Returns the object at the top of this stack.
Specified by:
getTop in interface Stack
Returns:
The object at the top of this stack.
Throws:
ContainerEmptyException - If this stack is empty.

accept

public void accept(Visitor visitor)
Accepts a visitor and makes it visit the objects in this stack.
Specified by:
accept in interface Container
Overrides:
accept in class AbstractContainer
Parameters:
visitor - The visitor to be accepted.

getEnumeration

public Enumeration getEnumeration()
Returns an enumeration that enumerates the objects in this stack.
Specified by:
getEnumeration in interface Container
Returns:
An enumeration that enumerates the objects in this stack.

compareTo

protected int compareTo(Comparable arg)
Compares this object with the specified comparable object. This method is not implemented.
Overrides:
compareTo in class AbstractObject
Parameters:
arg - The comparable object with which this stack is compared.
Throws:
MethodNotImplemented - Always.