Class Action

  • All Implemented Interfaces:
    java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable
    Direct Known Subclasses:
    AbstractActionsAttribute

    public abstract class Action
    extends StringAttribute
    An Action is contained by a Transition in an FSMActor or an Event in an ERGController.

    When the FSMActor is fired, an enabled transition among the outgoing transitions of the current state is chosen. The choice actions contained by the chosen transition are executed. An action is a choice action if it implements the ChoiceAction marker interface. A choice action may be executed more than once during an iteration in domains with fixed-point semantics.

    When the FSMActor is postfired, the chosen transition of the latest firing of the actor is committed. The commit actions contained by the transition are executed and the current state of the actor is set to the destination state of the transition. An action is a commit action if it implements the CommitAction marker interface.

    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Xiaojun Liu
    See Also:
    ChoiceAction, CommitAction, Transition, FSMActor, Variable
    Pt.AcceptedRating:
    Yellow (liuxj)
    Pt.ProposedRating:
    Yellow (liuxj)
    • Constructor Detail

      • Action

        public Action​(Workspace workspace)
        Construct an action in the specified workspace with an empty string as a name. The object is added to the directory of the workspace. Increment the version number of the workspace.
        Parameters:
        workspace - The workspace that will list the attribute.
      • Action

        public Action​(NamedObj container,
                      java.lang.String name)
               throws IllegalActionException,
                      NameDuplicationException
        Construct an action with the given name contained by the specified container. The container argument must not be null, or a NullPointerException will be thrown. This action 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.
        name - The name of this action.
        Throws:
        IllegalActionException - If the action is not of an acceptable class for the container, or if the name contains a period.
        NameDuplicationException - If the container already has an attribute with the name.
    • Method Detail

      • getDestinations

        public abstract java.util.List getDestinations()
                                                throws IllegalActionException
        Return the list of destinations of assignments in this action.
        Returns:
        A list of IOPort for output actions, and a list of parameters for set actions.
        Throws:
        IllegalActionException - If the destination list cannot be constructed.
      • setContainer

        public void setContainer​(NamedObj container)
                          throws IllegalActionException,
                                 NameDuplicationException
        Set the container of this action. The proposed container must be an instance of Transition or Event or null, otherwise an IllegalActionException will be thrown. A null argument will remove the action from its container.
        Overrides:
        setContainer in class Attribute
        Parameters:
        container - The proposed container.
        Throws:
        IllegalActionException - If setting the container would result in a recursive containment structure, or if this action and container are not in the same workspace, or if the argument is not an instance of Transition or null.
        NameDuplicationException - If the container already has an attribute with the name of this action.
        See Also:
        Attribute.getContainer()