MetaDone
metadone.metabusiness.script.ScriptEvaluator Interface Reference
Inheritance diagram for metadone.metabusiness.script.ScriptEvaluator:

List of all members.

Classes

class  Abstract
interface  ScriptResult

Public Member Functions

void declareVariable (String name, Object value)
void clearVariables ()
Properties properties ()
ScriptResult evaluate (String script)
ProgLanguage getLanguage ()
ScriptResult initScriptEvaluate ()
void reset ()

Detailed Description

Evaluates a script with a given context.

Once an evaluator is created, it has its own context. This context may be changed by the calls to the set methods. From there, evaluate(String) works as a REPL (read-evaluate-print-loop).

A simple usage example:

 ScriptResult r;
 ScriptEvaluator ev = ...;
 r = ev.evaluate("function abc(arg) { return arg + self; }");
 if (r.isException()) throw new RuntimeException(r.getException());
 r = ev.evaluate("a = 5 + 3");
 System.out.println(r.getNumber()); // 8
 ev.setSelf(1);
 r = ev.evaluate("abc(a)");
 System.out.println(r.getNumber()); // 9
 
Author:
kma

Member Function Documentation

ScriptResult metadone.metabusiness.script.ScriptEvaluator.evaluate ( String  script)
ProgLanguage metadone.metabusiness.script.ScriptEvaluator.getLanguage ( )
ScriptResult metadone.metabusiness.script.ScriptEvaluator.initScriptEvaluate ( )

Evaluates the initialization script.

Returns:
The result of the initialization

Implemented in metadone.metabusiness.script.groovy.GroovyEvaluator, and metadone.metabusiness.script.ScriptEvaluator.Abstract.

Referenced by metadone.client.grasyla2.GrasylaInterpreter.runInitScript().

Properties metadone.metabusiness.script.ScriptEvaluator.properties ( )

Gets the properties (modifications performed on the returned properties are reflected in this class).

Returns:
The properties

Implemented in metadone.metabusiness.script.ScriptEvaluator.Abstract.

void metadone.metabusiness.script.ScriptEvaluator.reset ( )

The documentation for this interface was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations