in src/main/java/org/apache/commons/scxml2/io/ModelUpdater.java [447:476]
private static boolean verifyTransitionTargets(final Set<TransitionTarget> tts) {
if (tts.size() < 2) { // No contention
return true;
}
TransitionTarget first = null;
int i = 0;
for (final TransitionTarget tt : tts) {
if (first == null) {
first = tt;
i = tt.getNumberOfAncestors();
continue;
}
// find least common ancestor
for (i = Math.min(i, tt.getNumberOfAncestors()); i > 0 && first.getAncestor(i-1) != tt.getAncestor(i-1); i--) {
}
if (i == 0) {
// no common ancestor
return false;
}
// ensure no target is an ancestor of any other target on the list
for (final TransitionTarget other : tts) {
if (other != tt && other.isDescendantOf(tt) || tt.isDescendantOf(other)) {
return false;
}
}
}
// least common ancestor must be a parallel
return first != null && i > 0 && first.getAncestor(i-1) instanceof Parallel;
}