org.stringtree.workflow
Class ClassicMachineLoader

java.lang.Object
  extended by org.stringtree.workflow.LineBasedMachineLoader
      extended by org.stringtree.workflow.ClassicMachineLoader
All Implemented Interfaces:
StateMachineLoader

public class ClassicMachineLoader
extends LineBasedMachineLoader

Visitor to load a StateMachine from a simple text file. The definition file has the following format:

 + lines starting with '#' are treated as comments and ignored
 + the first non-comment line contains a single token - the name of the initial state
 + further non-comment lines define the state transitions and consist of three elements,
   in order, separated by one or more spaces
   1. the state from which this transition is valid
   2. the symbol which represents this transition
   3. the destination state or special operation symbol
 
The following default special symbols are defined:
 _BACK  return to the preceding state in the state history
 _RESET  return to the initial state
 _EXIT  finish the state machine and return null for all future transitions
 
The transition symbol "=" is special cased to imply that the source state inherits all the transitions of the destination state. These transitions may be overridden by later definitions. As an example, here is a definition file for a simple fault classification system:
 # fault classification system
 #
 # all faults start as:
 UNKNOWN
 #
 # and the following transitions are valid
 # state      transition  destination
 # ----------------------------------
 :ALL         REJECT      REJECTED
 UNKNOWN      = :ALL
 UNKNOWN      ACCEPT      DEVELOPMENT
 DEVELOPMENT  = :ALL
 DEVELOPMENT  RELEASE     TEST
 TEST         PASS        DELIVERY
 TEST         FAIL        DEVELOPMENT
 


Constructor Summary
ClassicMachineLoader()
           
 
Method Summary
 void addLine(StateMachineSpec spec, java.lang.String line)
           
private  void command(StateMachineSpec spec, java.lang.String command, java.util.StringTokenizer tok)
           
 
Methods inherited from class org.stringtree.workflow.LineBasedMachineLoader
addDestination, getLineNumber, head, init, isblank, load, tail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassicMachineLoader

public ClassicMachineLoader()
Method Detail

command

private void command(StateMachineSpec spec,
                     java.lang.String command,
                     java.util.StringTokenizer tok)

addLine

public void addLine(StateMachineSpec spec,
                    java.lang.String line)
Specified by:
addLine in class LineBasedMachineLoader