ptolemy.domains.modal.kernel.ia
Class InterfaceAutomatonTransition

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.Relation
          extended by ptolemy.kernel.ComponentRelation
              extended by ptolemy.domains.modal.kernel.Transition
                  extended by ptolemy.domains.modal.kernel.ia.InterfaceAutomatonTransition
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class InterfaceAutomatonTransition
extends Transition

A Transition for Interface Automaton. In the Interface Automata paper written by Luca de Alfaro and Henzinger, transitions are called actions. However, the name action conflicts with the Action class in this package, so this class uses the name transition. There are three types of transitions: input, output, and internal. Each transition has a label. The labels for input, output, and internal transitions end with "?", "!", and ";", respectively. The type of transition is determined by the ending character of the label this way. Each input transition corresponds to an input port of the InterfaceAutomaton that contains it, and its label, excluding the ending "?", must be the same as the input port name; Similarly, each output transition corresponds to an output port, and its label, excluding the ending "!", must be the same as the output port name; Each internal transitions corresponds to a parameter of the InterfaceAutomaton that contains it, and its label, excluding the ending ";", must be the same as the parameter name.

The guard of each transition is set automatically. Users should not set the guard. For an input transition, the guard is set to <inputPort> _isPresent, where <inputPort> is the port corresponding to this transition; For output and internal transitions, the guard is set to true. Each of the output and internal transitions contain an Action. The expression of the Action is also set automatically. For output transition, the action is set to <outputPort>=true, where <outputPort> is the output port corresponding to this transition; for internal transition, the action is set to <parameter>=true, where <parameter> is the parameter corresponding to this transition.

Since:
Ptolemy II 8.0
Version:
$Id: InterfaceAutomatonTransition.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Yuhong Xiong, Xiaojun Liu and Edward A. Lee
See Also:
InterfaceAutomaton, Action, Serialized Form
Accepted Rating:
Red (yuhong)
Proposed Rating:
Red (yuhong)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
protected static int _INPUT_TRANSITION
          The input transition type.
protected static int _INTERNAL_TRANSITION
          The internal transition type.
protected static int _OUTPUT_TRANSITION
          The output transition type.
 StringAttribute label
          The label of this transition.
 
Fields inherited from class ptolemy.domains.modal.kernel.Transition
annotation, defaultTransition, exitAngle, gamma, guardExpression, nondeterministic, outputActions, preemptive, refinementName, reset, setActions
 
Fields inherited from class ptolemy.kernel.Relation
_linkList
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
InterfaceAutomatonTransition(InterfaceAutomaton container, java.lang.String name)
          Construct a transition with the specified container and name.
 
Method Summary
 void attributeChanged(Attribute attribute)
          React to a change in an attribute.
 java.lang.String getLabel()
          Return the label of this transition.
 int getType()
          Return the transition type.
 void setContainer(CompositeEntity container)
          Override the base class to ensure that the proposed container is an instance of InterfaceAutomaton or null.
 void setTriggerExpression(java.lang.String expression)
          Throw an exception.
 
Methods inherited from class ptolemy.domains.modal.kernel.Transition
_checkPort, choiceActionList, clone, commitActionList, destinationState, getGuardExpression, getParseTreeEvaluator, getRefinement, isDefault, isEnabled, isEnabled, isNondeterministic, isPreemptive, setGuardExpression, sourceState
 
Methods inherited from class ptolemy.kernel.ComponentRelation
_checkContainer, _checkRelation, _propagateExistence, deepLinkedPortList, deepLinkedPorts, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, unlinkAll
 
Methods inherited from class ptolemy.kernel.Relation
_description, _getContainedObject, link, linkedObjectsList, linkedPortList, linkedPortList, linkedPorts, linkedPorts, numLinks, relationGroupList, unlink
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, 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
 

Field Detail

label

public StringAttribute label
The label of this transition. Must ends with "?" or "!" or ";"


_INPUT_TRANSITION

protected static final int _INPUT_TRANSITION
The input transition type.

See Also:
Constant Field Values

_OUTPUT_TRANSITION

protected static final int _OUTPUT_TRANSITION
The output transition type.

See Also:
Constant Field Values

_INTERNAL_TRANSITION

protected static final int _INTERNAL_TRANSITION
The internal transition type.

See Also:
Constant Field Values
Constructor Detail

InterfaceAutomatonTransition

public InterfaceAutomatonTransition(InterfaceAutomaton container,
                                    java.lang.String name)
                             throws IllegalActionException,
                                    NameDuplicationException
Construct a transition with the specified container and name. The container argument must not be null, or a NullPointerException will be thrown. This transition 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.

Parameters:
container - An interface automaton.
name - The name of this transition.
Throws:
IllegalActionException - If the container is incompatible with this transition.
NameDuplicationException - If the name coincides with any relation already in the container.
Method Detail

attributeChanged

public void attributeChanged(Attribute attribute)
                      throws IllegalActionException
React to a change in an attribute. If the changed attribute is label, use the ending character of the label to determine the transition type, and set the guard and output action of this transition. For internal transition, also create the parameter corresponding to the transition. Increment the version number of the workspace.

Overrides:
attributeChanged in class Transition
Parameters:
attribute - The attribute that changed.
Throws:
IllegalActionException - If thrown by the superclass attributeChanged() method, or the changed attribute is label and it does not ends with "?" or "!" or ";".

getLabel

public java.lang.String getLabel()
Return the label of this transition. If the label has not been set, return an empty string.

Overrides:
getLabel in class Transition
Returns:
The label of this transition.

getType

public int getType()
Return the transition type. The transition type is one of _INPUT_TRANSITION, _OUTPUT_TRANSITION, or _INTERNAL_TRANSITION.

Returns:
the transition type.

setContainer

public void setContainer(CompositeEntity container)
                  throws IllegalActionException,
                         NameDuplicationException
Override the base class to ensure that the proposed container is an instance of InterfaceAutomaton or null. If it is, call the base class setContainer() method. A null argument will remove this transition from its container.

Overrides:
setContainer in class Transition
Parameters:
container - The proposed container.
Throws:
IllegalActionException - If setting the container would result in a recursive containment structure, or if this transition and container are not in the same workspace, or if the argument is not an InterfaceAutomaton or null.
NameDuplicationException - If the container already has an relation with the name of this transition.
See Also:
ComponentRelation.getContainer()

setTriggerExpression

public void setTriggerExpression(java.lang.String expression)
Throw an exception. Trigger expression is not used in InterfaceAutomaton, so this method should not be called in this class.

Parameters:
expression - The trigger expression.
Throws:
java.lang.UnsupportedOperationException - Always thrown.