SORTIE Java Interface  1
Public Member Functions | Private Attributes | List of all members
sortie.parfile.Interface Class Reference

Interface between the Java GUI and the C++ application core. More...

Public Member Functions

void pause () throws ModelException
 Pauses the run by sending a "pause" command to the process. More...
 
void stop () throws ModelException
 Stops the currently executing process. More...
 
void run (final MainWindow oWindow, final String sFileName, final int iNumStepsToRun)
 Runs the model. More...
 
String getMessage ()
 Gets any message waiting in the queue from the model run. More...
 
boolean isDone ()
 Gets whether or not the currently executing model run is finished. More...
 
boolean isPaused ()
 Gets whether or not there is a current run that is paused. More...
 
void killProcess ()
 Hard-kills any currently running model process. More...
 
boolean isOK ()
 Gets whether or not the last executed model run finished without errors. More...
 

Private Attributes

Process m_oProcess = null
 Currently running C++ process, or null if none is running. More...
 
String m_sMessage
 Messages received from the C++ program are stored here. More...
 
boolean m_bIsDone = false
 Whether or not the program is finished running. More...
 
boolean m_bIsOK = false
 Whether or not the last completed run went OK. More...
 
boolean m_bIsPaused = false
 Whether or not the run is paused. More...
 

Detailed Description

Interface between the Java GUI and the C++ application core.

Copyright: Copyright (c) Charles D. Canham 2003

Company: Cary Institute of Ecosystem Studies

Author
Lora E. Murphy
Version
1.0


Edit history:
---------------—
April 28, 2004: Submitted in beta version (LEM)
November 8, 2004: Put in pause and stop buttons (LEM)
February 20, 2008: Made it so that any existing pause and stop messages were cleaned out at the beginning of a new run (LEM)

Member Function Documentation

◆ getMessage()

String sortie.parfile.Interface.getMessage ( )

Gets any message waiting in the queue from the model run.

This will erase the message after sending it to ensure that messages can be uniquely identified.

Returns
String The last message sent from the C++ program.

◆ isDone()

boolean sortie.parfile.Interface.isDone ( )

Gets whether or not the currently executing model run is finished.

Returns
boolean True if complete, false if still executing.

◆ isOK()

boolean sortie.parfile.Interface.isOK ( )

Gets whether or not the last executed model run finished without errors.

Returns
boolean True if it finished without errors, false otherwise.

◆ isPaused()

boolean sortie.parfile.Interface.isPaused ( )

Gets whether or not there is a current run that is paused.

Returns
boolean True if there is a paused in-progress run, false otherwise.

◆ killProcess()

void sortie.parfile.Interface.killProcess ( )

Hard-kills any currently running model process.

◆ pause()

void sortie.parfile.Interface.pause ( ) throws ModelException

Pauses the run by sending a "pause" command to the process.

Exceptions
ModelExceptionif the process could not be written to.

◆ run()

void sortie.parfile.Interface.run ( final MainWindow  oWindow,
final String  sFileName,
final int  iNumStepsToRun 
)

Runs the model.

This launches the executable and passes in the user's chosen file. This function will display any errors that occurred.

Parameters
oWindowMainWindow, for displaying messages.
sFileNameString Filename to run.
iNumStepsToRunNumber of timesteps to run. Set to 0 if the model is to run to conclusion.

◆ stop()

void sortie.parfile.Interface.stop ( ) throws ModelException

Stops the currently executing process.

If the run is currently paused, the command "quit" will be sent to the process's stdin stream. If the run is currently running, the messages file will be created with a "q" in the first position.

Exceptions
ModelExceptionif there are problems writing to the file or to the process.

Member Data Documentation

◆ m_bIsDone

boolean sortie.parfile.Interface.m_bIsDone = false
private

Whether or not the program is finished running.

◆ m_bIsOK

boolean sortie.parfile.Interface.m_bIsOK = false
private

Whether or not the last completed run went OK.

◆ m_bIsPaused

boolean sortie.parfile.Interface.m_bIsPaused = false
private

Whether or not the run is paused.

◆ m_oProcess

Process sortie.parfile.Interface.m_oProcess = null
private

Currently running C++ process, or null if none is running.

◆ m_sMessage

String sortie.parfile.Interface.m_sMessage
private

Messages received from the C++ program are stored here.


The documentation for this class was generated from the following file: