ptolemy.copernicus.java
Class TestApplication

java.lang.Object
  extended by ptolemy.copernicus.java.TestApplication
All Implemented Interfaces:
ChangeListener

public class TestApplication
extends java.lang.Object
implements ChangeListener

A simple application that reads in a .xml file as a command line argument and runs it. This is similar to MoMLSimpleApplication, but forces the number of iterations to be 100000. This makes for good comparison with generated code since it reduces the relative affect of initialization differences between Ptolemy II and the generated code.

Since:
Ptolemy II 2.0
Version:
$Id: TestApplication.java,v 1.40 2007/12/06 18:28:54 cxh Exp $
Author:
Christopher Hylands
Accepted Rating:
Red (eal)
Proposed Rating:
Red (cxh)

Field Summary
protected static long _parseStartTime
          The time that creating the model started
 
Constructor Summary
TestApplication(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.
static void main(java.lang.String[] args)
          Create an instance of a single model and run it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_parseStartTime

protected static long _parseStartTime
The time that creating the model started

Constructor Detail

TestApplication

public TestApplication(java.lang.String xmlFilename)
                throws java.lang.Exception
Parse the xml file and run it. If a parameter named "copernicus_iterations" is present, then the value of that parameter is used to set the iterations parameter. If there is no "copernicus_iterations" parameter, then then the number of iterations is set to 100000.

Throws:
java.lang.Exception
Method Detail

changeExecuted

public void changeExecuted(ChangeRequest change)
React to a change request has been successfully executed by doing nothing. This method is called after a change request has been executed successfully. In this class, we do nothing.

Specified by:
changeExecuted in interface ChangeListener
Parameters:
change - The change that has been executed, or null if the change was not done via a ChangeRequest.

changeFailed

public void changeFailed(ChangeRequest change,
                         java.lang.Exception exception)
React to a change request that has resulted in an exception. This method is called after a change request was executed, but during the execution in an exception was thrown. This method throws a runtime exception with a description of the original exception.

Specified by:
changeFailed in interface ChangeListener
Parameters:
change - The change that was attempted or null if the change was not done via a ChangeRequest.
exception - The exception that resulted.

main

public static void main(java.lang.String[] args)
Create an instance of a single model and run it

Parameters:
args - The command-line arguments naming the .xml file to run