cds.util
Class ArrayListStack

java.lang.Object
  extended bycds.util.ArrayListStack

public class ArrayListStack
extends java.lang.Object

Stack class faster than the JAVA Stack class based on ArrayList (wich are faster than Vectors

Version:
1.0 Apr 2002
Author:
Marc Wenger/CDS

Field Summary
private  int depth
           
private  int incrdepth
           
private  int inidepth
           
private  int maxdepth
           
(package private)  java.util.ArrayList stack
           
 
Constructor Summary
ArrayListStack()
          Creates a stack with the default initial depth
ArrayListStack(int inidepth)
          Creates a stack with a specified initial depth
ArrayListStack(int inidepth, int incrdepth)
          Creates a stack with specified parameters
 
Method Summary
 boolean empty()
          checks if the stack is empty
 java.lang.Object peek()
          looks at the object on top of the stackwithout removing it
 java.lang.Object pop()
          pops a object from the stack
 void push(java.lang.Object o)
          pushes a object on the stack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inidepth

private int inidepth

incrdepth

private int incrdepth

maxdepth

private int maxdepth

depth

private int depth

stack

java.util.ArrayList stack
Constructor Detail

ArrayListStack

public ArrayListStack()
Creates a stack with the default initial depth


ArrayListStack

public ArrayListStack(int inidepth)
Creates a stack with a specified initial depth

Parameters:
inidepth - initial size of the stack

ArrayListStack

public ArrayListStack(int inidepth,
                      int incrdepth)
Creates a stack with specified parameters

Parameters:
inidepth - initial size of the stack
incrdepth - increment for extending the stack
Method Detail

push

public void push(java.lang.Object o)
pushes a object on the stack

Parameters:
o - object to push on top of the stack

pop

public java.lang.Object pop()
pops a object from the stack

Returns:
the object removed from the top of the stack

peek

public java.lang.Object peek()
looks at the object on top of the stackwithout removing it

Returns:
a reference to the object on top of the stack

empty

public boolean empty()
checks if the stack is empty

Returns:
true if the stack is empty