*/
public void assignNonPtalonParameters(ComponentEntity actor)
throws PtalonRuntimeException {
try {
PtParser parser = new PtParser();
ParseTreeEvaluator _parseTreeEvaluator = new ParseTreeEvaluator();
for (String parameterName : _parameters.keySet()) {
String expression = _parameters.get(parameterName);
if (expression == null) {
throw new PtalonRuntimeException(
"Unable to find expression label for "
+ "parameter " + parameterName);
}
ASTPtRootNode parseTree = parser
.generateParseTree(expression);
try {
Parameter parameter = (Parameter) actor
.getAttribute(parameterName);
if (parameter == null) {
String uniqueName = actor.uniqueName(parameterName);
// FIXME: Ptalon assumes that any
// parameter we give that is not
// predefined in the actor should be an
// instance of Parameter. This is not
// always the case. Ptalon syntax needs to
// be extended to specify new parameters
// of a specified class. For now, we
// intercept parameters with name
// "_location" since these are
// particularly useful for graphical
// demos.
if (uniqueName.equals("_location")) {
parameter = new LocationParameter(actor,
uniqueName);
} else {
parameter = new Parameter(actor, uniqueName);
}
}
try {
Token result = _parseTreeEvaluator
.evaluateParseTree(parseTree, _scope);
parameter.setToken(result);
// We have to validate the parameter so that
// value dependents (if any) are notified of
// the new value, and so that attributeChanged()