.. java:import:: java.io File .. java:import:: java.io IOException .. java:import:: java.io InputStream .. java:import:: java.io OutputStream .. java:import:: java.lang.reflect Field .. java:import:: java.util.regex Matcher .. java:import:: java.util.regex Pattern .. java:import:: com.sun.jna Library .. java:import:: com.sun.jna Native AMPLProcess =========== .. java:package:: com.ampl :noindex: .. java:type:: class AMPLProcess An AMPL process. Fields ------ _buffer ^^^^^^^ .. java:field:: byte[] _buffer :outertype: AMPLProcess _messageLength ^^^^^^^^^^^^^^ .. java:field:: int _messageLength :outertype: AMPLProcess amplProcess ^^^^^^^^^^^ .. java:field:: protected Process amplProcess :outertype: AMPLProcess amplexecutable ^^^^^^^^^^^^^^ .. java:field:: File amplexecutable :outertype: AMPLProcess engine ^^^^^^ .. java:field:: Engine engine :outertype: AMPLProcess env ^^^ .. java:field:: Environment env :outertype: AMPLProcess interpreter ^^^^^^^^^^^ .. java:field:: volatile AMPLOutputInterpreter interpreter :outertype: AMPLProcess interpreterThread ^^^^^^^^^^^^^^^^^ .. java:field:: Thread interpreterThread :outertype: AMPLProcess isSolving ^^^^^^^^^ .. java:field:: volatile boolean isSolving :outertype: AMPLProcess isStarted ^^^^^^^^^ .. java:field:: boolean isStarted :outertype: AMPLProcess isStopping ^^^^^^^^^^ .. java:field:: protected Boolean isStopping :outertype: AMPLProcess isTerminateAllowed ^^^^^^^^^^^^^^^^^^ .. java:field:: protected Boolean isTerminateAllowed :outertype: AMPLProcess pInput ^^^^^^ .. java:field:: protected OutputStream pInput :outertype: AMPLProcess pOutput ^^^^^^^ .. java:field:: protected InputStream pOutput :outertype: AMPLProcess pb ^^ .. java:field:: protected ProcessBuilder pb :outertype: AMPLProcess startingFlag ^^^^^^^^^^^^ .. java:field:: boolean startingFlag :outertype: AMPLProcess version ^^^^^^^ .. java:field:: protected int version :outertype: AMPLProcess Constructors ------------ AMPLProcess ^^^^^^^^^^^ .. java:constructor:: protected AMPLProcess(Environment env, Engine engine) :outertype: AMPLProcess Methods ------- canInterrupt ^^^^^^^^^^^^ .. java:method:: public boolean canInterrupt() :outertype: AMPLProcess close ^^^^^ .. java:method:: public void close() :outertype: AMPLProcess Stops the process. create ^^^^^^ .. java:method:: public static AMPLProcess create(Environment env, Engine engine) throws IOException :outertype: AMPLProcess Starts an AMPL process (class factory, generates process which is platform dependent) createProcessBuilder ^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected ProcessBuilder createProcessBuilder() :outertype: AMPLProcess getAMPLVersion ^^^^^^^^^^^^^^ .. java:method:: int getAMPLVersion() throws IOException, ReadException :outertype: AMPLProcess Returns the ampl version as an integer, getting it from the underlying AMPL interpreter :param amplPath: Path to ampl executable :param env: Environment :throws ReadException: :throws IOException: :return: AMPL version. If OptiRisk AMPL, the returned integer is negative. So (version <0) returns true if it is an OptiRisk AMPL (it embeds AMPLSIG in windows versions) and abs(version) returns the actual version number getVersion ^^^^^^^^^^ .. java:method:: int getVersion() :outertype: AMPLProcess Get stored AMPL version getWorkingDir ^^^^^^^^^^^^^ .. java:method:: public String getWorkingDir() :outertype: AMPLProcess interpretAndReturn ^^^^^^^^^^^^^^^^^^ .. java:method:: void interpretAndReturn(String s, OutputHandler output) throws ReadException, IOException :outertype: AMPLProcess interpretAndReturn ^^^^^^^^^^^^^^^^^^ .. java:method:: AMPLOutputs interpretAndReturn(String s) throws ReadException, IOException :outertype: AMPLProcess interpretAsync ^^^^^^^^^^^^^^ .. java:method:: void interpretAsync(String s, Runnable over, OutputHandler output) :outertype: AMPLProcess interrupt ^^^^^^^^^ .. java:method:: public void interrupt() :outertype: AMPLProcess isBusy ^^^^^^ .. java:method:: public boolean isBusy() :outertype: AMPLProcess Returns true if the engine is busy in an async operation isProcessRunning ^^^^^^^^^^^^^^^^ .. java:method:: public Boolean isProcessRunning() :outertype: AMPLProcess isStarted ^^^^^^^^^ .. java:method:: public boolean isStarted() :outertype: AMPLProcess onBeginSolve ^^^^^^^^^^^^ .. java:method:: public void onBeginSolve() :outertype: AMPLProcess onInterrupt ^^^^^^^^^^^ .. java:method:: protected void onInterrupt() :outertype: AMPLProcess When the underlying process is interrupted, need to wait for the reader thread to finish or else we end up with a dirty buffer setWorkingDir ^^^^^^^^^^^^^ .. java:method:: public void setWorkingDir(String workingdir) :outertype: AMPLProcess start ^^^^^ .. java:method:: public void start() throws IOException :outertype: AMPLProcess Starts the underlying process