org.ceryle.util
Class AddressableStack

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<E>
              extended by java.util.Stack
                  extended by org.ceryle.util.AddressableStack
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List, RandomAccess

public class AddressableStack
extends Stack

AddressableStack extends java.util.Stack (a class that represents a last-in-first-out (LIFO) stack of objects) to allow peeking and popping from the depths of the stack rather than merely the top element.

Since:
JDK1.2
Version:
$Id: AddressableStack.java,v 3.3 2007-06-15 12:09:55 altheim Exp $
Author:
Murray Altheim
See Also:
Stack, Serialized Form

Field Summary
static int BOTTOM
          An indicator of the maximum depth or bottom of the stack.
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
AddressableStack()
          Creates an empty AddressableStack.
 
Method Summary
 Object peek(int depth)
          Looks at the object at the specific depth in this stack without removing it from the stack.
 Object pop(int depth)
          Pops the object at the specific depth from the stack.
 
Methods inherited from class java.util.Stack
empty, peek, pop, push, search
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

BOTTOM

public static final int BOTTOM
An indicator of the maximum depth or bottom of the stack.

See Also:
Constant Field Values
Constructor Detail

AddressableStack

public AddressableStack()
Creates an empty AddressableStack.

Method Detail

peek

public Object peek(int depth)
Looks at the object at the specific depth in this stack without removing it from the stack.

Parameters:
depth - an int indicating the peeking depth (zero indicates the top, BOTTOM the bottom)
Returns:
the object at the location depth from the top of this stack
Throws:
EmptyStackException - if this stack is empty

pop

public Object pop(int depth)
Pops the object at the specific depth from the stack.

Parameters:
depth - an int indicating the peeking depth (zero indicates the top, BOTTOM the bottom)
Returns:
the object at the location depth from the top of this stack
Throws:
EmptyStackException - if this stack is empty


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.