|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.moml.MoMLSimpleApplication
public class MoMLSimpleApplication
A simple application that reads in a .xml file as a command line argument and runs it.
MoMLApplication sets the look and feel, which starts up Swing, so we can't use MoMLApplication for non-graphical simulations.
We implement the ChangeListener interface so that this class will get exceptions thrown by failed change requests. For example to use this class, try:
java -classpath $PTII ptolemy.actor.gui.MoMLSimpleApplication ../../../ptolemy/domains/sdf/demo/OrthogonalCom/OrthogonalCom.xml
Red (eal) |
Red (cxh) |
Field Summary | |
---|---|
protected int |
_activeCount
The count of currently executing runs. |
protected boolean |
_executionFinishedOrError
A flag that indicates if the execution has finished or thrown an error. |
protected Manager |
_manager
The manager of this model. |
protected java.lang.Throwable |
_sawThrowable
The exception seen by executionError(). |
Constructor Summary | |
---|---|
MoMLSimpleApplication()
A Nullary constructor is necessary so that we can extends this base class with a subclass. |
|
MoMLSimpleApplication(java.lang.String xmlFileName)
Parse the xml file and run it. |
Method Summary | |
---|---|
void |
changeExecuted(ChangeRequest change)
React to a change request has been successfully executed by doing nothing. |
void |
changeFailed(ChangeRequest change,
java.lang.Exception exception)
React to a change request that has resulted in an exception. |
void |
executionError(Manager manager,
java.lang.Throwable throwable)
Report an execution failure. |
void |
executionFinished(Manager manager)
Report that the current execution has finished and the wrapup sequence has completed normally. |
static void |
main(java.lang.String[] args)
Create an instance of a single model and run it. |
void |
managerStateChanged(Manager manager)
Report that the manager has changed state. |
void |
rerun()
Execute the same model again. |
void |
waitForFinish()
Wait for all executing runs to finish, then return. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected volatile int _activeCount
protected Manager _manager
protected volatile java.lang.Throwable _sawThrowable
protected volatile boolean _executionFinishedOrError
Constructor Detail |
---|
public MoMLSimpleApplication() throws java.lang.Exception
java.lang.Exception
- Not thrown in this base classpublic MoMLSimpleApplication(java.lang.String xmlFileName) throws java.lang.Throwable
xmlFileName
- A string that refers to an MoML file that
contains a Ptolemy II model. The string should be
a relative pathname.
java.lang.Throwable
- If there was a problem parsing
or running the model.Method Detail |
---|
public void changeExecuted(ChangeRequest change)
changeExecuted
in interface ChangeListener
change
- The change that has been executed, or null if
the change was not done via a ChangeRequest.public void changeFailed(ChangeRequest change, java.lang.Exception exception)
changeFailed
in interface ChangeListener
change
- The change that was attempted or null if
the change was not done via a ChangeRequest.exception
- The exception that resulted.public void executionError(Manager manager, java.lang.Throwable throwable)
executionError
in interface ExecutionListener
manager
- The manager controlling the execution.throwable
- The throwable to report.public void executionFinished(Manager manager)
executionFinished
in interface ExecutionListener
manager
- The manager controlling the execution.public void managerStateChanged(Manager manager)
managerStateChanged
in interface ExecutionListener
manager
- The manager controlling the execution.Manager.getState()
public static void main(java.lang.String[] args)
args
- The command-line arguments naming the .xml file to runpublic void rerun() throws java.lang.Exception
java.lang.Exception
- if there was a problem rerunning the model.public void waitForFinish()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |