in src/main/java/org/apache/commons/scxml2/io/ModelUpdater.java [327:359]
private static void updateHistory(final History history,
final Map<String, TransitionTarget> targets,
final TransitionalState parent)
throws ModelException {
final SimpleTransition transition = history.getTransition();
if (transition == null || transition.getNext() == null) {
logAndThrowModelError(ERR_HISTORY_NO_DEFAULT,
new Object[] {history.getId(), getName(parent)});
}
else {
updateTransition(transition, targets);
final Set<TransitionTarget> historyStates = transition.getTargets();
if (historyStates.isEmpty()) {
logAndThrowModelError(ERR_STATE_NO_HIST,
new Object[] {getName(parent)});
}
for (final TransitionTarget historyState : historyStates) {
if (!history.isDeep()) {
// Shallow history
if (!parent.getChildren().contains(historyState)) {
logAndThrowModelError(ERR_STATE_BAD_SHALLOW_HIST,
new Object[] {getName(parent)});
}
} else {
// Deep history
if (!historyState.isDescendantOf(parent)) {
logAndThrowModelError(ERR_STATE_BAD_DEEP_HIST,
new Object[] {getName(parent)});
}
}
}
}
}