oracle.cle.util.statemachine
Class StateMachineValidator

java.lang.Object
  |
  +--oracle.cle.util.statemachine.StateMachineValidator
All Implemented Interfaces:
java.io.Serializable

public class StateMachineValidator
extends java.lang.Object
implements java.io.Serializable

(Deterministic) Finite State Machine (FSM) rules:

  1. FSMs can have only one begin state per execution.
  2. States may only have one Transition per condition.  This
     is guranteed by the implementation of this StateMachine component.
  3. All non end States must have a Transition to at least
     one other State.
  4. All states must be able to reach an end state in <=
     the total number of states.
 

See Also:
StateMachine, Serialized Form

Field Summary
protected  boolean DEBUG
          Set this to true for diagnostic messages
protected  StateMachine stateMachine
          The FSM being validated
protected  java.util.Vector violations
          A list of all the violations found for the StateMachine being validated.
 
Constructor Summary
StateMachineValidator(StateMachine aStateMachine)
           
 
Method Summary
 void debug(java.lang.String text)
          a simple way to print some debug messages out
 java.lang.String generateViolationReport()
           
 StateMachine getStateMachine()
           
 java.util.Vector getViolations()
          Returns a Vector of the StateMachineViolations that have been found during the validation of the StateMachine by an instance of the StateMachineValidator
protected  void registerViolation(State fromState, State toState, TransitionCondition condition, java.lang.String violationCode, java.lang.String specificMessage)
           
 void runAllValidations()
          Execute all the checks in this Validator.
 void setStateMachine(StateMachine sm)
           
 void validateFinality()
          This method checks the existence of a path from every state to to at least one final state in the StateMachine
 void validateTransitions()
          This method ensures that:
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stateMachine

protected StateMachine stateMachine
The FSM being validated

violations

protected java.util.Vector violations
A list of all the violations found for the StateMachine being validated.

DEBUG

protected boolean DEBUG
Set this to true for diagnostic messages
Constructor Detail

StateMachineValidator

public StateMachineValidator(StateMachine aStateMachine)
Parameters:
aStateMachine - the state machine to be validated
Method Detail

setStateMachine

public void setStateMachine(StateMachine sm)

getStateMachine

public StateMachine getStateMachine()

getViolations

public java.util.Vector getViolations()
Returns a Vector of the StateMachineViolations that have been found during the validation of the StateMachine by an instance of the StateMachineValidator

runAllValidations

public void runAllValidations()
Execute all the checks in this Validator.

DEVELOPMENT NOTE: Any new validations methods must be coded into this method.


generateViolationReport

public java.lang.String generateViolationReport()

validateTransitions

public void validateTransitions()
This method ensures that:

   1) a transition table exisits for state machines with > 1 process
   2) for each state, a transition exisits for each available condition
 


validateFinality

public void validateFinality()
This method checks the existence of a path from every state to to at least one final state in the StateMachine

registerViolation

protected void registerViolation(State fromState,
                                 State toState,
                                 TransitionCondition condition,
                                 java.lang.String violationCode,
                                 java.lang.String specificMessage)

debug

public void debug(java.lang.String text)
a simple way to print some debug messages out


Copyright © 2003 ORACLE Corp. All Rights Reserved.