|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jwo.landserf.script.ScriptEngine
public class ScriptEngine
Allows LandSerf functions to be called from the command line or script file.
Field Summary | |
---|---|
static String |
COPYRIGHT
Copyright statement. |
static String |
DATE
Last modified date. |
static float |
VERSION
Current numeric version of LandScript. |
static String |
VERSION_TEXT
Text representing current version of LandScript. |
Constructor Summary | |
---|---|
ScriptEngine()
Sets up the script engine with a default text-based gisFrame to hold spatial objects and report results. |
|
ScriptEngine(GISFrame gisFrame)
Sets up the script engine using the given gisFrame to hold spatial objects and report results. |
Method Summary | |
---|---|
void |
addVariableListener(VariableListener varListener)
Adds a variable listener to those that are informed when the number of variables stored by the script engine changes. |
void |
checkScript()
Checks the script currently stored in this object. |
HashSet |
getCommands()
Reports the list of commands available to the script engine. |
String |
getFormattedCommandText()
Reports a formatted list of commands and their parameters. |
HashSet |
getFunctions()
Reports the list of functions available to the script engine. |
String |
getReservedWords()
Reports an alphabetical list of all reserved words (keywords and functions). |
void |
interruptionRequested()
Responds to a request for an interruption of the script. |
static void |
main(String[] args)
Starts the LandScript interpreter with the given script file. |
void |
parseFile(String fileName)
Parses the script stored in the given file. |
boolean |
removeVariableListener(VariableListener varListener)
Removes the given variable listener from those that are informed when the number of variables stored by the script engine changes. |
void |
run()
Parses the script currently stored in this object. |
void |
setEditor(ScriptEditor scriptEditor)
Sets the script editor in which extra messages and progress can be reported. |
void |
setLogger(Logger otherLogger)
Allows a logger to capture script engine input. |
void |
setScript(String script)
Sets the script to be parsed. |
void |
showError()
Displays an empty error message indicating the line that caused it. |
void |
showError(String message)
Displays an error message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String VERSION_TEXT
public static final float VERSION
public static final String DATE
public static final String COPYRIGHT
Constructor Detail |
---|
public ScriptEngine()
public ScriptEngine(GISFrame gisFrame)
gisFrame
- GISFrame that stores spatial objects and outputs messages.Method Detail |
---|
public static void main(String[] args)
-gui
option
is included, this will start the graphical LandScript editor, if not, the given
script will be run.
args
- Command line argument containing name of LandScript file to read.public void setLogger(Logger otherLogger)
Level.FINE
.
Note that output from the scripting is sent to the supplied
GISFrame
, stdout or stderr.
otherLogger
- Logger to receive messages.public void addVariableListener(VariableListener varListener)
varListener
- Variable listener to add.public boolean removeVariableListener(VariableListener varListener)
varListener
- Variable listener to remove.
public void parseFile(String fileName)
fileName
- Name of file containing script instructions.public String getReservedWords()
public String getFormattedCommandText()
public HashSet getCommands()
public HashSet getFunctions()
open()
, colouredit()
) etc.
public void setScript(String script)
run()
method. The script can also be parsed as a
threaded process by passing this object to a Thread
and calling
its start()
method.
script
- Script that can be parsed.public void setEditor(ScriptEditor scriptEditor)
scriptEditor
- GUI in which messages and progress can be reported.public void run()
parseFile()
or setScript()
. Will report an error if the script
cannot be parsed.
run
in interface Runnable
public void checkScript()
public void interruptionRequested()
interruptionRequested
in interface JWInterruptionListener
public void showError()
public void showError(String message)
message
- Message to display.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |