Iterator iterator = currentState.nonpreemptiveTransitionList()
.listIterator();
while (iterator.hasNext()) {
Transition transition = (Transition) iterator.next();
ParseTreeEvaluatorForGuardExpression parseTreeEvaluator = (ParseTreeEvaluatorForGuardExpression) transition
.getParseTreeEvaluator();
RelationList relationList = parseTreeEvaluator
.getRelationList();
relationList.resetRelationList();
}
iterator = currentState.preemptiveTransitionList().listIterator();
while (iterator.hasNext()) {
Transition transition = (Transition) iterator.next();
ParseTreeEvaluatorForGuardExpression parseTreeEvaluator = (ParseTreeEvaluatorForGuardExpression) transition
.getParseTreeEvaluator();
RelationList relationList = parseTreeEvaluator
.getRelationList();
relationList.resetRelationList();
}
// If the top level of the model is modal model, the director
// is null. We do not request to be fired again since no one in
// the upper level of hierarchy will do that.
if (executiveDirector != null) {
if (_debugging) {
_debug(executiveDirector.getFullName()
+ " requests refiring at " + getModelTime());
}
// If there is one transition enabled, the HSFSMDirector requests
// to be fired again at the same time to see whether the next
// state has some outgoing transition enabled.
executiveDirector.fireAt(container, getModelTime());
}
// If this iteration will not generate more events, (the
// current phase of execution is neithter generating-event nor
// iterating-purely-discrete-actors), or the executive director
// is not a CT director, reset the _enabledTransition to null.
// Here we reset the cached enabled transition at the
// updating-continuous-states phase, indicating the end of a
// complete iteration of the executive CT director.
// This guarantees that at most one transition is taken in an
// iteration of discrete phase of execution.
// To be more specific, for each (t, n), there is at most
// one event.
if ((getExecutionPhase() == CTExecutionPhase.UPDATING_CONTINUOUS_STATES_PHASE)
|| (executiveDirector == null)) {
// Only clear the cached enabled transition when no more events
// will be generated at the current discrete phase of execution.
_enabledTransition = null;
// Enable mutation when the current phase of execution is
// updating continuous states.
// This is to avoid unnecessary change requests made by
// the super class FSMDirector.
_mutationEnabled = true;
}
} else {
if ((getExecutionPhase() == CTExecutionPhase.GENERATING_EVENTS_PHASE)
|| (getExecutionPhase() == CTExecutionPhase.POSTFIRING_EVENT_GENERATORS_PHASE)) {
// Only commit the current states of the relationlists
// of all the transitions during these execution phases.
Iterator iterator = currentState.nonpreemptiveTransitionList()
.listIterator();
while (iterator.hasNext()) {
Transition transition = (Transition) iterator.next();
ParseTreeEvaluatorForGuardExpression parseTreeEvaluator = (ParseTreeEvaluatorForGuardExpression) transition
.getParseTreeEvaluator();
RelationList relationList = parseTreeEvaluator
.getRelationList();
relationList.commitRelationValues();
}
iterator = currentState.preemptiveTransitionList()
.listIterator();
while (iterator.hasNext()) {
Transition transition = (Transition) iterator.next();
ParseTreeEvaluatorForGuardExpression parseTreeEvaluator = (ParseTreeEvaluatorForGuardExpression) transition
.getParseTreeEvaluator();
RelationList relationList = parseTreeEvaluator
.getRelationList();
relationList.commitRelationValues();
}
}
}