|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jwalk.test.Stack
public class Stack
Stack is a fixed-length, bounded implementation of a push-down Stack.
This is a standard test class, provided with the JWalk tool suite.
The Stack has storage capacity for five objects and overflows if more
objects are pushed. Popping the Stack returns it to a previous state
(removed objects are replaced by null).
This test class can be used to demonstrate the ability of an AlgebraWalker
to discover the algebraic structure of a Stack data type. Eventually, there
are no more test sequences to discover, since all long paths eventually
re-enter previously visited states. Primitive, transformer and observer
operations may be identified.
This test class can also be used to demonstrate the ability of a
StateSpaceWalker to discover the high-level state space of a Stack data
type. Two natural predicates of the type are used to identify three
high-level states. The state cover set is identified. Note: if the
JWalker's probe depth is set to less than 5, the tool should correctly
report that it failed to find the expected full-state.
Constructor Summary | |
---|---|
Stack()
Creates a Stack with a maximum capacity for five elements. |
Method Summary | |
---|---|
boolean |
isEmpty()
Reports if this Stack is empty. |
boolean |
isFull()
Reports if this Stack is full. |
void |
pop()
Pops an object off this Stack. |
void |
push(java.lang.Object item)
Pushes an object onto this Stack. |
int |
size()
Reports the dynamic size of this Stack. |
java.lang.Object |
top()
Returns the top object on this Stack. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Stack()
Method Detail |
---|
public void push(java.lang.Object item)
item
- an object.
java.lang.ArrayIndexOutOfBoundsException
- if this Stack is full.public void pop()
EmptyStackException,
- if this Stack is empty.public java.lang.Object top()
EmptyStackException,
- if this Stack is empty.public int size()
public boolean isEmpty()
public boolean isFull()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |