org.jwalk.test
Class StackProxy

java.lang.Object
  extended by org.jwalk.test.StackProxy

public class StackProxy
extends java.lang.Object

StackProxy is a proxy for a fixed-length, bounded push-down Stack. This is a standard test class, provided with the JWalk tool suite. The StackProxy has no local state, but forwards all requests to another Stack, linked by reference. Method interactions cannot change the local state of the StackProxy, which appears constant. However, changing the depth to which object states are compared may alter this.

This test class can be used to demonstrate the ability of an AlgebraWalker to discover the algebraic structure of a data type, whose state is held at one remove from the tested object. In the standard configuration of the JWalkTester tool, all paths are pruned after test cycle 1, because no state-changes are observed. By setting the custom configuration parameter "state depth" to a value greater than zero, the walker is able to grow paths past test cycle 1.

This test class can also be used to demonstrate the ability of a StateSpaceWalker to discover the high-level states of a data type, whose concrete state is held at one remove from the tested object. In the standard configuration, the JWalkTester tool will report failure to find all the expected states (paths are pruned, if they cause no state change). By setting the custom configuration parameter "state depth" to a value greater than zero, the walker is able to identify state changes at one remove, and so discover all expected high-level states.

Version:
1.0
Author:
Anthony Simons

Constructor Summary
StackProxy()
          Creates a StackProxy whose remote Stack has the capacity for five elements.
 
Method Summary
 boolean isEmpty()
          Reports if this StackProxy is empty.
 boolean isFull()
          Reports if this StackProxy is full.
 void pop()
          Pops an object off this StackProxy.
 void push(java.lang.Object item)
          Pushes an object onto this StackProxy.
 int size()
          Reports the dynamic size of this StackProxy.
 java.lang.Object top()
          Returns the top object on this StackProxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackProxy

public StackProxy()
Creates a StackProxy whose remote Stack has the capacity for five elements.

Method Detail

push

public void push(java.lang.Object item)
Pushes an object onto this StackProxy.

Parameters:
item - an object.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the remote Stack is full.

pop

public void pop()
Pops an object off this StackProxy.

Throws:
EmptyStackException, - if the remote Stack is empty.

top

public java.lang.Object top()
Returns the top object on this StackProxy.

Returns:
the top object.
Throws:
EmptyStackException, - if the remote Stack is empty.

size

public int size()
Reports the dynamic size of this StackProxy. Delegates to the remote Stack.


isEmpty

public boolean isEmpty()
Reports if this StackProxy is empty.

Returns:
true, if there are no pushed elements.

isFull

public boolean isFull()
Reports if this StackProxy is full.

Returns:
true, if there are five pushed elements.