Package ptolemy.domains.ptera.kernel
Class ActionsAttribute
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,HasTypeConstraints
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
,Settable
public class ActionsAttribute extends AbstractActionsAttribute
An attribute associated with Ptera events containing executable actions. The actions are written as assignments separated with semicolons. They can be executed either to change the values of the variables assigned to, or to send output tokens to ports.This class is similar to
CommitActionsAttribute
andOutputActionsAttribute
in FSM. The difference is that in Ptera, no distinction is made between commit actions and output actions. The destination of an assignment can be either a variable or a port. If a port and a variable have the same name in a Ptera model, then assigning to that name causes output to be sent to the port instead of changing the value of the variable.Another difference between this class and those in FSM is that in Ptera, events are allowed to receive parameters. The parameters can be referred to in the actions associated with that event.
- Since:
- Ptolemy II 8.0
- Version:
- $Id$
- Author:
- Thomas Huining Feng
- See Also:
CommitActionsAttribute
- Pt.AcceptedRating:
- Red (tfeng)
- Pt.ProposedRating:
- Yellow (tfeng)
-
-
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.domains.modal.kernel.AbstractActionsAttribute
_destinationNames, _destinations, _destinationsListVersion, _parseTreeEvaluator, _parseTrees
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _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
Constructors Constructor Description ActionsAttribute(Event event, java.lang.String name)
Construct an ActionsAttribute for a Ptera event.ActionsAttribute(Workspace workspace)
Construct an ActionsAttribute in the specified workspace with an empty string as a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected NamedObj
_getDestination(java.lang.String name)
Given a destination name, return a NamedObj that matches that destination.protected ParserScope
_getParserScope()
Return a parser scope used to type-check the actions.void
execute()
Execute this action.-
Methods inherited from class ptolemy.domains.modal.kernel.AbstractActionsAttribute
clone, getChannelNumberList, getDestination, getDestinationNameList, getDestinations, getExpression, getParseTree, getParseTreeList, isChannelSpecified, setExpression, toString, typeConstraints
-
Methods inherited from class ptolemy.domains.modal.kernel.Action
setContainer
-
Methods inherited from class ptolemy.kernel.util.StringAttribute
_propagateValue, addValueListener, exportMoML, getExpression, getVisibility, removeValueListener, setVisibility, validate
-
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute
getDefaultExpression, getValueAsString
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, 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.Nameable
description, getContainer, getFullName, getName, getName, setName
-
Methods inherited from interface ptolemy.kernel.util.Settable
getDisplayName
-
-
-
-
Constructor Detail
-
ActionsAttribute
public ActionsAttribute(Event event, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an ActionsAttribute for a Ptera event.- Parameters:
event
- The event.name
- The name of the attribute.- 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.
-
ActionsAttribute
public ActionsAttribute(Workspace workspace)
Construct an ActionsAttribute in the specified workspace with an empty string as a name. The attribute is added to the directory of the workspace. Increment the version number of the workspace.- Parameters:
workspace
- The workspace that will list the attribute.
-
-
Method Detail
-
execute
public void execute() throws IllegalActionException
Execute this action. For each destination identified in the action, compute the value in the action and perform the particular assignment.- Overrides:
execute
in classAbstractActionsAttribute
- Throws:
IllegalActionException
- If a destination is not found or if thrown while evaluating the expressions.
-
_getDestination
protected NamedObj _getDestination(java.lang.String name) throws IllegalActionException
Given a destination name, return a NamedObj that matches that destination. This method never returns null (throw an exception instead).- Specified by:
_getDestination
in classAbstractActionsAttribute
- Parameters:
name
- The name of the destination, or null if none is found.- Returns:
- An object (like a port or a variable) with the specified name.
- Throws:
IllegalActionException
- If the associated FSMActor does not have a destination with the specified name.
-
_getParserScope
protected ParserScope _getParserScope()
Return a parser scope used to type-check the actions.- Overrides:
_getParserScope
in classAbstractActionsAttribute
- Returns:
- The parser scope.
-
-