Class InterfaceAutomatonTransition

  • All Implemented Interfaces:
    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$
    Author:
    Yuhong Xiong, Xiaojun Liu and Edward A. Lee
    See Also:
    InterfaceAutomaton, Action
    Pt.AcceptedRating:
    Red (yuhong)
    Pt.ProposedRating:
    Red (yuhong)
    • 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.