nz.ac.waikato.modeljunit.examples
Class QuiDonc

java.lang.Object
  extended by nz.ac.waikato.modeljunit.examples.QuiDonc
All Implemented Interfaces:
FsmModel

public class QuiDonc
extends java.lang.Object
implements FsmModel

A simple EFSM model of the Qui-Donc service. Qui-Donc is a service of France Telecom that allows you to ring up, enter a telephone number and find which subscriber owns that telephone number and what is their address.


Nested Class Summary
static class QuiDonc.State
           
 
Field Summary
 java.lang.String _STAR
           
 java.lang.String ADDR
           
 java.lang.String BYE
           
 java.lang.String ENTER
           
 java.lang.String ERROR
           
 java.lang.String FIRE
           
 java.lang.String INFO
           
 java.lang.String NAME
           
 java.lang.String NOTALLOW
           
 java.lang.String SORRY
           
 java.lang.String SPELL
           
 java.lang.String WELCOME
           
 
Constructor Summary
QuiDonc()
           
QuiDonc(java.io.PrintWriter out0)
           
 
Method Summary
 void bad()
           
 boolean badGuard()
           
static void checkGuard(QuiDonc quidonc, boolean guard)
          Convenience method for the interactive interface.
 void dial()
           
 boolean dialGuard()
           
 java.lang.String getState()
          Return the current state of the FSM model.
 void key1()
           
 boolean key1Guard()
           
 void key2()
           
 boolean key2Guard()
           
static void main(java.lang.String[] args)
          An interactive interface to QuiDonce, for illustration purposes.
 void num1()
           
 void num18()
           
 boolean num18Guard()
           
 boolean num1Guard()
           
 void num2()
           
 boolean num2Guard()
           
 void reset(boolean testing)
          Reset the model to its initial state.
 void star()
           
 boolean starGuard()
           
 void wait_()
          We call this wait_, to avoid a clash with Java's Object.wait().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_STAR

public java.lang.String _STAR

WELCOME

public java.lang.String WELCOME

NOTALLOW

public java.lang.String NOTALLOW

ENTER

public java.lang.String ENTER

ERROR

public java.lang.String ERROR

FIRE

public java.lang.String FIRE

SORRY

public java.lang.String SORRY

INFO

public java.lang.String INFO

NAME

public java.lang.String NAME

SPELL

public java.lang.String SPELL

ADDR

public java.lang.String ADDR

BYE

public java.lang.String BYE
Constructor Detail

QuiDonc

public QuiDonc()

QuiDonc

public QuiDonc(java.io.PrintWriter out0)
Method Detail

getState

public java.lang.String getState()
Description copied from interface: FsmModel
Return the current state of the FSM model. The objects returned by this method define the states (the nodes) of the finite state machine. The objects that are returned must have a correct implementation of the equals method, since this is used to decide whether two states are the same or not. It is common to return a string, but other kinds of objects can be used if desired (in which case, their toString() method will be used to get a printable form of each FSM state).

Advanced Feature: This method can be used to define equivalence classes over the states, if you want to reduce the number of states to keep the FSM small. For example, if you have a integer state variable I that can have a huge number of possible values, you could define your getState() method to return new Integer(I % 10). This would reduce the FSM to just 10 states, where FSM state 0 represents all the states where I=0 or I=10 or I=20 etc., and FSM state 1 represents all the states where I=1 or I=11 or I=21 etc.

Specified by:
getState in interface FsmModel
Returns:
An object that represents the current state.

reset

public void reset(boolean testing)
Description copied from interface: FsmModel
Reset the model to its initial state. If the testing parameter is true, then this reset and all the following actions should affect the SUT.

Specified by:
reset in interface FsmModel
Parameters:
testing - true means the SUT should be reset too.

dialGuard

public boolean dialGuard()

dial

public void dial()

wait_

public void wait_()
We call this wait_, to avoid a clash with Java's Object.wait().


starGuard

public boolean starGuard()

star

public void star()

badGuard

public boolean badGuard()

bad

public void bad()

num18Guard

public boolean num18Guard()

num18

public void num18()

num1Guard

public boolean num1Guard()

num1

public void num1()

num2Guard

public boolean num2Guard()

num2

public void num2()

key1Guard

public boolean key1Guard()

key1

public void key1()

key2Guard

public boolean key2Guard()

key2

public void key2()

checkGuard

public static void checkGuard(QuiDonc quidonc,
                              boolean guard)
Convenience method for the interactive interface.


main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
An interactive interface to QuiDonce, for illustration purposes.

Throws:
java.io.IOException


Copyright © 2009 ModelJUnit Project. All Rights Reserved.