in src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java [393:422]
public void recordHistory(final Step step, final Set<EnterableState> atomicStates, final Set<EnterableState> activeStates) {
for (final EnterableState es : step.getExitSet()) {
if (es instanceof TransitionalState && ((TransitionalState)es).hasHistory()) {
final TransitionalState ts = (TransitionalState)es;
Set<EnterableState> shallow = null;
Set<EnterableState> deep = null;
for (final History h : ts.getHistory()) {
if (h.isDeep()) {
if (deep == null) {
//calculate deep history for a given state once
deep = new HashSet<>();
for (final EnterableState ott : atomicStates) {
if (ott.isDescendantOf(es)) {
deep.add(ott);
}
}
}
step.getNewHistoryConfigurations().put(h, deep);
} else {
if (shallow == null) {
//calculate shallow history for a given state once
shallow = new HashSet<>(ts.getChildren());
shallow.retainAll(activeStates);
}
step.getNewHistoryConfigurations().put(h, shallow);
}
}
}
}
}