public final class OctaveEngine extends Object
| Modifier and Type | Field and Description |
|---|---|
private OctaveEngineFactory |
factory |
private OctaveExec |
octaveExec
The executor of this octave engine.
|
private OctaveIO |
octaveIO |
private Random |
random
Describe variable
random here. |
private Writer |
writer
The writer to write to stdout.
|
| Constructor and Description |
|---|
OctaveEngine(OctaveEngineFactory factory,
int numThreadsReuse,
Writer octaveInputLog,
Writer errorWriter,
String[] cmdArray,
String[] environment,
File workingDir)
Creates an octave engine with the given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the octave process in an orderly fashion.
|
void |
destroy()
Kill the octave process without remorse.
|
void |
eval(String script)
A safe eval that will not break the engine on syntax errors
or other errors.
|
<T extends OctaveObject> |
get(Class<T> castClass,
String key) |
OctaveObject |
get(String key) |
OctaveEngineFactory |
getFactory() |
private ReadFunctor |
getReadFunctor()
Returns the according read functor:
If
writer is non-null,
wrap it into a WriterReadFunctor. |
String |
getVersion()
Return the version of the octave implementation.
|
void |
put(String key,
OctaveObject value)
Sets a value in octave.
|
void |
putAll(Map<String,OctaveObject> vars)
Sets all the mappings in the specified map as variables in octave.
|
void |
setErrorWriter(Writer errorWriter)
Set the writer that the scripts error output will be written to.
|
void |
setWriter(Writer writer)
Set the writer that the scripts output will be written to.
|
void |
unsafeEval(Reader script)
Execute the given script.
|
void |
unsafeEval(String script)
Execute the given script.
|
private final OctaveEngineFactory factory
private final OctaveExec octaveExec
private final OctaveIO octaveIO
private Writer writer
private final Random random
random here.OctaveEngine(OctaveEngineFactory factory, int numThreadsReuse, Writer octaveInputLog, Writer errorWriter, String[] cmdArray, String[] environment, File workingDir)
OctaveExec(int,Writer,Writer,String[],String[],File).private ReadFunctor getReadFunctor()
writer is non-null,
wrap it into a WriterReadFunctor.
Otherwise, create functor from a reader
which reads empty, i.e. without action, as long as the reader is empty.public void unsafeEval(Reader script)
script - the script to executeOctaveIOException - if the script fails, this will kill the enginepublic void unsafeEval(String script)
script - the script to executeOctaveIOException - if the script fails, this will kill the enginepublic void eval(String script)
script - the script to executeOctaveEvalException - if the script failspublic void put(String key, OctaveObject value)
key - the name of the variablevalue - the value to setpublic void putAll(Map<String,OctaveObject> vars)
vars - the variables to be stored in octavepublic OctaveObject get(String key)
key - the name of the variablepublic <T extends OctaveObject> T get(Class<T> castClass, String key)
T - the class of the return valuecastClass - Class to cast tokey - the name of the variableOctaveClassCastException - if the object can not be cast to a castClasspublic OctaveEngineFactory getFactory()
public void setWriter(Writer writer)
writer - the writer to setpublic void setErrorWriter(Writer errorWriter)
errorWriter - the errorWriter to setpublic void close()
public void destroy()
public String getVersion()
Copyright © 2006–2018 Simuline Organization (l2r). All rights reserved.