Class ProcessDirector

  • All Implemented Interfaces:
    java.lang.Cloneable, Executable, Initializable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class ProcessDirector
    extends SequencedModelDirector
    The ProcessDirector implements a sequencing model of computation plus process names. The order of execution is given by adding ProcessAttributes to actors in the model. A ProcessAttribute is a tuple (string processName, int sequenceNumber) Please see SequencedModelDirector for more details on how the schedule is computed.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Elizabeth Latronico (Bosch)
    Pt.AcceptedRating:
    Red (beth)
    Pt.ProposedRating:
    Red (beth)
    • Field Detail

      • defaultProcessExecutionArray

        public Parameter defaultProcessExecutionArray
        Parameter that contains the default list of processes to run.
      • _processSeqMap

        protected MultiHashMap _processSeqMap
        The hashMap for Process and corresponding sequence numbers.
    • Constructor Detail

      • ProcessDirector

        public ProcessDirector()
                        throws IllegalActionException,
                               NameDuplicationException
        Construct a director in the default workspace with an empty string as its name. The director is added to the list of objects in the workspace. Increment the version number of the workspace. The ProcessDirector will have a default scheduler of type SequenceScheduler.
        Throws:
        IllegalActionException - If the name has a period in it, or the director is not compatible with the specified container.
        NameDuplicationException - If the container already contains an entity with the specified name.
      • ProcessDirector

        public ProcessDirector​(Workspace workspace)
                        throws IllegalActionException,
                               NameDuplicationException
        Construct a director in the workspace with an empty name. The director is added to the list of objects in the workspace. Increment the version number of the workspace. The ProcessDirector will have a default scheduler of type SequenceScheduler.
        Parameters:
        workspace - The workspace for this object.
        Throws:
        IllegalActionException - If the name has a period in it, or the director is not compatible with the specified container.
        NameDuplicationException - If the container already contains an entity with the specified name.
      • ProcessDirector

        public ProcessDirector​(CompositeEntity container,
                               java.lang.String name)
                        throws IllegalActionException,
                               NameDuplicationException
        Construct a director in the given container with the given name. The container argument must not be null, or a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string. Increment the version number of the workspace. The ProcessDirector will have a default scheduler of type SequenceScheduler.
        Parameters:
        container - Container of the director.
        name - Name of this director.
        Throws:
        IllegalActionException - If the director is not compatible with the specified container. May be thrown in a derived class.
        NameDuplicationException - If the container is not a CompositeActor and the name collides with an entity in the container.
    • Method Detail

      • clearProcessExecutionArray

        public void clearProcessExecutionArray()
        Clear the process execution array so that the default process execution will run.
      • fire

        public void fire()
                  throws IllegalActionException
        Get a firingIterator for each process and execute the model. Currently, the processes are sorted alphabetically; however, they could be sorted differently in the future. Also, the processes could "pre-empt" each other, by using the appropriate firingIterator. I.e. it isn't necessary to fire everything from start to finish for one firingIterator before choosing a different one. Iterating an actor involves calling the actor's iterate() method, which is equivalent to calling the actor's prefire(), fire() and postfire() methods in succession. If iterate() returns NOT_READY, indicating that the actor is not ready to execute, then an IllegalActionException will be thrown. The values returned from iterate() are recorded and are used to determine the value that postfire() will return at the end of the director's iteration.

        This method may be overridden by some domains to perform additional domain-specific operations.

        Specified by:
        fire in interface Executable
        Overrides:
        fire in class Director
        Throws:
        IllegalActionException - If any actor executed by this actor return false in prefire.
        InvalidStateException - If this director does not have a container.
      • preinitialize

        public void preinitialize()
                           throws IllegalActionException
        Preinitialize the actors associated with this director and compute the schedule. The schedule is computed during preinitialization so that hierarchical opaque composite actors can be scheduled properly. In addition, performing scheduling during preinitialization enables it to be present during code generation. The order in which the actors are preinitialized is arbitrary.
        Specified by:
        preinitialize in interface Initializable
        Overrides:
        preinitialize in class SequencedModelDirector
        Throws:
        IllegalActionException - If the preinitialize() method of one of the associated actors throws it.
      • setProcessExecutionArray

        public void setProcessExecutionArray​(java.lang.String[] processArray)
        Set the process execution order by providing an array of process names.
        Parameters:
        processArray - The array of process names to be executed in the order they are specified in the array.
      • _getDefaultProcessExecutionArray

        protected java.lang.String[] _getDefaultProcessExecutionArray()
                                                               throws IllegalActionException
        Return the default process execution array specified by the defaultProcessExecutionArray parameter.
        Returns:
        The string array of process names to be executed.
        Throws:
        IllegalActionException - If there is a problem getting the array token from the parameter.