Class State

    • Field Detail

      • incomingPort

        public ComponentPort incomingPort
        The port linking incoming transitions.
      • isFinalState

        public Parameter isFinalState
        An indicator of whether this state is a final state. This is a boolean that defaults to false. Setting it to true will cause the containing FSMActor to return false from its postfire() method, which indicates to the director that the FSMActor should not be fired again.
      • isInitialState

        public Parameter isInitialState
        An indicator of whether this state is the initial state. This is a boolean that defaults to false, unless this state is the only one in the container, in which case it defaults to true. Setting it to true will cause this parameter to become false for whatever other state is currently the initial state in the same container.
      • outgoingPort

        public ComponentPort outgoingPort
        The port linking outgoing transitions.
      • refinementName

        public StringAttribute refinementName
        Attribute specifying one or more names of refinements. The refinements must be instances of TypedActor and have the same container as the FSMActor containing this state, otherwise an exception will be thrown when getRefinement() is called. Usually, the refinement is a single name. However, if a comma-separated list of names is provided, then all the specified refinements will be executed. This attribute has a null expression or a null string as expression when the state is not refined.
      • saveRefinementsInConfigurer

        public Parameter saveRefinementsInConfigurer
        A boolean attribute to decide refinements of this state should be exported as configurations of this state or not.
    • Constructor Detail

      • State

        public State​(CompositeEntity container,
                     java.lang.String name)
              throws IllegalActionException,
                     NameDuplicationException
        Construct a state with the given name contained by the specified composite entity. The container argument must not be null, or a NullPointerException will be thrown. This state 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. This constructor write-synchronizes on the workspace.
        Parameters:
        container - The container.
        name - The name of the state.
        Throws:
        IllegalActionException - If the state cannot be contained by the proposed container.
        NameDuplicationException - If the name coincides with that of an entity 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 the refinementName attribute, record the change but do not check whether there is a TypedActor with the specified name and having the same container as the FSMActor containing this state.
        Overrides:
        attributeChanged in class NamedObj
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If thrown by the superclass attributeChanged() method.
      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the state into the specified workspace. This calls the base class and then sets the attribute and port public members to refer to the attributes and ports of the new state.
        Overrides:
        clone in class ComponentEntity
        Parameters:
        workspace - The workspace for the new state.
        Returns:
        A new state.
        Throws:
        java.lang.CloneNotSupportedException - If a derived class contains an attribute that cannot be cloned.
        See Also:
        NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)
      • configure

        public void configure​(java.net.URL base,
                              java.lang.String source,
                              java.lang.String text)
                       throws java.lang.Exception
        Configure the object with data from the specified input source (a URL) and/or textual data. The object should interpret the source first, if it is specified, followed by the literal text, if that is specified. The new configuration should usually override any old configuration wherever possible, in order to ensure that the current state can be successfully retrieved.

        This method is defined to throw a very general exception to allow classes that implement the interface to use whatever exceptions are appropriate.

        Specified by:
        configure in interface Configurable
        Parameters:
        base - The base relative to which references within the input are found, or null if this is not known, or there is none.
        source - The input source, which specifies a URL, or null if none.
        text - Configuration information given as text, or null if none.
        Throws:
        java.lang.Exception - If something goes wrong.
      • dropObject

        public void dropObject​(NamedObj target,
                               java.util.List dropObjects,
                               java.lang.String moml)
                        throws IllegalActionException
        React to a list of objects being dropped onto a target.
        Specified by:
        dropObject in interface DropTargetHandler
        Parameters:
        target - The target on which the objects are dropped.
        dropObjects - The list of objects dropped onto the target.
        moml - The moml string generated for the dropped objects.
        Throws:
        IllegalActionException - If the handling is unsuccessful.
      • errorTransitionList

        public java.util.List errorTransitionList()
                                           throws IllegalActionException
        Return the list of outgoing error transitions from this state.
        Returns:
        The list of outgoing error transitions from this state.
        Throws:
        IllegalActionException - If the parameters giving transition properties cannot be evaluated.
      • getConfigureSource

        public java.lang.String getConfigureSource()
        Return the input source that was specified the last time the configure method was called.
        Specified by:
        getConfigureSource in interface Configurable
        Returns:
        The string representation of the input URL, or null if the no source has been used to configure this object, or null if no external source need be used to configure this object.
      • getConfigureText

        public java.lang.String getConfigureText()
        Return the text string that represents the current configuration of this object. Note that any configuration that was previously specified using the source attribute need not be represented here as well.
        Specified by:
        getConfigureText in interface Configurable
        Returns:
        A configuration string, or null if no configuration has been used to configure this object, or null if no configuration string need be used to configure this object.
      • getObjectInRefinement

        public NamedObj getObjectInRefinement​(java.lang.String name)
                                       throws IllegalActionException
        Get a NamedObj with the given name in the refinement of this state, if any.
        Parameters:
        name - The name of the NamedObj.
        Returns:
        The NamedObj in the refinement, or null if not found.
        Throws:
        IllegalActionException - If the refinement cannot be found, or if a comma-separated list is malformed.
      • getRefinement

        public TypedActor[] getRefinement()
                                   throws IllegalActionException
        Return the refinements of this state. The names of the refinements are specified by the refinementName attribute. The refinements must be instances of TypedActor and have the same container as the FSMActor containing this state, otherwise an exception is thrown. This method can also return null if there is no refinement. This method is read-synchronized on the workspace.
        Returns:
        The refinements of this state, or null if there are none.
        Throws:
        IllegalActionException - If the specified refinement cannot be found, or if a comma-separated list is malformed.
      • nonErrorNonTerminationTransitionList

        public java.util.List nonErrorNonTerminationTransitionList()
                                                            throws IllegalActionException
        Return the list of outgoing transitions from this state that are neither error nor termination transitions.
        Returns:
        A list of outgoing transitions from this state.
        Throws:
        IllegalActionException - If the parameters giving transition properties cannot be evaluated.
      • nonpreemptiveTransitionList

        public java.util.List nonpreemptiveTransitionList()
                                                   throws IllegalActionException
        Return the list of non-preemptive outgoing transitions from this state. This list does not include error transitions and does include termination transitions.
        Returns:
        The list of non-preemptive outgoing transitions from this state.
        Throws:
        IllegalActionException - If the parameters giving transition properties cannot be evaluated.
      • preemptiveTransitionList

        public java.util.List preemptiveTransitionList()
                                                throws IllegalActionException
        Return the list of preemptive outgoing transitions from this state.
        Returns:
        The list of preemptive outgoing transitions from this state. This will be an empty list if there aren't any.
        Throws:
        IllegalActionException - If the parameters giving transition properties cannot be evaluated.
      • terminationTransitionList

        public java.util.List terminationTransitionList()
                                                 throws IllegalActionException
        Return the list of termination transitions from this state.
        Returns:
        The list of termination transitions from this state. This will be an empty list if there aren't any.
        Throws:
        IllegalActionException - If the parameters giving transition properties cannot be evaluated.
      • _exportMoMLContents

        protected void _exportMoMLContents​(java.io.Writer output,
                                           int depth)
                                    throws java.io.IOException
        Write a MoML description of the contents of this object, which in this class are the attributes plus the ports. This method is called by exportMoML(). Each description is indented according to the specified depth and terminated with a newline character.
        Overrides:
        _exportMoMLContents in class Entity
        Parameters:
        output - The output to write to.
        depth - The depth in the hierarchy, to determine indenting.
        Throws:
        java.io.IOException - If an I/O error occurs.
        See Also:
        NamedObj.exportMoML(Writer, int)