Class CatchUpComposite

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

    public class CatchUpComposite
    extends MirrorComposite
    This composite allows events to occur in the inside model between the times when the outside model invokes this composite. The inside model is required to have a director.

    When this composite actor is fired, it fires the inside model to process any unprocessed events it may have at earlier times than the environment time of the firing. If in any of these "catch up" firings the inside model attempts to produce outputs, this director will throw an exception. This director then transfers any available inputs to the inside model and fires the inside model one more time. On this "caught up" firing, the inside model is permitted to produce outputs.

    By default, if an actor contained by this composite requests a firing at a future time, then that request is passed up to the containing director. If fireOnlyWhenTriggered is set to true, however, then such requests are not passed up. In this case, the next firing will occur whenever the container has an input to provide to this composite, and catching up will occur only at that time. Note that if this composite produces outputs, you have to be very careful to ensure that those outputs are produced only at times when an input trigger is provided.

    Note that a firing of this composite results in one or more complete iterations of the inside model, including invocations of postfire. Thus, this actor changes state in the fire() method, and hence only implements the weak actor semantics. Therefore, it should not be used inside domains that require a strict actor semantics, such as Continuous, which requires that fire() not change state (so that backtracking can occur). This composite probably can be used in SR, where it will be treated as a strict as actor and hence will be fired only once per iteration, and only when all inputs are known.

    Since:
    Ptolemy II 11.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (neuendor)
    Pt.ProposedRating:
    Yellow (eal)
    • Constructor Detail

      • CatchUpComposite

        public CatchUpComposite​(CompositeEntity container,
                                java.lang.String name)
                         throws IllegalActionException,
                                NameDuplicationException
        Create an actor with a name and a container. The container argument must not be null, or a NullPointerException will be thrown. This actor will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.
        Parameters:
        container - The container actor.
        name - The name of this actor.
        Throws:
        IllegalActionException - If the container is incompatible with this actor.
        NameDuplicationException - If the name coincides with an actor already in the container.
      • CatchUpComposite

        public CatchUpComposite​(Workspace workspace)
                         throws IllegalActionException,
                                NameDuplicationException
        Construct a CatchUpComposite in the specified workspace with no container and an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace.
        Parameters:
        workspace - The workspace that will list the actor.
        Throws:
        IllegalActionException - If the container is incompatible with this actor.
        NameDuplicationException - If the name of the director coincides with an actor already in the container.
    • Method Detail

      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the object into the specified workspace. This overrides the base class to instantiate a new CatchUpDirector.
        Overrides:
        clone in class ReflectComposite
        Parameters:
        workspace - The workspace for the new object.
        Returns:
        A new NamedObj.
        Throws:
        java.lang.CloneNotSupportedException - If any of the attributes cannot be cloned.
        See Also:
        CompositeEntity.exportMoML(Writer, int, String)
      • fire

        public void fire()
                  throws IllegalActionException
        Fire any piggybacked actors and then delegate the firing to the director. This overrides the base class to not transfer inputs or outputs. Those operations are handled by the director.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class CompositeActor
        Throws:
        IllegalActionException - If there is no director, or if the director's fire() method throws it, or if the actor is not opaque.