org.apache.taglibs.rdc.scxml
Class SCXMLSemantics

java.lang.Object
  extended by org.apache.taglibs.rdc.scxml.SCXMLSemantics

public class SCXMLSemantics
extends java.lang.Object

This class encapsulates a particular SCXML semantics, that is a particular semantic interpretation of Harel Statecharts. The possible semantic interpretations are for example:

The purpose of this class is to separate the interpretation algorithm from the SCXMLExecutor and make it therefore pluggable. Semantics agnostic utility functions and common operators as defined in UML can be found in the SCXMLHelper or attached directly to the SCXML model elements. Specific semantics can be created by subclassing SCXMLSemantics, the current implementation aligns mostly with W3C SCXML July 5 public draft (that is, UML 1.5) however, certain aspects are taken from STATEMATE.

Author:
Jaroslav Gergic, Rahul Akolkar

Field Summary
protected static org.apache.commons.logging.Log appLog
           
protected  org.apache.taglibs.rdc.scxml.TransitionTargetComparator ttc
           
 
Constructor Summary
SCXMLSemantics()
           
 
Method Summary
 void buildOnExitOnEntryLists(org.apache.taglibs.rdc.scxml.Step step, ErrorReporter errRep)
           
 void determineInitialStates(SCXML input, java.util.Set states, java.util.List entryList, ErrorReporter errRep)
           
 void determineTargetStates(java.util.Set states, ErrorReporter errRep)
           
 void enumerateReachableTransitions(SCXML stateMachine, org.apache.taglibs.rdc.scxml.Step step, ErrorReporter errRep)
           
 boolean eventMatch(java.lang.String transEvent, java.util.Set eventOccurrences)
          Implements prefix match, that is, if, for example, "mouse.click" is a member of eventOccurrences and a transition is triggered by "mouse", the method returns true.
 void executeActionList(java.util.List actions, java.util.Collection derivedEvents, SCXMLExecutor exec, ErrorReporter errRep)
           
 void executeActions(org.apache.taglibs.rdc.scxml.Step step, SCXMLExecutor exec, ErrorReporter errRep)
          Exectutes all OnExit/Transition/OnEntry transitional actions.
 void filterTransitionsSet(org.apache.taglibs.rdc.scxml.Step step, Evaluator evaluator, ErrorReporter errRep)
           
 SCXML normalizeStateMachine(SCXML input, ErrorReporter errRep)
           
 void seedTargetSet(org.apache.taglibs.rdc.scxml.Step step, ErrorReporter errRep)
           
 void updateHistoryStates(org.apache.taglibs.rdc.scxml.Step step, ErrorReporter errRep)
          Go over the exit list and update history information for relevant states.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

appLog

protected static org.apache.commons.logging.Log appLog

ttc

protected org.apache.taglibs.rdc.scxml.TransitionTargetComparator ttc
Constructor Detail

SCXMLSemantics

public SCXMLSemantics()
Method Detail

normalizeStateMachine

public SCXML normalizeStateMachine(SCXML input,
                                   ErrorReporter errRep)
Parameters:
input - SCXML state machine
errRep - ErrorReporter callback
Returns:
normalized SCXML state machine, pseudo states are removed, etc.

determineInitialStates

public void determineInitialStates(SCXML input,
                                   java.util.Set states,
                                   java.util.List entryList,
                                   ErrorReporter errRep)
                            throws ModelException
Parameters:
input - SCXML state machine [in]
states - a set of States to populate [out]
entryList - a list of States and Parallels to enter [out]
errRep - ErrorReporter callback [inout]
Throws:
ModelException - in case there is a fatal SCXML object model problem.

executeActionList

public void executeActionList(java.util.List actions,
                              java.util.Collection derivedEvents,
                              SCXMLExecutor exec,
                              ErrorReporter errRep)
                       throws ModelException,
                              SCXMLExpressionException
Parameters:
actions - a list of actions to execute [in]
derivedEvents - collection of internal events generated by the actions [out]
exec - execution environment [inout]
Throws:
ModelException - in case there is a fatal SCXML object model problem.
SCXMLExpressionException
See Also:
ErrorReporter, NotificationRegistry, EventDispatcher, Context, Evaluator

executeActions

public void executeActions(org.apache.taglibs.rdc.scxml.Step step,
                           SCXMLExecutor exec,
                           ErrorReporter errRep)
                    throws ModelException
Exectutes all OnExit/Transition/OnEntry transitional actions.

Parameters:
step - [inout] provides EntryList, TransitList, ExitList gets updated its AfterStatus/Events
exec - [inout] execution environment - SCXMLExecutor instance
errRep - [out[ error reporter
Throws:
ModelException - in case there is a fatal SCXML object model problem.

enumerateReachableTransitions

public void enumerateReachableTransitions(SCXML stateMachine,
                                          org.apache.taglibs.rdc.scxml.Step step,
                                          ErrorReporter errRep)
Parameters:
stateMachine - a SM to traverse [in]
step - with current status and list of transitions to populate [inout]
errRep - ErrorReporter callback [inout]

filterTransitionsSet

public void filterTransitionsSet(org.apache.taglibs.rdc.scxml.Step step,
                                 Evaluator evaluator,
                                 ErrorReporter errRep)
Parameters:
step - [inout]
evaluator - guard condition evaluator
errRep - ErrorReporter callback [inout]

seedTargetSet

public void seedTargetSet(org.apache.taglibs.rdc.scxml.Step step,
                          ErrorReporter errRep)
Parameters:
step - transitional step
errRep - ErrorReporter callback [inout]

determineTargetStates

public void determineTargetStates(java.util.Set states,
                                  ErrorReporter errRep)
                           throws ModelException
Parameters:
states - a set seeded in previous step [inout]
errRep - ErrorReporter callback [inout]
Throws:
ModelException
See Also:
seedTargetSet(Step, ErrorReporter)

buildOnExitOnEntryLists

public void buildOnExitOnEntryLists(org.apache.taglibs.rdc.scxml.Step step,
                                    ErrorReporter errRep)
Parameters:
step - [inout]
errRep - ErrorReporter callback [inout]

updateHistoryStates

public void updateHistoryStates(org.apache.taglibs.rdc.scxml.Step step,
                                ErrorReporter errRep)
Go over the exit list and update history information for relevant states.

Parameters:
step - [inout]
errRep - ErrorReporter callback [inout]

eventMatch

public boolean eventMatch(java.lang.String transEvent,
                          java.util.Set eventOccurrences)
Implements prefix match, that is, if, for example, "mouse.click" is a member of eventOccurrences and a transition is triggered by "mouse", the method returns true.

Parameters:
transEvent - a trigger event of a transition
eventOccurrences - current events
Returns:
true/false


Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.