org.objectweb.jac.util
Class Stack

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--java.util.Stack
                          |
                          +--org.objectweb.jac.util.Stack
All Implemented Interfaces:
Cloneable, Collection, List, RandomAccess, Serializable
Direct Known Subclasses:
VMStack

public class Stack
extends Stack

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Stack()
           
 
Method Summary
 Object peek(int i)
          Returns the i-th element from the top of the stack
 void poke(int i, Object value)
          Sets the value of an element of the stack
 void pop(int n)
          Pops n elements from the top of the stack
 Object safeTop()
          Returns the top element of the stack if it's not empty, null otherwise.
 void swap()
          swap peek() and peek(1)
 Object top()
          Returns the top element of 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
 

Constructor Detail

Stack

public Stack()
Method Detail

peek

public Object peek(int i)
Returns the i-th element from the top of the stack

Parameters:
i - index of element to get (0 is the top of the stack, size()-1 is the bottom)
See Also:
poke(int,Object), top()

top

public Object top()
Returns the top element of the stack


safeTop

public Object safeTop()
Returns the top element of the stack if it's not empty, null otherwise.


poke

public void poke(int i,
                 Object value)
Sets the value of an element of the stack

Parameters:
i - index of element to set (0 is the top of the stack, size()-1 is the bottom)
value - the new value
See Also:
peek(int)

pop

public void pop(int n)
Pops n elements from the top of the stack

Parameters:
n - number of elements to pop off the stack

swap

public void swap()
swap peek() and peek(1)