: Interface Stack

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weiss.nonstandard
Interface Stack

All Known Implementing Classes:
  ListStack, ArrayStack

public interface Stack

Protocol for stacks.

Method Summary
`boolean` | `isEmpty()` Test if the stack is logically empty.
`void` | `makeEmpty()` Make the stack logically empty.
`void` | `pop()` Remove the most recently inserted item from the stack.
`void` | `push(java.lang.Object x)` Insert a new item into the stack.
`java.lang.Object` | `top()` Get the most recently inserted item in the stack.
`java.lang.Object` | `topAndPop()` Return and remove the most recently inserted item from the stack.

Method Detail

### push

    public void push(java.lang.Object x)

  Insert a new item into the stack.
  Parameters:
    `x` - the item to insert.

### pop

    public void pop()

  Remove the most recently inserted item from the stack.
  Throws:
    `UnderflowException` - if the stack is empty.

### top

    public java.lang.Object top()

  Get the most recently inserted item in the stack. Does not alter the stack.
  Returns:
    the most recently inserted item in the stack.
  Throws:
    `UnderflowException` - if the stack is empty.

### topAndPop

    public java.lang.Object topAndPop()

  Return and remove the most recently inserted item from the stack.
  Returns:
    the most recently inserted item in the stack.
  Throws:
    `UnderflowException` - if the stack is empty.

### isEmpty

    public boolean isEmpty()

  Test if the stack is logically empty.
  Returns:
    true if empty, false otherwise.

### makeEmpty

    public void makeEmpty()

  Make the stack logically empty.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD