//remove list (filtered-out list)
List removeList = new LinkedList();
//iterate over non-filtered transition set
for (Iterator iter = step.getTransitList().iterator();
iter.hasNext();) {
Transition t = (Transition) iter.next();
// event check
String event = t.getEvent();
if (!eventMatch(event, allEvents)) {
// t has a non-empty event which is not triggered
removeList.add(t);
continue; //makes no sense to eval guard cond.
}
// guard condition check
Boolean rslt;
String expr = t.getCond();
if (SCXMLHelper.isStringEmpty(expr)) {
rslt = Boolean.TRUE;
} else {
try {
Context ctx = scInstance.getContext(t.getParent());
ctx.setLocal(NAMESPACES_KEY, t.getNamespaces());
rslt = scInstance.getEvaluator().evalCond(ctx,
t.getCond());
ctx.setLocal(NAMESPACES_KEY, null);
} catch (SCXMLExpressionException e) {
rslt = Boolean.FALSE;
errRep.onError(ErrorConstants.EXPRESSION_ERROR, e
.getMessage(), t);
}
}
if (!rslt.booleanValue()) {
// guard condition has not passed
removeList.add(t);
}
}
// apply event + guard condition filter
step.getTransitList().removeAll(removeList);
// cleanup temporary structures
allEvents.clear();
removeList.clear();
// optimization - global precedence potentially applies
// only if there are multiple enabled transitions
if (step.getTransitList().size() > 1) {
// global transition precedence check
Object[] trans = step.getTransitList().toArray();
Set currentStates = step.getBeforeStatus().getStates();
// non-determinism candidates
Set nonDeterm = new HashSet();
for (int i = 0; i < trans.length; i++) {
Transition t = (Transition) trans[i];
TransitionTarget tsrc = t.getParent();
for (int j = i + 1; j < trans.length; j++) {
Transition t2 = (Transition) trans[j];
boolean conflict = SCXMLHelper.inConflict(t, t2,
currentStates);
if (conflict) {
//potentially conflicting transitions
TransitionTarget t2src = t2.getParent();
if (SCXMLHelper.isDescendant(t2src, tsrc)) {
//t2 takes precedence over t
removeList.add(t);
break; //it makes no sense to waste cycles with t
} else if (SCXMLHelper.isDescendant(tsrc, t2src)) {