ptolemy.copernicus.applet
Class AppletWriter

java.lang.Object
  extended by soot.Transformer
      extended by soot.SceneTransformer
          extended by ptolemy.copernicus.applet.AppletWriter
All Implemented Interfaces:
soot.HasPhaseOptions

public class AppletWriter
extends soot.SceneTransformer
implements soot.HasPhaseOptions

A transformer that writes an applet version of a model. For a model called Foo, we generate Foo/makefile, Foo/Foo.xml, Foo/Foo.htm Foo/FooVergil.htm in the directory named by the outDir parameter.

Potential future enhancements

  • Optionally copy the necessary jar files to the target directory.
  • Pull out the top level annotation and add the text to the web page.
  • Since:
    Ptolemy II 2.0
    Version:
    $Id: AppletWriter.java,v 1.89.4.3 2008/03/25 23:11:46 cxh Exp $
    Author:
    Christopher Hylands
    Accepted Rating:
    Red (cxh)
    Proposed Rating:
    Red (cxh)

    Method Summary
     java.lang.String getDeclaredOptions()
              Return the declared options.
     java.lang.String getDefaultOptions()
              Return the default options.
     java.lang.String getPhaseName()
              Return the phase name.
    protected  void internalTransform(java.lang.String phaseName, java.util.Map options)
              Save the model as an applet.
    static AppletWriter v(CompositeActor model)
              Return an instance of this transformer that will operate on the given model.
     
    Methods inherited from class soot.SceneTransformer
    transform, transform, transform
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Method Detail

    v

    public static AppletWriter v(CompositeActor model)
    Return an instance of this transformer that will operate on the given model. The model is assumed to already have been properly initialized so that resolved types and other static properties of the model can be inspected.

    Parameters:
    model - The model that this class will operate on.
    Returns:
    An instance of the AppletWriter transformer.

    getDefaultOptions

    public java.lang.String getDefaultOptions()
    Return the default options. The default options for this transformer is the string:
      templateDirectory: ptolemy/copernicus/applet/
      

    Specified by:
    getDefaultOptions in interface soot.HasPhaseOptions
    Returns:
    the default options.

    getDeclaredOptions

    public java.lang.String getDeclaredOptions()
    Return the declared options. The declared options for this transformer is the string
      targetPackage modelPath outDir templateDirectory
      

    Specified by:
    getDeclaredOptions in interface soot.HasPhaseOptions
    Returns:
    the declared options.

    getPhaseName

    public java.lang.String getPhaseName()
    Return the phase name. The phase name of this transformer is the empty string.

    Specified by:
    getPhaseName in interface soot.HasPhaseOptions
    Returns:
    the phase name.

    internalTransform

    protected void internalTransform(java.lang.String phaseName,
                                     java.util.Map options)
    Save the model as an applet.

    For example, if the model is called MyModel, and this phase is called with:

            -p wjtp.appletWriter targetPackage:foo.bar
      
    Then we will create the directory $PTII/foo/bar/MyModel and place MyModel.xml, MyModel.htm, MyModelVergil.htm in that directory.

    Specified by:
    internalTransform in class soot.SceneTransformer
    Parameters:
    phaseName - The name of the phase, for example wjtp.appletWriter.
    options - The options Map. This method uses the targetPackage option to specify package to generate code in.