org.gjt.rec.util
Interface Stack

All Known Implementing Classes:
ListStack

public interface Stack

A stack is an ordered list, where only the top element can be inspected or removed.

Author:
Neil Stockbridge
See Also:
Stack

Field Summary
static String REVISION
           
 
Method Summary
 void clear()
          Removes all elements from this stack, making it empty.
 boolean isEmpty()
           
 Object pop()
          Removes the element on the top of this stack.
 void push(Object element)
          Pushes a particular element on to the top of this stack.
 int size()
           
 Object top()
           
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values
Method Detail

size

public int size()
Returns:
the number of elements on this stack.

isEmpty

public boolean isEmpty()
Returns:
true if there are no elements on this stack.

top

public Object top()
Returns:
the element on the top of this stack
Throws:
NoSuchElementException - if there were no elements on this stack.

push

public void push(Object element)
Pushes a particular element on to the top of this stack.

Parameters:
element - the element to push on to the top of this stack.

pop

public Object pop()
Removes the element on the top of this stack.

Returns:
the element that was removed.
Throws:
NoSuchElementException - if there were no elements on this stack to remove.

clear

public void clear()
Removes all elements from this stack, making it empty.