Class CompositeExecutionAspect

    • Field Detail

      • justMonitor

        public Parameter justMonitor
        This parameter indicates whether the tokens received via the ImmediateReceivers are immediately forwarded to the wrapped receivers or whether they are delayed by this communication aspect and only forwarded through a CommunicationResponsePort. This parameter is a boolean that defaults to false.
      • _actors

        protected java.util.List<NamedObj> _actors
        Actors decorated by this aspect.
      • _lastActorFinished

        protected boolean _lastActorFinished
        True if in the last request to schedule an actor, this actor finished execution.
      • _executionAspectListeners

        protected java.util.List<ExecutionAspectListener> _executionAspectListeners
        Listeners that want to be informed about execution events.
      • _currentlyExecuting

        protected java.util.List<NamedObj> _currentlyExecuting
        List of currently executing actors.
    • Constructor Detail

      • CompositeExecutionAspect

        public CompositeExecutionAspect​(CompositeEntity container,
                                        java.lang.String name)
                                 throws IllegalActionException,
                                        NameDuplicationException
        Create a new actor in the specified container with the specified name. The name must be unique within the container or an exception is thrown. The container argument must not be null, or a NullPointerException will be thrown.
        Parameters:
        container - The container.
        name - The name of this actor within the container.
        Throws:
        IllegalActionException - If this actor cannot be contained by the proposed container (see the setContainer() method).
        NameDuplicationException - If the name coincides with an entity already in the container.
    • Method Detail

      • createDecoratorAttributes

        public DecoratorAttributes createDecoratorAttributes​(NamedObj target)
        Return the decorated attributes for the target NamedObj. If the specified target is not an Actor, return null.
        Specified by:
        createDecoratorAttributes in interface Decorator
        Parameters:
        target - The NamedObj that will be decorated.
        Returns:
        The decorated attributes for the target NamedObj, or null if the specified target is not an Actor.
      • decoratedObjects

        public java.util.List<NamedObj> decoratedObjects()
        Return a list of the entities deeply contained by the container of this ExecutionAspect.
        Specified by:
        decoratedObjects in interface Decorator
        Returns:
        A list of the objects decorated by this decorator.
      • getExecutionTime

        public double getExecutionTime​(NamedObj actor)
                                throws IllegalActionException
        Get the execution time of an actor. If the actor does not have an attribute specifying the execution time, return the minimum execution time.
        Specified by:
        getExecutionTime in interface ActorExecutionAspect
        Parameters:
        actor - The actor.
        Returns:
        The execution time.
        Throws:
        IllegalActionException - Thrown in attribute or token cannot be read.
      • isGlobalDecorator

        public boolean isGlobalDecorator()
        Return true to indicate that this decorator should decorate objects across opaque hierarchy boundaries.
        Specified by:
        isGlobalDecorator in interface Decorator
        Returns:
        True if decorator is global.
      • isWaitingForResource

        public boolean isWaitingForResource​(Actor actor)
        Check whether the execution of an actor is handled by this aspect actor.
        Specified by:
        isWaitingForResource in interface ActorExecutionAspect
        Parameters:
        actor - The actor.
        Returns:
        True, if the actor execution is handled by this aspect actor.
      • lastScheduledActorFinished

        public boolean lastScheduledActorFinished()
        If the last actor that was scheduled finished execution then this method returns true.
        Specified by:
        lastScheduledActorFinished in interface ActorExecutionAspect
        Returns:
        True if last actor that was scheduled finished execution.
      • postfire

        public boolean postfire()
                         throws IllegalActionException
        Iterate through resource mapping output ports and if they contain tokens, inform the director of the actors in the tokens that these actors can resume execution.
        Specified by:
        postfire in interface Executable
        Overrides:
        postfire in class CompositeActor
        Returns:
        True if the execution can continue into the next iteration.
        Throws:
        IllegalActionException - Not explicitly thrown here.
      • schedule

        public Time schedule​(Time environmentTime)
                      throws IllegalActionException
        Perform rescheduling actions when no new actor requests to be scheduled.
        Specified by:
        schedule in interface ActorExecutionAspect
        Parameters:
        environmentTime - The outside time.
        Returns:
        Relative time when this aspect has to be executed again to perform rescheduling actions.
        Throws:
        IllegalActionException - Thrown in subclasses.
      • schedule

        public Time schedule​(NamedObj actor,
                             Time currentPlatformTime,
                             Time deadline,
                             Time executionTime)
                      throws IllegalActionException
        Schedule a new actor for execution. Find the const actor in the _model that is mapped to this actor and trigger a firing of that one, if the actor is not already in execution. If the actor finished execution, return zero time, otherwise return the next time the model has something to do.
        Specified by:
        schedule in interface ActorExecutionAspect
        Parameters:
        actor - The actor to be scheduled.
        currentPlatformTime - The current platform time.
        deadline - The deadline of the event.
        executionTime - The execution time of the actor.
        Returns:
        Relative time when this aspect has to be executed again.
        Throws:
        IllegalActionException - Thrown if actor parameters such as execution time or priority cannot be read.
      • setRequestPort

        public void setRequestPort​(NamedObj actor,
                                   java.lang.String portName)
        Set the name of the port that will receive scheduling requests for the actor.
        Parameters:
        actor - The actor.
        portName - The request port.