|
def | __init__ (self, theStateMachine, theContext, externalEventQueue=None, internalEventQueue=None) |
|
def | getStatus (self) |
|
def | getModel (self) |
|
def | getContext (self) |
|
def | getEventHandlingPolicy (self) |
|
def | isRunning (self) |
|
def | isFinal (self) |
|
def | isEventProcessable (self, e) |
| Check wheter an event enables transitions or not. More...
|
|
def | start (self) |
| First perform in-place expansions of states by including SCXML source referenced by URLs (see 3.13 Referencing External Files) and change initial attributes to initial container children with empty transitions to the state from the attribute. More...
|
|
def | stop (self) |
|
def | postEvent (self, theEvent) |
|
def | processEvent (self, theEvent) |
|
def | processEvents (self) |
|
def | processInternalEvents (self) |
|
def | exitInterpreter (self) |
| The purpose of this procedure is to exit the current SCXML process by exiting all active states. More...
|
|
def | selectEventlessTransitions (self) |
| This function selects all transitions that are enabled in the current configuration that do not require an event trigger. More...
|
|
def | selectTransitions (self, e) |
| The purpose of the selectTransitions() procedure is to collect the transitions that are enabled by this event in the current configuration. More...
|
|
def | microstep (self, enabledTransitions) |
| The purpose of the microStep procedure is to process the set of transitions enabled by an external event, an internal event, or by the presence or absence of certain values in the dataModel at the current point in time. More...
|
|
def | exitStates (self, enabledTransitions) |
| Create an empty statesToExit set. More...
|
|
def | executeTransitionContent (self, enabledTransitions) |
|
def | enterStates (self, enabledTransitions) |
|
def | addStatesToEnter (self, s, root, statesToEnter, statesForDefaultEntry) |
|
def | setModel (self, theStateMachine) |
|
def | setContext (self, theContext) |
|
def | setEventHandlingPolicy (self, policy) |
|
def | addEventListener (self, eventListener) |
|
def | removeEventListener (self, eventListener) |
|
def | removeAllEventListener (self) |
|
def | notifyEventListeners (self, theEvent) |
|
def | addStatusListener (self, statusListener) |
|
def | removeStatusListener (self, statusListener) |
|
def | removeAllStatusListener (self) |
|
def | notifyStatusListeners (self, theStatus) |
|
def scxml4py.executor.Executor.exitStates |
( |
|
self, |
|
|
|
enabledTransitions |
|
) |
| |
Create an empty statesToExit set.
For each transition t in enabledTransitions, if t is targetLess then do nothing,
else let LCA be the least common ancestor state of the source state and target states of t.
Add to the statesToExit set all states in the configuration that are descendants of LCA.
Convert the statesToExit set to a list and sort it in exitOrder.
For each state s in the list, if s has a deep history state h, set the history value
of h to be the list of all atomic descendants of s that are members in the current
configuration, else set its value to be the list of all immediate children of s that
are members of the current configuration.
Again for each state s in the list, first execute any onExit handlers, then cancel any
ongoing invocations, and finally remove s from the current configuration.
procedure exitStates(enabledTransitions):
statesToExit = new Set()
for t in enabledTransitions:
if (t.attribute('target') != null):
LCA = findLCA([t.parent()].append(getTargetStates(t)))
for s in configuration.toList(): if (isDescendant(s,LCA)):
statesToExit.add(s)
statesToExit = statesToExit.toList().sort(exitOrder)
for s in statesToExit: for h in s.history: f = (h.attribute('type') == "deep") ? lambda isAtomicState(s0) && isDescendant(s0,s) : lambda s0.parent() == s
historyValue[h.attribute('id')] = configuration.toList().filter(f)
for s in statesToExit: for content in s.onexit:
for inv in s.invoke: cancelInvoke(inv)
def scxml4py.executor.Executor.microstep |
( |
|
self, |
|
|
|
enabledTransitions |
|
) |
| |
The purpose of the microStep procedure is to process the set of transitions enabled by an external event, an internal event, or by the presence or absence of certain values in the dataModel at the current point in time.
The processing of the enabled transitions must be done in parallel ('lock step') in the sense that their source states must first be exited, then their actions must be executed, and finally their target states entered.
def scxml4py.executor.Executor.selectEventlessTransitions |
( |
|
self | ) |
|
This function selects all transitions that are enabled in the current configuration that do not require an event trigger.
First test if the state has been preempted by a transition that has already been selected and that will cause the state to be exited when the transition is taken. If the state has not been preempted, find a transition with no 'event' attribute whose condition evaluates to true. If multiple matching transitions are present, take the first in document order. If none are present, search in the state's ancestors in ancestory order until one is found. As soon as such a transition is found, add it to enabledTransitions, and proceed to the next atomic state in the configuration. If no such transition is found in the state or its ancestors, proceed to the next state in the configuration. When all atomic states have been visited and transitions selected, return the set of enabled transitions.
def scxml4py.executor.Executor.selectTransitions |
( |
|
self, |
|
|
|
e |
|
) |
| |
The purpose of the selectTransitions() procedure is to collect the transitions that are enabled by this event in the current configuration.
Create an empty set of enabledTransitions. For each atomic state in the configuration, first check if the event is the result of an <invoke> in this state. If so, apply any <finalize> code in the state. Next test if the state has been preempted by a transition that has already been selected and that will cause the state to be exited when the transition is taken. If the state has not been preempted, find a transition whose 'event' attribute matches event and whose condition evaluates to true. If multiple matching transitions are present, take the first in document order. If none are present, search in the state's ancestors in ancestory order until one is found. As soon as such a transition is found, add it to enabledTransitions, and proceed to the next atomic state in the configuration. If no such transition is found in the state or its ancestors, proceed to the next state in the configuration. When all atomic states have been visited and transitions selected, return the set of enabled transitions.