|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlp.wrap.SmodelsWrapper
public class SmodelsWrapper
A class responsible for executing smodels with the given command line
arguments.
Smodels can be executed by calling the exec()
method. This method
can be called multiple times and each time the current model limit is passed
to the smodels binary.
Field Summary | |
---|---|
private int |
modelLimit
Maximum number of stable models that should be computed by smodels. |
private Process |
process
The smodels process. |
private String |
smodelsPath
The path to the smodels binary. |
private static WrapperUtils |
WU
The singleton WrapperUtils instance used in the implementation. |
Constructor Summary | |
---|---|
SmodelsWrapper()
Creates a new instance of SmodelsWrapper . |
Method Summary | |
---|---|
void |
closeStdin()
Closes the standard output stream of the currently executed smodels process. |
void |
exec()
Executes smodels and passes the current command line options (see setModelLimit(int) ) to it. |
OutputStream |
getStdin()
Returns the standard input stream of the currently executed smodels process. |
InputStream |
getStdout()
Returns the standard output stream of the currently executed smodels process. |
SmodelsWrapper |
setModelLimit(int modelLimit)
Sets the maximum number of stable models that should be computed by smodels. |
void |
setSmodelsPath(String smodelsPath)
Sets the path to smodels binary that is used to invoke smodels. |
int |
waitFor()
Waits for the currently executed smodels process to finish computation and returns its exit value (see Process.waitFor() ). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final WrapperUtils WU
WrapperUtils
instance used in the implementation.
private String smodelsPath
private int modelLimit
private Process process
Constructor Detail |
---|
public SmodelsWrapper()
SmodelsWrapper
.
Initially the path to the smodels binary is set to "smodels", i.e. it is
assumed that smodels can be executed by issuing the "smodels" command on
the command line of the native operating system. This setting can be
changed by calling the setSmodelsPath(String)
method.
The model limit is set to 0, i.e. all stable models will be computed.
This setting can be changed by calling the setModelLimit(int)
method.
Method Detail |
---|
public void setSmodelsPath(String smodelsPath)
smodelsPath
- path to the smodels binary
IllegalArgumentException
- if smodelsPath
is null
or an empty stringpublic SmodelsWrapper setModelLimit(int modelLimit)
modelLimit
- the maximum number of stable models that should be
computed by smodels.
SmodelsWrapper
IllegalArgumentException
- if modelLimit
is negativepublic void exec()
setModelLimit(int)
) to it.
WrapperException
- if an IOException
occurs while
creating the processpublic OutputStream getStdin()
public void closeStdin()
WrapperException
- if an I/O error occurs while closing the
standard input stream of the smodels processpublic InputStream getStdout()
public int waitFor()
Process.waitFor()
).
WrapperException
- if an InterruptedException
occurs while
waiting for the error stream thread or smodels process to finish their
tasks
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |