public class DefaultScriptInterpreter extends Object implements ScriptInterpreter
ScriptInterpreter
.Constructor and Description |
---|
DefaultScriptInterpreter(PrefService prefs,
ScriptService scriptService,
ScriptLanguage language)
Constructs a new
DefaultScriptInterpreter . |
Modifier and Type | Method and Description |
---|---|
void |
eval(String command)
Evaluates a command.
|
ScriptEngine |
getEngine()
Returns the associated
ScriptEngine . |
ScriptLanguage |
getLanguage()
Returns the associated
ScriptLanguage . |
void |
readHistory()
Reads the persisted history of the current script interpreter.
|
String |
walkHistory(String currentCommand,
boolean forward)
Obtains the next/previous command in the command history.
|
void |
writeHistory()
Persists the history of the current script interpreter.
|
public DefaultScriptInterpreter(PrefService prefs, ScriptService scriptService, ScriptLanguage language)
DefaultScriptInterpreter
.scriptService
- the script servicelanguage
- the script languagepublic void readHistory()
ScriptInterpreter
readHistory
in interface ScriptInterpreter
public void writeHistory()
ScriptInterpreter
writeHistory
in interface ScriptInterpreter
public String walkHistory(String currentCommand, boolean forward)
ScriptInterpreter
walkHistory
in interface ScriptInterpreter
currentCommand
- the current command (will be stored in the history)forward
- if true, the next history entry is returned (more recent),
if false, the previous onepublic void eval(String command) throws ScriptException
ScriptInterpreter
eval
in interface ScriptInterpreter
command
- the command to evaluateScriptException
public ScriptLanguage getLanguage()
ScriptInterpreter
ScriptLanguage
.getLanguage
in interface ScriptInterpreter
public ScriptEngine getEngine()
ScriptInterpreter
ScriptEngine
.getEngine
in interface ScriptInterpreter
Copyright © 2009–2015 SciJava. All rights reserved.