public interface Interpreter extends FactoryManaged
Modifier and Type | Method and Description |
---|---|
Object |
call(String functionName,
Object[] arguments)
Call a function defined by the program passing the objects as arguments.
|
void |
execute()
Execute the program.
|
Object |
getVariable(String name)
Get the value of a global variable.
|
void |
registerFunctions(Class<?> klass)
Register the functions defined in the class.
|
void |
registerHook(InterpreterHook hook) |
void |
setErrorWriter(Writer writer) |
void |
setProgram(BuildableProgram buildableProgram)
Set the program to execute.
|
void |
setReader(Reader reader) |
void |
setVariable(String name,
Object value)
Set the value of the global variable.
|
void |
setWriter(Writer writer) |
setFactory
void registerHook(InterpreterHook hook)
void setProgram(BuildableProgram buildableProgram)
buildableProgram
- void execute() throws ExecutionException
ExecutionException
void setVariable(String name, Object value) throws ExecutionException
name
- the name of the global variablevalue
- the value to be setExecutionException
Object getVariable(String name) throws ExecutionException
BasicDoubleValue
then the
implementation should return a Double
.name
- the name of the variableExecutionException
Object call(String functionName, Object[] arguments) throws ExecutionException
functionName
- the name of the function in the program codearguments
- the arguments to the functionnull
if the function does not
return valueExecutionException
void setReader(Reader reader)
reader
- ScriptContext.setReader(java.io.Reader)
void setWriter(Writer writer)
writer
- ScriptContext.setWriter(Writer)
void setErrorWriter(Writer writer)
writer
- ScriptContext.setErrorWriter(Writer)
void registerFunctions(Class<?> klass)
@Function
klass
- the class the defines the functions.Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.