org.scijava.script
Class DefaultScriptInterpreter

java.lang.Object
  extended by org.scijava.script.DefaultScriptInterpreter
All Implemented Interfaces:
ScriptInterpreter

public class DefaultScriptInterpreter
extends Object
implements ScriptInterpreter

The default implementation of a ScriptInterpreter.

Author:
Johannes Schindelin

Constructor Summary
DefaultScriptInterpreter(PrefService prefs, ScriptService scriptService, ScriptLanguage language)
          Constructs a new DefaultScriptInterpreter.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultScriptInterpreter

public DefaultScriptInterpreter(PrefService prefs,
                                ScriptService scriptService,
                                ScriptLanguage language)
Constructs a new DefaultScriptInterpreter.

Parameters:
scriptService - the script service
language - the script language
Method Detail

readHistory

public void readHistory()
Description copied from interface: ScriptInterpreter
Reads the persisted history of the current script interpreter.

Specified by:
readHistory in interface ScriptInterpreter

writeHistory

public void writeHistory()
Description copied from interface: ScriptInterpreter
Persists the history of the current script interpreter.

Specified by:
writeHistory in interface ScriptInterpreter

walkHistory

public String walkHistory(String currentCommand,
                          boolean forward)
Description copied from interface: ScriptInterpreter
Obtains the next/previous command in the command history.

Specified by:
walkHistory in interface ScriptInterpreter
Parameters:
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 one
Returns:
the next/previous command

eval

public void eval(String command)
          throws ScriptException
Description copied from interface: ScriptInterpreter
Evaluates a command.

Specified by:
eval in interface ScriptInterpreter
Parameters:
command - the command to evaluate
Throws:
ScriptException

getLanguage

public ScriptLanguage getLanguage()
Description copied from interface: ScriptInterpreter
Returns the associated ScriptLanguage.

Specified by:
getLanguage in interface ScriptInterpreter

getEngine

public ScriptEngine getEngine()
Description copied from interface: ScriptInterpreter
Returns the associated ScriptEngine.

Specified by:
getEngine in interface ScriptInterpreter
Returns:
the script engine


Copyright © 2009–2015 SciJava. All rights reserved.