public class MainControl
extends java.lang.Object
| Constructor and Description |
|---|
MainControl(UserInterface userInterface,
GraphanaScriptSystemInterface scriptSystem)
The constructor needs a user interface to do user output and input and a script system in which the script language is implemented.
|
| Modifier and Type | Method and Description |
|---|---|
ScriptCallSignature |
createScriptCallSignature(java.lang.String scriptFilename)
Creates a new uninitialized script call signature.
|
ExecutionReturn |
execFile(java.lang.String filename)
Parses and executes the file which is given as a filename.
|
ExecutionReturn |
execute(java.lang.String source)
Parses and executes the given source whereas HELP is disabled.
|
ExecutionReturn |
execute(java.lang.String source,
boolean helpEnabled)
Parses and executes the given source string.
|
int |
getAlgorithmTime()
Returns the current timer value of the algorithm timer.
|
long |
getAlgorithmTimeout()
Returns the maximum algorithm computation time.
|
java.lang.String |
getCurrentDirectory()
Returns the current directory where to find sub directories etc. of the program.
|
GraphLibrary<?,?> |
getCurrentGraph()
Returns the current graph on which graph operations are applied.
|
GraphLibManager |
getGraphLibManager()
Returns the manager for the graph libraries.
|
java.io.FileWriter |
getInputStreamFile()
Returns the current input stream file.
|
OperationSet |
getOperationSet()
Returns the operation set which contains all registered operations.
|
java.io.FileWriter |
getOutputStreamFile()
Returns the current output stream file.
|
ScriptSignatureSet |
getScriptSignatures()
Returns all registered script signatures.
|
GraphanaScriptSystemInterface |
getScriptSystem()
Returns the script system of the main control.
|
long |
getScriptTimeout()
Returns the maximum script execution time.
|
UserInterface |
getUserInterface()
Returns the user interface which handles user input and output.
|
VisualizationManager |
getVisualizationManager()
Returns the manager for the graph visualizations.
|
boolean |
hasCurrentGraph()
Returns true, if and only if a current graph is set.
|
void |
incAlgorithmTimer(long value)
Increments the algorithm timer by the given time value.
|
boolean |
isAlgoTimerActive()
Tells whether or not the algorithm timer is running.
|
boolean |
isCachingOn()
Tells whether or not caching of algorithm results is activated.
|
boolean |
isPrintStackTraces()
Returns whether or not exceptions are printed using the console output.
|
ExecutionError |
registerOperation(Operation operation)
Adds the given operation to the operation set.
|
ExecutionError |
registerOperations(OperationGroup operationGroup)
Registers all operations of the given operation group in the operation set.
|
void |
setAlgorithmTimeout(long timeOut)
Sets the maximum computation time for an algorithm.
|
void |
setAlgoTimerActive(boolean active)
Activates or deactivates the algorithm timer without setting it to zero.
|
void |
setCachingOn(boolean cachingOn)
Enables or disables caching of algorithm results.
|
void |
setCurrentGraph(GraphLibrary<?,?> graph)
Sets the current graph.
|
void |
setInputStreamFile(java.io.FileWriter inputStreamFile)
Sets the current input stream file.
|
void |
setOutputStreamFile(java.io.FileWriter curOutputFile)
Sets the output stream file.
|
void |
setPrintStackTraces(boolean enable)
If enabled, then exceptions will be directly printed.
|
void |
setScriptTimeout(long timeOut)
Sets the maximum script execution time.
|
void |
startAlgorithmTimer()
Activates the algorithm timer.
|
void |
writeInputStream(java.lang.String input)
Writes the given string into the file which was set as the input stream file before.
|
public MainControl(UserInterface userInterface, GraphanaScriptSystemInterface scriptSystem)
userInterface - A user interface for output and inputscriptSystem - A script system to handle string statements to parse and execute thempublic GraphanaScriptSystemInterface getScriptSystem()
public void setPrintStackTraces(boolean enable)
enable - if true, exceptions will be printed using the console output.public boolean isPrintStackTraces()
public ExecutionReturn execute(java.lang.String source, boolean helpEnabled)
source - the source string in correct syntax.helpEnabled - determines, whether the string shall be checked if it starts with 'HELP' and call the help functionality, which is not part of the script system.public ExecutionReturn execute(java.lang.String source)
source - the source string in correct syntax.public ExecutionReturn execFile(java.lang.String filename)
filename - the relative or absolute path to the source file.public java.io.FileWriter getInputStreamFile()
public void setInputStreamFile(java.io.FileWriter inputStreamFile)
inputStreamFile - a file writer to write to when there is an user input.public void writeInputStream(java.lang.String input)
input - The string which shall be written.public boolean isCachingOn()
public void setCachingOn(boolean cachingOn)
cachingOn - Sets caching on or off, respectively.public GraphLibrary<?,?> getCurrentGraph()
public void setCurrentGraph(GraphLibrary<?,?> graph)
graph - The graph which shall be set as the current graph.public UserInterface getUserInterface()
public OperationSet getOperationSet()
public ExecutionError registerOperation(Operation operation)
operation - the operation to register.public ExecutionError registerOperations(OperationGroup operationGroup)
operationGroup - operations the operation group containing the operations to add.public GraphLibManager getGraphLibManager()
public VisualizationManager getVisualizationManager()
public long getAlgorithmTimeout()
public void setAlgorithmTimeout(long timeOut)
timeOut - the maximum computation time for algorithms.public long getScriptTimeout()
public void setScriptTimeout(long timeOut)
timeOut - the maximum execution time for scripts.public void startAlgorithmTimer()
public int getAlgorithmTime()
public void incAlgorithmTimer(long value)
value - the value by which the algorithm timer shall be increased.public boolean isAlgoTimerActive()
public void setAlgoTimerActive(boolean active)
active - if true, the algorithm timer is activatedpublic void setOutputStreamFile(java.io.FileWriter curOutputFile)
curOutputFile - the new output stream file.public java.io.FileWriter getOutputStreamFile()
public boolean hasCurrentGraph()
public java.lang.String getCurrentDirectory()
public ScriptSignatureSet getScriptSignatures()
public ScriptCallSignature createScriptCallSignature(java.lang.String scriptFilename)
scriptFilename - the file name of the script.