* value of the last expression evaluated in the script.
*/
public Object evaluate(String scriptstr)
throws InterpreterException {
Context ctx = enterContext();
ctx.setWrapHandler(wrapHandler);
Script script = null;
Entry et = null;
Iterator it = compiledScripts.iterator();
// between nlog(n) and log(n) because it is
// an AbstractSequentialList
while (it.hasNext()) {
if ((et = (Entry)(it.next())).str.equals(scriptstr)) {
// if it is not at the end, remove it because
// it will change from place (it is faster
// to remove it now)
script = et.script;
it.remove();
break;
}
}
if (script == null) {
// this script has not been compiled yet or has been fogotten
// since the compilation:
// compile it and store it for future use.
try {
script = ctx.compileReader(globalObject,
new StringReader(scriptstr),
"<SVG>",
1, rhinoClassLoader);
} catch (IOException io) {
// can't happen because we use a String...