ptolemy.domains.fsm.kernel
Class AbstractActionsAttribute

java.lang.Object
  |
  +--ptolemy.kernel.util.NamedObj
        |
        +--ptolemy.kernel.util.Attribute
              |
              +--ptolemy.kernel.util.StringAttribute
                    |
                    +--ptolemy.domains.fsm.kernel.Action
                          |
                          +--ptolemy.domains.fsm.kernel.AbstractActionsAttribute
All Implemented Interfaces:
java.lang.Cloneable, Debuggable, Nameable, java.io.Serializable, Settable
Direct Known Subclasses:
CommitActionsAttribute, OutputActionsAttribute

public abstract class AbstractActionsAttribute
extends Action

A base class for actions with semicolon delimited lists of commands.

The value of this attribute is a semicolon separated list of commands, where each command gives a destination to send data to and a value to send. The actions are given by calling setExpression() with a string of the form:

command; command; ...
where each command has the form:
destination = expression
where destination is either
name
or
name(number)

The expression is a string giving an expression in the usual Ptolemy II expression language. The expression may include references to variables and parameters contained by the FSM actor.

Since:
Ptolemy II 1.0
Version:
$Id: AbstractActionsAttribute.java,v 1.11 2002/02/22 17:27:16 cxh Exp $
Author:
Xiaojun Liu and Edward A. Lee
See Also:
CommitActionsAttribute, Transition, FSMActor, Serialized Form

Inner classes inherited from class ptolemy.kernel.util.NamedObj
NamedObj.MoMLInfo
 
Inner classes inherited from class ptolemy.kernel.util.Settable
Settable.Visibility
 
Field Summary
protected  java.util.List _destinationNames
           
protected  java.util.List _destinations
           
protected  long _destinationsListVersion
           
protected  java.util.List _numbers
           
protected  java.util.List _variables
           
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _debugging, _debugListeners, _uniqueNameIndex, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.kernel.util.Settable
EXPERT, FULL, NONE
 
Constructor Summary
AbstractActionsAttribute(Transition transition, java.lang.String name)
          Construct an action with the given name contained by the specified transition.
 
Method Summary
protected abstract  NamedObj _getDestination(java.lang.String name)
          Given a destination name, return a NamedObj that matches that destination.
 void execute()
          For each destination identified in an action, find the corresponding Ptolemy II object (a variable or a port).
 void setExpression(java.lang.String expression)
          Set the action and notify the container that the action has changed by calling attributeChanged(), and notify any listeners that have been registered using addValueListener().
 
Methods inherited from class ptolemy.domains.fsm.kernel.Action
setContainer
 
Methods inherited from class ptolemy.kernel.util.StringAttribute
addValueListener, exportMoML, getExpression, getVisibility, removeValueListener, setVisibility, validate
 
Methods inherited from class ptolemy.kernel.util.Attribute
clone, getContainer, setName
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _attachText, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _removeAttribute, _splitName, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, deepContains, depthInHierarchy, description, description, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttribute, getAttributes, getFullName, getMoMLInfo, getName, getName, removeChangeListener, removeDebugListener, requestChange, setDeferMoMLDefinitionTo, toplevel, toString, uniqueName, 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, setName
 

Field Detail

_numbers

protected java.util.List _numbers

_destinations

protected java.util.List _destinations

_destinationNames

protected java.util.List _destinationNames

_variables

protected java.util.List _variables

_destinationsListVersion

protected long _destinationsListVersion
Constructor Detail

AbstractActionsAttribute

public AbstractActionsAttribute(Transition transition,
                                java.lang.String name)
                         throws IllegalActionException,
                                NameDuplicationException
Construct an action with the given name contained by the specified transition. The transition argument must not be null, or a NullPointerException will be thrown. This action will use the workspace of the transition for synchronization and version counts. If the name argument is null, then the name is set to the empty string. A variable for expression evaluation is created in the transition. The name of the variable is obtained by prepending an underscore to the name of this action. This increments the version of the workspace.
Parameters:
transition - The transition that contains this action.
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 transition already has an attribute with the name or that obtained by prepending an underscore to the name.
Method Detail

execute

public void execute()
             throws IllegalActionException
For each destination identified in an action, find the corresponding Ptolemy II object (a variable or a port).
Overrides:
execute in class Action
Throws:
IllegalActionException - If a destination is not found.

setExpression

public void setExpression(java.lang.String expression)
                   throws IllegalActionException
Set the action and notify the container that the action has changed by calling attributeChanged(), and notify any listeners that have been registered using addValueListener().
Overrides:
setExpression in class StringAttribute
Parameters:
expression - The action.
Throws:
IllegalActionException - If the change is not acceptable to the container, or if the action is syntactically incorrect.

_getDestination

protected abstract NamedObj _getDestination(java.lang.String name)
                                     throws IllegalActionException
Given a destination name, return a NamedObj that matches that destination. An implementation of this method should never return null (throw an exception instead).
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.