Package ptolemy.actor

Class DoNothingDirector

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

    public class DoNothingDirector
    extends Director
    A director that does nothing, for use in models that have no useful execution.

    This director is added to models for code generation purposes when the model has no useful execution but the code generator runs CompositeActor.preinitialize().

    If this director is used in a model, then adding a _hide attribute to the director will make the director invisible to the user.

    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (eal)
    • Method Detail

      • fire

        public void fire()
        Description copied from class: Director
        Iterate all the deeply contained actors of the container of this director exactly once. This method is not functional, since an iteration of the deeply contained actors may change state in their postfire() method. The actors are iterated in the order that they appear on the list returned by deepEntityList(), which is normally the order in which they were created.

        This method is not synchronized on the workspace, so the caller should be.

        In this base class, an attempt is made to fire each actor exactly once, in the order they were created. Prefire is called once, and if prefire returns true, then fire is called once, followed by postfire. The return value from postfire is ignored. If the container is not an instance of CompositeActor, however, then this method does nothing.

        Specified by:
        fire in interface Executable
        Overrides:
        fire in class Director
      • initialize

        public void initialize()
        Description copied from class: Director
        Initialize the model controlled by this director. Set the current time to the start time or the current time of the executive director, and then invoke the initialize() method of this director on each actor that is controlled by this director. If the container is not an instance of CompositeActor, do nothing. This method should typically be invoked once per execution, after the preinitialization phase, but before any iteration. It may be invoked in the middle of an execution, if reinitialization is desired. Since type resolution has been completed and the current time is set, the initialize() method of a contained actor may produce output or schedule events. If stop() is called during this methods execution, then stop initializing actors immediately. This method is not synchronized on the workspace, so the caller should be.
        Specified by:
        initialize in interface Initializable
        Overrides:
        initialize in class Director
      • postfire

        public boolean postfire()
        Description copied from class: Director
        Return true if the director wishes to be scheduled for another iteration. This method is called by the container of this director to see whether the director wishes to execute anymore. It should not, in general, call postfire() on the contained actors.

        In this base class, return the false if stop() has been called since preinitialize(), and true otherwise. Derived classes that override this method need to respect this semantics. The protected variable _stopRequested indicates whether stop() has been called.

        Specified by:
        postfire in interface Executable
        Overrides:
        postfire in class Director
        Returns:
        True to continue execution, and false otherwise.
      • prefire

        public boolean prefire()
        Description copied from class: Director
        Return true if the director is ready to fire. This method is called by the container of this director to determine whether the director is ready to execute. It does not call prefire() on the contained actors. If this director is not at the top level of the hierarchy, then this base class synchronizes to environment time, making any necessary adjustments for drift or offset of the local clock.

        In this base class, assume that the director is always ready to be fired, and so return true. Domain directors should probably override this method to provide domain-specific behavior. However, they should call super.prefire() if they wish to propagate time as done here.

        Specified by:
        prefire in interface Executable
        Overrides:
        prefire in class Director
        Returns:
        True.
      • preinitialize

        public void preinitialize()
        Description copied from class: Director
        Validate the attributes and then invoke the preinitialize() methods of all its deeply contained actors. This method is invoked once per execution, before any iteration, and before the initialize() method. Time is not set during this stage. So preinitialize() method of actors should not make use of time. They should wait until the initialize phase of the execution.

        This method also resets the protected variable _stopRequested to false, so if a derived class overrides this method, then it should also do that.

        This method is not synchronized on the workspace, so the caller should be.

        Specified by:
        preinitialize in interface Initializable
        Overrides:
        preinitialize in class Director
      • transferInputs

        public boolean transferInputs​(IOPort port)
        Description copied from class: Director
        Transfer data from an input port of the container to the ports it is connected to on the inside. The implementation in this base class transfers at most one token. Derived classes may override this method to transfer a domain-specific number of tokens.
        Overrides:
        transferInputs in class Director
        Parameters:
        port - The port to transfer tokens from.
        Returns:
        True if at least one data token is transferred.
      • transferOutputs

        public boolean transferOutputs​(IOPort port)
        Description copied from class: Director
        Transfer data from an output port of the container to the ports it is connected to on the outside. The implementation in this base class transfers at most one token, but derived classes may transfer more than one token.
        Overrides:
        transferOutputs in class Director
        Parameters:
        port - The port to transfer tokens from.
        Returns:
        True if at least one data token is transferred.