org.jwalk.test
Class AnswerCycle

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

public class AnswerCycle
extends java.lang.Object

AnswerCycle is a class whose methods set and get enumerated constants. This is a standard test class, provided with the JWalk tool suite. AnswerCycle is provided in order to test JWalk's ability to synthesise all the enumerated constants of the Answer enumerated type. One Answer value is stored (the value QUIT, by default). Successive calls to setAnswer() should pick a different value from the Answer enumerated type. This will be visible in the result returned by getAnswer().

This test class can be used to demonstrate the ability of an AlgebraWalker to find all possible concrete states of an AnswerCycle. When sequences longer than length 4 are grown, the AnswerCycle re-enters its original state and cycles round the same states. The AlgebraWalker determines that no further test sequences are needed (the result panes for test cycle 5 and upward are empty).

This test class also demonstrates the ability of an AlgebraWalker to change its mind about the algebraic structure of the AnswerCycle data type. Initially, the method setAnswer() is considered to be primitive. However, after 4 probing cycles, it resets the state to the starting state QUIT, so is indistinguishable from a transformer. (Experiment by lowering the probe depth parameter to 3).

This test class can also be used to demonstrate the ability of a StateSpaceWalker to determine that the AnswerCycle has only one Default state, since it does not advertise any other high-level states through state predicate methods.

Version:
1.0
Author:
Anthony Simons

Constructor Summary
AnswerCycle()
          Constructs an AnswerCycle, whose answer is QUIT.
 
Method Summary
 Answer getAnswer()
          Returns the current Answer value.
 void setAnswer(Answer value)
          Sets the current Answer to the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnswerCycle

public AnswerCycle()
Constructs an AnswerCycle, whose answer is QUIT.

Method Detail

setAnswer

public void setAnswer(Answer value)
Sets the current Answer to the given value.

Parameters:
value - the Answer to set.

getAnswer

public Answer getAnswer()
Returns the current Answer value.

Returns:
the current Answer value.