public final class OctaveEngineFactory extends Object
OctaveEngineFactory()
then, optionally, change parameters
and finally create an Octave Engine using getScriptEngine()
with the current parameters.
To set a parameter, use the various setter methods.
In the documentation of each setter method,
also the default value is documented
which is used to create an OctaveEngine
if the setter method is not invoked.| Modifier and Type | Field and Description |
|---|---|
private String[] |
argsArray
The array of arguments of the octave engines created.
|
private String[] |
environment
An array of strings of the form
name=value
representing the environment, i.e. the set of environment variables
or null. |
private Writer |
errWriter
The error writer for the octave process.
|
private int |
numThreadsReuse
The number of threads to be reused or
-1 if there is no limit. |
private Writer |
octaveInputLog
If this is not
null, the octave engine created
writes the output to that log writer also. |
private String |
octaveProgramCmd
The command which determines the octave executable
if
octaveProgramFile is null
and if the property PROPERTY_EXECUTABLE is not set. |
private File |
octaveProgramFile
The file containing the octave program or is
null. |
static String |
PROPERTY_EXECUTABLE
System property where the executable is found.
|
private File |
workingDir
The file representing the working directory or
null. |
| Constructor and Description |
|---|
OctaveEngineFactory()
Default constructor creating a factory with default parameters.
|
| Modifier and Type | Method and Description |
|---|---|
OctaveEngine |
getScriptEngine()
Returns a script engine with the parameters set for this factory.
|
void |
setArgsArray(String[] argsArray)
Sets an array of arguments
argsArray
used when creating an OctaveEngine. |
void |
setEnvironment(String[] environment)
Setter method for
environment. |
void |
setErrorWriter(Writer errWriter)
Setter method for
errWriter. |
void |
setNumThreadsReuse(int numThreadsReuse)
Sets the number of threads to be reused or
-1
which indicates no limit. |
void |
setOctaveInputLog(Writer octaveInputLog)
Setter method for
octaveInputLog. |
void |
setOctaveProgramCmd(String octaveProgramCmd)
Setter method for
octaveProgramCmd. |
void |
setOctaveProgramFile(File octaveProgramFile)
Setter method for
octaveProgramFile. |
void |
setWorkingDir(File workingDir)
Setter method for
workingDir. |
public static final String PROPERTY_EXECUTABLE
private Writer octaveInputLog
null, the octave engine created
writes the output to that log writer also.
By default, this is null.
The according setter method is setOctaveInputLog(Writer).private Writer errWriter
System.err.
The according setter method is setErrorWriter(Writer).private File octaveProgramFile
null.
In the latter case, the name of the octave program command
is determined as described for octaveProgramCmd.
By default, this is null.private String octaveProgramCmd
octaveProgramFile is null
and if the property PROPERTY_EXECUTABLE is not set.
By default, this is "octave".private String[] argsArray
Default value of this field is default value for octave engines created. The default value consists of the following components:
--silent:
prevents octave from printing the usual greeting and version message
at startup.
--no-init-file, --no-site-file
prevents octave from reading the initialization files
~/.octaverc, .octaverc and
site-wide octaverc.
--silent:
If not set this, octave's greeting message causes an exception.
Option --no-init-file makes the result independent
of user input,
whereas --no-init-file and --no-site-file
makes it independent of initialization files.
Since this is used to create scripting engines,
line editing and history seem superfluous
and so --no-line-editing and --no-history
seem appropriate.
Note that --no-init-file and --no-site-file
may be appropriate or not.
***** why not needed --no-gui? --no-window-systemprivate String[] environment
name=value
representing the environment, i.e. the set of environment variables
or null.
In the latter case,
the environment is inherited from the current process.
This field is initialized with null.private File workingDir
null.
In the latter case,
the working directory is inherited from the current process.
By default, this is null.private int numThreadsReuse
-1 if there is no limit.
By default, this is 2.public OctaveEngineFactory()
public OctaveEngine getScriptEngine()
public void setOctaveInputLog(Writer octaveInputLog)
octaveInputLog.octaveInputLog - the octaveInputLog to setpublic void setErrorWriter(Writer errWriter)
errWriter.errWriter - the errWriter to setpublic void setOctaveProgramFile(File octaveProgramFile)
octaveProgramFile.octaveProgramFile - the octaveProgramFile to set or null.public void setOctaveProgramCmd(String octaveProgramCmd)
octaveProgramCmd.
This takes effect only,
if octaveProgramFile is null
and if the property PROPERTY_EXECUTABLE is not set.octaveProgramCmd - the octave program executable to setpublic void setArgsArray(String[] argsArray)
argsArray
used when creating an OctaveEngine.
The validity of the argument string is not proved.
Note that subsequent changes on the array argsArray
do not have any influence on this factory.
The default options
and a discussion of necessary options are
documented with argsArray.argsArray - the arguments as an array to setpublic void setEnvironment(String[] environment)
environment.
Note that subsequent changes on the array environment
do not have any influence on this factory.
The details are documented with environment.environment - the environment or null.public void setWorkingDir(File workingDir)
workingDir.workingDir - the workingDir to set or null.public void setNumThreadsReuse(int numThreadsReuse)
-1
which indicates no limit.
The default value is 2 but this can be speed optimized
depending on the hardware.
The number of threads to be created shall be positive
or -1 otherwise throwing an exception.Copyright © 2006–2018 Simuline Organization (l2r). All rights reserved.