* some event has been detected due to crossing some level.
* @return True if the transition is enabled and some event is detected.
* @exception IllegalActionException If thrown when evaluating the guard.
*/
public boolean isEnabled() throws IllegalActionException {
ParseTreeEvaluator parseTreeEvaluator = getParseTreeEvaluator();
FSMActor fsmActor = (FSMActor) getContainer();
if (_guardParseTree == null) {
String expr = getGuardExpression();
// Parse the guard expression.
PtParser parser = new PtParser();
try {
_guardParseTree = parser.generateParseTree(expr);
} catch (IllegalActionException ex) {
throw new IllegalActionException(this, ex,
"Failed to parse guard expression \"" + expr + "\"");
}
}
Token token = parseTreeEvaluator.evaluateParseTree(_guardParseTree,
fsmActor.getPortScope());
if (token == null) {
// FIXME: when could this happen??
return false;
}