in src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java [108:153]
public void addDescendantStatesToEnter(final SCXMLExecutionContext exctx, final Step step,
final TransitionTarget tt) {
if (tt instanceof History) {
final History h = (History) tt;
Set<EnterableState> lastConfiguration = step.getNewHistoryConfigurations().get(h);
if (lastConfiguration == null) {
lastConfiguration = exctx.getScInstance().getLastConfiguration(h);
}
if (lastConfiguration.isEmpty()) {
step.getDefaultHistoryTransitions().put(h.getParent(), h.getTransition());
for (final TransitionTarget dtt : h.getTransition().getTargets()) {
addDescendantStatesToEnter(exctx, step, dtt);
}
for (final TransitionTarget dtt : h.getTransition().getTargets()) {
addAncestorStatesToEnter(exctx, step, dtt, tt.getParent());
}
} else {
for (final TransitionTarget dtt : lastConfiguration) {
addDescendantStatesToEnter(exctx, step, dtt);
}
for (final TransitionTarget dtt : lastConfiguration) {
addAncestorStatesToEnter(exctx, step, dtt, tt.getParent());
}
}
}
else { // tt instanceof EnterableState
final EnterableState es = (EnterableState)tt;
step.getEntrySet().add(es);
if (es instanceof Parallel) {
for (final EnterableState child : ((Parallel)es).getChildren()) {
if (containsNoDescendant(step.getEntrySet(), child)) {
addDescendantStatesToEnter(exctx, step, child);
}
}
}
else if (es instanceof State && ((State) es).isComposite()) {
step.getDefaultEntrySet().add(es);
for (final TransitionTarget dtt : ((State)es).getInitial().getTransition().getTargets()) {
addDescendantStatesToEnter(exctx, step, dtt);
}
for (final TransitionTarget dtt : ((State)es).getInitial().getTransition().getTargets()) {
addAncestorStatesToEnter(exctx, step, dtt, tt);
}
}
}
}