Class PthalesDynamicCompositeActor

    • Constructor Detail

      • PthalesDynamicCompositeActor

        public PthalesDynamicCompositeActor()
                                     throws NameDuplicationException,
                                            IllegalActionException
        Construct a PthalesDynamicCompositeActor in the default workspace with no container and an empty string as its name. Add the actor to the workspace directory. You should set the local director or executive director before attempting to send data to the actor or to execute it. Increment the version number of the workspace.
        Throws:
        IllegalActionException - If the actor cannot be contained by the proposed container.
        NameDuplicationException - If the container already has an actor with this name.
      • PthalesDynamicCompositeActor

        public PthalesDynamicCompositeActor​(CompositeEntity container,
                                            java.lang.String name)
                                     throws IllegalActionException,
                                            NameDuplicationException
        Construct a PthalesDynamicCompositeActor 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. This actor will have no local director initially, and its executive director will be simply the director of the container.
        Parameters:
        container - The container.
        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.
      • PthalesDynamicCompositeActor

        public PthalesDynamicCompositeActor​(Workspace workspace)
                                     throws NameDuplicationException,
                                            IllegalActionException
        Construct a PthalesDynamicCompositeActor 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. You should set the local director or executive director before attempting to send data to the actor or to execute it. Add the actor to the workspace directory. Increment the version number of the workspace.
        Parameters:
        workspace - The workspace that will list the actor.
        Throws:
        IllegalActionException - If the actor cannot be contained by the proposed container.
        NameDuplicationException - If the container already has an actor with this name.
    • Method Detail

      • computeIterations

        public int computeIterations()
                              throws IllegalActionException
        Compute the number of iterations of the actor based on multiple input ports. The iterations is the minimum of legal iterations from the ports.
        Returns:
        The number of iterations of the actor.
        Throws:
        IllegalActionException - If thrown while reading a port
      • iterate

        public int iterate​(int count)
                    throws IllegalActionException
        Invoke a specified number of iterations of the actor. An iteration is equivalent to invoking prefire(), fire(), and postfire(), in that order. In an iteration, if prefire() returns true, then fire() will be called once, followed by postfire(). Otherwise, if prefire() returns false, fire() and postfire() are not invoked, and this method returns NOT_READY. If postfire() returns false, then no more iterations are invoked, and this method returns STOP_ITERATING. Otherwise, it returns COMPLETED. If stop() is called during this iteration, then cease iterating and return STOP_ITERATING.

        This base class method actually invokes prefire(), fire(), and postfire(), as described above, but a derived class may override the method to execute more efficient code.

        Specified by:
        iterate in interface Executable
        Overrides:
        iterate in class CompositeActor
        Parameters:
        count - The number of iterations to perform.
        Returns:
        NOT_READY, STOP_ITERATING, or COMPLETED.
        Throws:
        IllegalActionException - If iterating is not permitted, or if prefire(), fire(), or postfire() throw it.
      • prefire

        public boolean prefire()
                        throws IllegalActionException
        If this actor is opaque, invoke the prefire() method of the local director. This method returns true if the actor is ready to fire (determined by the prefire() method of the director). It is read-synchronized on the workspace.
        Specified by:
        prefire in interface Executable
        Overrides:
        prefire in class CompositeActor
        Returns:
        True if the iteration can proceed.
        Throws:
        IllegalActionException - If there is no director, or if the director's prefire() method throws it, or if this actor is not opaque.