ptolemy.domains.fsm.kernel
Class Action

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.kernel.util.AbstractSettableAttribute
              extended by ptolemy.kernel.util.StringAttribute
                  extended by ptolemy.domains.fsm.kernel.Action
All Implemented Interfaces:
java.io.Serializable, 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 0.4
Version:
$Id: Action.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Xiaojun Liu
See Also:
ChoiceAction, CommitAction, Transition, FSMActor, Variable, Serialized Form
Accepted Rating:
Yellow (liuxj)
Proposed Rating:
Yellow (liuxj)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable
Settable.Visibility
 
Field Summary
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.kernel.util.Settable
EXPERT, FULL, NONE, NOT_EDITABLE
 
Constructor Summary
Action(NamedObj container, java.lang.String name)
          Construct an action with the given name contained by the specified container.
Action(Workspace workspace)
          Construct an action in the specified workspace with an empty string as a name.
 
Method Summary
abstract  void execute()
          Execute the action.
 void setContainer(NamedObj container)
          Set the container of this action.
 
Methods inherited from class ptolemy.kernel.util.StringAttribute
_propagateValue, addValueListener, exportMoML, getExpression, getVisibility, removeValueListener, setExpression, setVisibility, validate
 
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute
getDefaultExpression, getValueAsString
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.kernel.util.Settable
getDisplayName
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getFullName, getName, getName, setName
 

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

execute

public abstract void execute()
                      throws IllegalActionException
Execute the action.

Throws:
IllegalActionException - If the action cannot be successfully completed.

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()