org.ceryle.util
Class AddressableStack
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.Vector<E>
java.util.Stack
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. |
|
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.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 |
BOTTOM
public static final int BOTTOM
- An indicator of the maximum depth or bottom of the stack.
- See Also:
- Constant Field Values
AddressableStack
public AddressableStack()
- Creates an empty AddressableStack.
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.