|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.kernel.CompositeEntity
ptolemy.domains.modal.kernel.FSMActor
ptolemy.domains.modal.kernel.ia.InterfaceAutomaton
public class InterfaceAutomaton
This class models an Interface Automaton. Interface automata is an automata model defined by de Alfaro and Henzinger in the paper "Interface Automata". An InterfaceAutomaton contains a set of states and InterfaceAutomatonTransitions. There are three kinds transitions: input transition, output transition, and internal transitions. The input and output transitions correspond to input and output ports, respectively. The internal transition correspond to a parameter in this InterfaceAutomaton. The parameter is added automatically when the internal transition is added.
When an InterfaceAutomaton is fired, the outgoing transitions of the current state are examined. An IllegalActionException is thrown if there is more than one enabled transition. If there is exactly one enabled transition then it is taken.
An InterfaceAutomaton enters its initial state during initialization. The name of the initial state is specified by the initialStateName string attribute.
State
,
InterfaceAutomatonTransition
,
Serialized Form
Yellow (kienhuis) |
Yellow (liuxj) |
Nested Class Summary | |
---|---|
private static class |
InterfaceAutomaton.Triple
|
Nested classes/interfaces inherited from class ptolemy.domains.modal.kernel.FSMActor |
---|
FSMActor.PortScope |
Nested classes/interfaces inherited from class ptolemy.kernel.CompositeEntity |
---|
CompositeEntity.ContainedObjectsIterator |
Field Summary | |
---|---|
private java.util.Set |
_illegalStates
|
private java.util.Set |
_inputNames
|
private java.util.Set |
_internalNames
|
private java.util.Set |
_outputNames
|
private static java.lang.String |
NAME_CONNECTOR
|
Fields inherited from class ptolemy.domains.modal.kernel.FSMActor |
---|
_currentState, _initializables, _inputTokenMap, _lastChosenTransition, _stopRequested, finalStateNames, initialStateName, stateDependentCausality |
Fields inherited from class ptolemy.kernel.CompositeEntity |
---|
_levelCrossingLinks |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface ptolemy.actor.Executable |
---|
COMPLETED, NOT_READY, STOP_ITERATING |
Constructor Summary | |
---|---|
InterfaceAutomaton()
Construct an InterfaceAutomaton in the default workspace with an empty string as its name. |
|
InterfaceAutomaton(CompositeEntity container,
java.lang.String name)
Create an InterfaceAutomaton in the specified container with the specified name. |
|
InterfaceAutomaton(Workspace workspace)
Construct an InterfaceAutomaton in the specified workspace with an empty string as its name. |
Method Summary | |
---|---|
protected void |
_addRelation(ComponentRelation relation)
Add an InterfaceAutomatonTransition to this InterfaceAutomaton. |
private State |
_addState(InterfaceAutomaton product,
State stateInThis,
State stateInArgument,
java.util.HashMap frontier)
|
private void |
_addTransition(InterfaceAutomaton automaton,
java.lang.String relationNamePrefix,
State sourceState,
State destinationState,
java.lang.String label)
|
private void |
_check()
|
private void |
_checkComposability(InterfaceAutomaton automaton)
|
private InterfaceAutomaton |
_computeProduct(InterfaceAutomaton automaton,
boolean considerTransient)
|
private void |
_computeTransitionNamesInComposition(InterfaceAutomaton automaton)
|
private static boolean |
_condition1Satisfied(InterfaceAutomaton superAutomaton,
State superState,
InterfaceAutomaton subAutomaton,
State subState)
|
private static boolean |
_condition2Satisfied(InterfaceAutomaton superAutomaton,
State superState,
InterfaceAutomaton subAutomaton,
State subState,
java.util.Set currentSimulation)
|
private void |
_createPorts(InterfaceAutomaton composition)
|
private java.util.Set |
_getDestinationStates(State state,
java.lang.String label)
|
private static boolean |
_isTransient(State state)
|
private void |
_pruneIllegalStates()
|
private void |
_removeStateAndTransitions(State state)
|
private void |
_removeUnreacheableStates()
|
private java.util.Set |
_transitionLabelsFrom(State state,
int transitionType)
|
void |
addPorts()
Add instances of TypedIOPort that correspond to input and output transitions, if these port do not exist. |
void |
combineInternalTransitions()
Combine each chain of internal transitions into one transition. |
InterfaceAutomaton |
compose(InterfaceAutomaton automaton)
Return a new InterfaceAutomaton that is the composition of the specified InterfaceAutomaton and this one. |
InterfaceAutomaton |
compose(InterfaceAutomaton automaton,
boolean considerTransient)
Return a new InterfaceAutomaton that is the composition of the specified InterfaceAutomaton and this one. |
java.util.Set |
computeAlternatingSimulation(InterfaceAutomaton subAutomaton)
Return the unique maximal alternating simulation from the specified automaton to this automaton. |
java.util.Set |
deadlockStates()
Return the deadlock states in a Set. |
java.util.Set |
epsilonClosure(State state)
Return the epsilon-closure of the specified state. |
java.util.Set |
externallyEnabledDestinations(State sourceState,
java.lang.String transitionLabel)
Return the set of externally enabled destination states. |
java.util.Set |
externallyEnabledInputTransitionLabels(State state)
Return the labels for the set of externally enabled input transitions for the specified state. |
java.util.Set |
externallyEnabledOutputTransitionLabels(State state)
Return the labels for the set of externally enabled output transitions for the specified state. |
void |
fire()
Choose the enabled transition among the outgoing transitions of the current state. |
java.lang.String |
getInfo()
Return a high-level description of this automaton. |
java.util.Set |
inputNameSet()
Return the names of the input ports as a Set. |
java.util.Set |
internalTransitionNameSet()
Return the names of the internal transitions as a Set. |
boolean |
isClosed()
Return true if this automaton does not have any input and output; false otherwise. |
boolean |
isEmpty()
Return true if this automaton is empty; false otherwise. |
ComponentRelation |
newRelation(java.lang.String name)
Create a new instance of InterfaceAutomatonTransition with the specified name in this actor, and return it. |
java.util.Set |
outputNameSet()
Return the names of the output ports as a Set. |
void |
project(InterfaceAutomaton automaton)
Project this automaton into the specified one. |
static java.util.Set |
reacheableAlternatingSimulation(java.util.Set alternatingSimulation,
InterfaceAutomaton superAutomaton,
InterfaceAutomaton subAutomaton)
Return the reacheable state pairs in the specified alternating simulation. |
void |
renameTransitionLabels(java.util.Map nameMap)
Rename the labels on some transitions. |
Methods inherited from class ptolemy.kernel.ComponentEntity |
---|
_addPort, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName |
Methods inherited from class ptolemy.kernel.Entity |
---|
_removePort, connectedPortList, connectedPorts, connectionsChanged, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts |
Methods inherited from class ptolemy.kernel.InstantiableNamedObj |
---|
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition |
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, getDisplayName, getFullName, getName, getName, setName |
Methods inherited from interface ptolemy.kernel.util.Derivable |
---|
getDerivedLevel, getDerivedList, propagateValue |
Field Detail |
---|
private static final java.lang.String NAME_CONNECTOR
private java.util.Set _inputNames
private java.util.Set _outputNames
private java.util.Set _internalNames
private java.util.Set _illegalStates
Constructor Detail |
---|
public InterfaceAutomaton()
public InterfaceAutomaton(Workspace workspace)
workspace
- The workspace that will list the actor.public InterfaceAutomaton(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this automaton within the container.
IllegalActionException
- If the entity cannot be contained
by the proposed container.
NameDuplicationException
- If the name coincides with
an entity already in the container.Method Detail |
---|
public void addPorts()
public void combineInternalTransitions()
public InterfaceAutomaton compose(InterfaceAutomaton automaton) throws IllegalActionException
automaton
- An InterfaceAutomaton to compose with this one.
IllegalActionException
- If this automaton is not composable
with the argument.public InterfaceAutomaton compose(InterfaceAutomaton automaton, boolean considerTransient) throws IllegalActionException
automaton
- An InterfaceAutomaton to compose with this one.considerTransient
- True to indicate that transient states
should be treated differently; false to indicate that transient
states are treated as regular ones.
IllegalActionException
- If this automaton is not composable
with the argument.public java.util.Set computeAlternatingSimulation(InterfaceAutomaton subAutomaton) throws IllegalActionException
This method returns a set of instances of StatePair. The first state in each pair is in the super automaton, and the second state is in the sub automaton.
subAutomaton
- An interface automaton.
IllegalActionException
- If this automaton or the specified
one is not consistent. For example, missing ports.StatePair
public java.util.Set deadlockStates() throws IllegalActionException
IllegalActionException
- If this automaton is not closed.public java.util.Set epsilonClosure(State state)
state
- The state from which the epsilon-closure is computed.
public java.util.Set externallyEnabledDestinations(State sourceState, java.lang.String transitionLabel)
sourceState
- The source state from which the externally
enabled destinations are computed.transitionLabel
- The label for an externally enabled transition.
public java.util.Set externallyEnabledInputTransitionLabels(State state)
state
- The state for which the externally enabled input
transitions are computed.
public java.util.Set externallyEnabledOutputTransitionLabels(State state)
state
- The state for which the externally enabled output
transitions are computed.
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class FSMActor
IllegalActionException
- If there is more than one
transition enabled.public java.lang.String getInfo()
(full name of automaton): (number of states) states (number of transitions) transitions (number of input names) input names (number of output names) output names (number of internal transition names) internal transition names Input Names: (list of input names) Output Names: (list of output names) Internal Transition Names: (list of internal transition names)
public java.util.Set inputNameSet()
public java.util.Set internalTransitionNameSet()
public boolean isClosed()
public boolean isEmpty()
public ComponentRelation newRelation(java.lang.String name) throws IllegalActionException, NameDuplicationException
newRelation
in class FSMActor
name
- The name of the new transition.
IllegalActionException
- If the name argument is null.
NameDuplicationException
- If name collides with that
of a transition already in this actor.public java.util.Set outputNameSet()
public void project(InterfaceAutomaton automaton) throws IllegalActionException
automaton
- The interface automaton to which this automaton will
be projected.
IllegalActionException
- If this or the specified automaton
is not consistent. For example, missing ports.public static java.util.Set reacheableAlternatingSimulation(java.util.Set alternatingSimulation, InterfaceAutomaton superAutomaton, InterfaceAutomaton subAutomaton) throws IllegalActionException
alternatingSimulation
- A set of instances of StatePair.superAutomaton
- The automaton that contains the first state
in the state pairs in alternatingSimulation.subAutomaton
- The automaton that contains the second state
in the state pairs in alternatingSimulation.
IllegalActionException
- If thrown by getInitialState().public void renameTransitionLabels(java.util.Map nameMap) throws IllegalActionException, NameDuplicationException
For input and output transitions, this method also renames the ports associated with the renamed transitions, if these ports are created already. This is done regardless of whether there are instances of transitions that correspond to the ports. For internal transitions, this method renames the parameter associated with the renamed transition.
nameMap
- A map between the old and the new label names.
IllegalActionException
- If the new name is not legal.
NameDuplicationException
- If the requested name change will
cause name collision.protected void _addRelation(ComponentRelation relation) throws IllegalActionException, NameDuplicationException
_addRelation
in class FSMActor
relation
- The InterfaceAutomatonTransition to contain.
IllegalActionException
- If the transition has no name, or
is not an instance of Transition.
NameDuplicationException
- If the name collides with a name
already on the contained transitions list.private State _addState(InterfaceAutomaton product, State stateInThis, State stateInArgument, java.util.HashMap frontier) throws IllegalActionException, NameDuplicationException
IllegalActionException
NameDuplicationException
private void _addTransition(InterfaceAutomaton automaton, java.lang.String relationNamePrefix, State sourceState, State destinationState, java.lang.String label) throws IllegalActionException, NameDuplicationException
IllegalActionException
NameDuplicationException
private void _check() throws IllegalActionException
IllegalActionException
private void _checkComposability(InterfaceAutomaton automaton) throws IllegalActionException
IllegalActionException
private InterfaceAutomaton _computeProduct(InterfaceAutomaton automaton, boolean considerTransient) throws IllegalActionException
IllegalActionException
private void _computeTransitionNamesInComposition(InterfaceAutomaton automaton)
private static boolean _condition1Satisfied(InterfaceAutomaton superAutomaton, State superState, InterfaceAutomaton subAutomaton, State subState)
private static boolean _condition2Satisfied(InterfaceAutomaton superAutomaton, State superState, InterfaceAutomaton subAutomaton, State subState, java.util.Set currentSimulation)
private void _createPorts(InterfaceAutomaton composition) throws IllegalActionException
IllegalActionException
private java.util.Set _getDestinationStates(State state, java.lang.String label)
private static boolean _isTransient(State state)
private void _pruneIllegalStates()
private void _removeStateAndTransitions(State state)
private void _removeUnreacheableStates()
private java.util.Set _transitionLabelsFrom(State state, int transitionType)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |