private boolean getOpenConditionValue(double simTime) { try { // Evaluate the condition (0 = false, non-zero = true) boolean ret = ExpEvaluator.evaluateExpression(openCondition.getValue(), simTime, this).value != 0; return ret; } catch (ExpError e) { error("%s", e.getMessage()); return false; // never hit, error() will throw } }
@Override public double getNextSample(double simTime) { double ret = 0.0; try { ExpResult res = ExpEvaluator.evaluateExpression(exp, simTime, thisEnt); if (res.unitType != unitType) thisEnt.error( "Invalid unit returned by an expression. Received: %s, expected: %s", res.unitType.getSimpleName(), unitType.getSimpleName(), ""); ret = res.value; } catch (ExpError e) { thisEnt.error("%s", e.getMessage()); } return ret; }