mako5.util
Class ArrayStack<T>

java.lang.Object
  extended by mako5.util.ArrayStack<T>
All Implemented Interfaces:
Stack<T>

public final class ArrayStack<T>
extends Object
implements Stack<T>

An array stack that may not be expanded.

Version:
14-Mar 2006, 24-Mar 2006 (1.00)
Author:
Paul Jarrett

Constructor Summary
ArrayStack(int iCapacity_)
          Makes a new stack with the given capacity.
 
Method Summary
 int getCapacity()
          Returns the maximum capacity for this stack.
 boolean isEmpty()
          Returns true if this stack is empty.
 T pop()
          Pops an element from this stack.
 void push(T rVal_)
          Pushes an element into the stack.
 int size()
          Returns the current number of elements in this stack.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayStack

public ArrayStack(int iCapacity_)
Makes a new stack with the given capacity.

Parameters:
iCapacity_ - the desired capacity for the stack
Since:
14-Mar 2006, 24-Mar 2006 (1.00)
Method Detail

push

public void push(T rVal_)
Pushes an element into the stack.

Specified by:
push in interface Stack<T>
Parameters:
rVal_ - the element to add into the stack
Since:
14-Mar 2006, 24-Mar 2006 (1.00)

pop

public T pop()
Pops an element from this stack.

Specified by:
pop in interface Stack<T>
Returns:
the popped element from this stack
Since:
14-Mar 2006, 24-Mar 2006 (1.00)

isEmpty

public boolean isEmpty()
Returns true if this stack is empty.

Specified by:
isEmpty in interface Stack<T>
Returns:
true if this stack is empty.
Since:
14-Mar 2006, 24-Mar 2006 (1.00)

size

public int size()
Returns the current number of elements in this stack.

Specified by:
size in interface Stack<T>
Returns:
the number of elements in the stack.
Since:
14-Mar 2006

getCapacity

public int getCapacity()
Returns the maximum capacity for this stack.

Returns:
the most number of elements that this stack can hold
Since:
29-Jun 2006