Class CompositeActorApplication


  • public class CompositeActorApplication
    extends CompositeActorSimpleApplication
    This application creates one or more Ptolemy II models given a classname on the command line, and then executes those models, each in its own thread. Each specified class should be derived from CompositeActor, and should have a constructor that takes a single argument, an instance of Workspace. If the model does not contain a manager, then one will be created for it. The model is displayed using an instance of ModelFrame, which provides controls for executing the model and setting its top-level and director parameters.

    The command-line arguments can also set parameter values for any parameter in the models, with the name given relative to the top-level entity. For example, to specify the iteration count in an SDF model, you can invoke this on the command line as follows:

     java -classpath $PTII ptolemy.actor.gui.CompositeActorApplication \
     -director.iterations 1000 \
     -class ptolemy.domains.sdf.demo.Butterfly.Butterfly
     
    This assumes that the model given by the specified class name has a director named "director" with a parameter named "iterations". If more than one model is given on the command line, then the parameter values will be set for all models that have such a parameter.

    This class keeps count the number of open windows. The waitForFinish method can then be used to determine when all of the windows opened by this class have been closed. The main() method exits the application when all windows have been closed.

    Since:
    Ptolemy II 0.4
    Version:
    $Id$
    Author:
    Edward A. Lee, Brian K. Vogel, and Steve Neuendorffer
    See Also:
    ModelFrame
    Pt.AcceptedRating:
    Red (vogel)
    Pt.ProposedRating:
    Yellow (cxh)
    • Constructor Detail

      • CompositeActorApplication

        public CompositeActorApplication()
    • Method Detail

      • close

        public void close()
        Close any ModeFrames opened in processArgs().
      • main

        public static void main​(java.lang.String[] args)
        Create a new application with the specified command-line arguments.
        Parameters:
        args - The command-line arguments.
      • processArgs

        public void processArgs​(java.lang.String[] args)
                         throws java.lang.Exception
        Parse the command-line arguments, creating models as specified.
        Overrides:
        processArgs in class CompositeActorSimpleApplication
        Parameters:
        args - The command-line arguments.
        Throws:
        java.lang.Exception - If something goes wrong.
      • startRun

        public java.lang.Object startRun​(CompositeActor model)
        If the specified model has a manager and is not already running, then execute the model in a new thread. Otherwise, do nothing. If the model contains an atomic entity that implements Placeable, we create create an instance of ModelFrame, if nothing implements Placeable, then we do not create an instance of ModelFrame. This allows us to run non-graphical models on systems that do not have a display.

        We then start the model running.

        Overrides:
        startRun in class CompositeActorSimpleApplication
        Parameters:
        model - The model to execute.
        Returns:
        The ModelFrame that for the model.
        See Also:
        Manager.startRun()