|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jstatcom.engine.gauss.GaussEngine
public final class GaussEngine
Links to an instance of the software package Gauss (www.aptech.com). This object performs the whole communication with Gauss and has control over it, i.e. it starts, commands, and ends Gauss.
This class enforces the Singleton property by a static initializer. Currently it runs only on the Windows OS.
Method Summary | |
---|---|
void |
call(java.lang.String procName,
JSCData[] args,
JSCData[] retData)
Executes a procedure with input and return parameters specified. |
java.lang.String |
compileGCG()
Compiles the source files defined in the XML file for compilation. |
java.lang.String |
createLibs()
Creates the GAUSS libraries defined in the respective XML file |
void |
execute(java.lang.String command)
Executes a GAUSS command. |
static GaussEngine |
getInstance()
Returns an instance of the GaussEngine that is a
Singleton. |
boolean |
isValid(JSCTypes type)
Gets whether type can be handled by this engine. |
void |
load(java.lang.String loadName,
LoadTypes loadType,
JSCData... args)
Loads a module according to the load type. |
void |
read(JSCData[] rtArray)
Reads all variables defined in varNames from GAUSS. |
void |
shutdown()
Terminates this engine and does clean up tasks. |
void |
start(boolean compileIfNecessary)
Starts an instance of GAUSS. |
void |
stop()
Stops a running execution. |
void |
write(JSCData[] engineData)
Write a data array to GAUSS. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public java.lang.String compileGCG()
null
if ok, error string otherwisepublic java.lang.String createLibs()
null
if ok, error string otherwisepublic void execute(java.lang.String command)
System.out
.
command
- string with GAUSS code, for example "y=rndn(100,1)"
java.lang.IllegalArgumentException
- if (command == null)
java.lang.RuntimeException
- if execution of command
failed, use
getMessage
to retrieve the error stringpublic void call(java.lang.String procName, JSCData[] args, JSCData[] retData)
retData
.
Listeners registered to these data objects receive notifications if
something changed.
Please note:
If a data object of type JSCTypes.INT
is specified as
return, then any double scalar will silently be cast to an int. It may
happen that information is lost during that operation.
call
in interface Engine
procName
- procedure name to be executed by this engineargs
- the data to be used as input, can be null
or
emtpy if no arguments neededretData
- the data array to store results can be null
or
emtpy if no returns needed
java.lang.IllegalArgumentException
- if args
or retData
contain
elements that are null
java.lang.RuntimeException
- if return types are not compatible with returnspublic static GaussEngine getInstance()
GaussEngine
that is a
Singleton. Whenever this method is called, the respective system library
is loaded.
java.lang.RuntimeException
- if operating system is not supported or if something went
wrong during the init process
java.lang.UnsatisfiedLinkError
- if system libraries cannot be foundpublic boolean isValid(JSCTypes type)
Engine
type
can be handled by this engine.
isValid
in interface Engine
type
- the data type to be checked
true
if ok, false
if
type
cannot be handled by this engineEngine
public void load(java.lang.String loadName, LoadTypes loadType, JSCData... args)
args
argument is ignored.
load
in interface Engine
loadName
- the name of the module to loadloadType
- the type of module to loadargs
- (optional) module load arguments if needed
java.lang.IllegalArgumentException
- if (loadName == null || loadType == null)
or
if (loadName.length() == 0)
or if
loadName
is not validEngine
public void read(JSCData[] rtArray)
varNames
from GAUSS. The
varTypes
are necessary to enforce type savety.
rtArray
- the data to be read
java.lang.IllegalArgumentException
- if (rtArray == nul)
or if rtArray
contains null
elements
java.lang.RuntimeException
- if the variable could not be read or if an invalid type was
specified or if the read variable does not match with the
respective typepublic void start(boolean compileIfNecessary)
Nothing happens if GAUSS is already running.
compileIfNecessary
- compiles gcg file if it cannot be loaded
java.lang.RuntimeException
- if start failspublic void stop()
Engine
UnsupportedOperationException
.
stop
in interface Engine
Engine
public void shutdown()
Engine
load
or execute
is called afterwards this
engine should be reinitialized.
shutdown
in interface Engine
Engine
public void write(JSCData[] engineData)
start
method is called.
engineData
- the data array to be written to GAUSS
java.lang.IllegalArgumentException
- if one of the data types cannot be handled by the GAUSS
engine or if (engineData == null)
or if one
element of engineData
is null
java.lang.RuntimeException
- if write failed of if GAUSS could not be started if it was
not running beforeEngine
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |