|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectedu.trinity.cs.bmassing.adt1.FixedArrayStack<E>
public class FixedArrayStack<E>
Class for fixed-size array-based stacks.
| Constructor Summary | |
|---|---|
FixedArrayStack(int size)
Constructs a new FixedArrayStack of the specified size. |
|
| Method Summary | |
|---|---|
boolean |
empty()
Tells whether stack is empty. |
static void |
main(java.lang.String[] args)
Performs minimal testing/demo of other functions. |
E |
pop()
Pops an element from the stack. |
void |
push(E x)
Pushes an element onto the stack. |
E |
top()
Gets the top element of the stack (but does not remove it). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FixedArrayStack(int size)
size - maximum number of elements| Method Detail |
|---|
public boolean empty()
empty in interface SimpleStack<E>
public void push(E x)
throws StackFullException
push in interface SimpleStack<E>x - element to add
StackFullException - if stack is already full
public E pop()
throws StackEmptyException
pop in interface SimpleStack<E>StackEmptyException - if stack is empty
public E top()
throws StackEmptyException
top in interface SimpleStack<E>StackEmptyException - if stack is emptypublic static void main(java.lang.String[] args)
args - command-line arguments (unused)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||