public class FSMActor extends CompositeEntity implements TypedActor, ExplicitChangeContext
After reading the inputs, this actor examines the outgoing transitions of the current state, evaluating their guard expressions. A transition is enabled if its guard expression evaluates to true. A blank guard expression is interpreted to be always true. The guard expression may refer to any input port and any variable in scope.
If an input port name portName is used in a guard expression, it refers to the current input on that port on channel zero. If the input port status is not known, or if the input is absent, then a guard expression referring to portName will not be evaluated. The guard expression may alternatively refer to portName_isPresent, which is a boolean that is true if an input is present on the specified port. Again, if the input port status is not known, such a guard would not be evaluated. The status of an input port may not be known during firings under a director with fixed-point semantics, such as SR or Continuous.
To refer to a channel specifically, a guard expression may use portName_channelIndex, which has value equal to the token received on the port on the given channel. Similarly, it may refer to portName_channelIndex_isPresent.
FIXME: Document multirate behavior.
The identifier portNameArray or portName_channelIndexArray refers the array of all tokens consumed from the port in the last firing. This identifier has an array type whose element type is the type of the corresponding input port.
Nondeterministic transitions are allowed if all enabled transitions are marked nondeterministic. If more than one transition is enabled and they are all marked nondeterministic, then one is chosen at random in the fire() method. Note that this class provides no guarantees about the probability of selecting a particular nondeterministic transition. It is perfectly valid to always choose the same one, for example. To provide such a guarantee, we would have to impose the constraint that no nondeterministic transition can be chosen until the guards of all nondeterministic transitions can be evaluated. This would rule out certain models, in particular those that illustrate the celebrated Brock-Ackerman anomaly. Hence, in this implementation, if the fire() method is invoked more than once in an iteration, then subsequent invocations in the same iteration will always choose the same transition, if it is still enabled. If more transitions become enabled in subsequent firings and they are not all marked nondeterminate, then an exception will thrown. All of this means that if some input is unknown on the first invocation of fire(), and a guard refers to that input, then that transition will not be chosen. As a consequence, for nondeterministic state machines, the behavior may depend on the order of firings in a fixed-point iteration. This is in fact unavoidable (it is related to the celebrated Brock-Ackerman anomaly, which demonstrates that the input/output relations of a nondeterministic system do not completely determine its behavior; the context in which it is used can also affect the behavior; specifically, the context may make it impossible to know the value of input on the first invocation of fire() because of a feedback loop). Thus, to correctly realize all nondeterministic systems, we cannot provide probabilistic execution of nondeterministic transitions.
If no transition is enabled and all their guard expressions have been evaluated (all relevant inputs are known), then if there is a transition marked as a default transition, then that transition is chosen. If there is more than one default transition and they are all marked nondeterministic, then one is chosen at random.
Once a transition is chosen, its output actions are executed. Typically, these will write values to output ports. The form of an output action is typically y = expression, where expression may refer to any variable defined as above or any parameter in scope (and also to outputs of state refinements, see below). This gives the behavior of a Mealy machine, where outputs are produced by transitions rather than by states. Moore machine behavior is also achievable using state refinements that produce outputs (see FSMDirector documentation). Multiple output actions may be given by separating them with semicolons. Also, output actions may take the form of d.p = expression, where d is the name of the destination state and p is a parameter of the destination refinement.
After a transition is taken, this actor calls fireAtCurrentTime() on its enclosing director. This ensures that if the destination state has an enabled transition, that transition will be taken at the same time (in the next superdense time index). It also supports continuous-time models, where the destination state refinement, if any, should produce an output at the next superdense time index.
A final state is a state that has its isFinalState parameter set to true. When the actor reaches a final state, then the postfire method will return false, indicating that the actor does not wish to be fired again.
An FSMActor can be used in a modal model to represent the mode control logic. In this case, the states and transitions have refinements, and this actor works in concert with the FSMDirector to execute those refinements. See the documentation for FSMDirector for details on how that works.
By default, this actor has a conservative causality interface,
implemented by the DefaultCausalityInterface
, which declares
that all outputs depend on all inputs. If, however, the enclosing
director and all state refinement directors implement the
strict actor semantics (as indicated by their
implementsStrictActorSemantics() method), then the returned
causality interface is
implemented by the FSMCausalityInterface
class. If
the stateDependentCausality is false (the default),
then this causality interface in conservative and valid in all
states. If it is true, then the causality interface will show
different input/output dependencies depending on the state.
See FSMCausalityInterface
for details.
State
,
Transition
,
Action
,
FSMDirector
Modifier and Type | Class and Description |
---|---|
class |
FSMActor.PortScope
This class implements a scope, which is used to evaluate the
parsed expressions.
|
CompositeEntity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected State |
_currentState
Current state.
|
protected java.util.Set<Actor> |
_disabledRefinements
State and transition refinements that have returned false in postfire().
|
protected java.util.List<Initializable> |
_initializables
List of objects whose (pre)initialize() and wrapup() methods
should be slaved to these.
|
(package private) State |
_initialState
The initial state.
|
protected java.util.Map |
_inputTokenMap
A map from ports to corresponding input variables.
|
protected Transition |
_lastChosenTransition
The most recently chosen transition within the fire() method.
|
protected java.util.HashMap<State,Transition> |
_lastChosenTransitions
The last chosen transitions, by state from which these transitions emerge.
|
protected java.util.List<Transition> |
_lastTakenTransitions
The last taken transitions, by state from which these transitions emerge.
|
protected java.util.List<Actor> |
_stateRefinementsToPostfire
State refinements to postfire(), as determined by the fire() method.
|
protected boolean |
_stopRequested
Indicator that a stop has been requested by a call to stop().
|
Parameter |
errorCause
Parameter containing the cause of an exception thrown
while executing a refinement if the exception is a
KernelException that specified a Nameable.
|
StringParameter |
errorClass
Parameter containing the name of the class of exception thrown
while executing a refinement.
|
StringParameter |
errorMessage
Parameter containing the message of exception thrown
while executing a refinement.
|
StringAttribute |
finalStateNames
Attribute specifying the names of the final states of this
actor.
|
StringAttribute |
initialStateName
Attribute specifying the name of the initial state of this
actor.
|
Parameter |
probability
Parameter that is a function which evaluates to true
when the randomly generated token value is within the probability
range expressed by a transition.
|
SharedParameter |
resetOnEachRun
Boolean parameter to determine whether seeds are reset on each run.
|
SharedParameter |
seed
The seed to be used for random token generation, to evaluate
probabilistic transitions between states.
|
Parameter |
stateDependentCausality
Indicate whether input/output dependencies can depend on the
state.
|
Parameter |
timeout
Parameter that is a function that evaluates to true when the
time elapsed in the current state equals the argument to the
function.
|
_levelCrossingLinks
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
FSMActor()
Construct an FSMActor in the default workspace with an empty string
as its name.
|
FSMActor(CompositeEntity container,
java.lang.String name)
Create an FSMActor in the specified container with the specified
name.
|
FSMActor(Workspace workspace)
Construct an FSMActor in the specified workspace with an empty
string as its name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_addEntity(ComponentEntity entity)
Add a state to this FSMActor.
|
protected void |
_addRelation(ComponentRelation relation)
Add a transition to this FSMActor.
|
protected boolean |
_areAllImmediateTransitionsDisabled(State state)
Return true if all immediate transitions from
the specified state have guards that can be evaluated
and that evaluate to false.
|
protected void |
_chooseTransitions(java.util.List<Transition> transitionList,
boolean preemptive,
boolean immediateOnly,
boolean inInitialize,
boolean inPreinitialize)
Choose zero or more transitions enabled in the current
state from the list of specified transitions.
|
protected State |
_destinationState()
Return the chosen destination state.
|
protected int |
_getChannelForIdentifier(java.lang.String identifier)
Given an identifier, return a channel number i if the identifier is of
the form portName_i, portName_i_isPresent, portName_iArray.
|
protected IOPort |
_getPortForIdentifier(java.lang.String identifier)
Get the port for the specified identifier, which may be of
form portName, portName_isPresent, portName_i, portName_i_isPresent,
etc.
|
protected java.util.List<Actor> |
_getStateRefinementsToPostfire()
Return the list used to keep track of refinements that have been
fired.
|
protected java.util.List<Actor> |
_getTransitionRefinementsToPostfire()
Return the list used to keep track of refinements that have been
fired.
|
protected void |
_init() |
protected void |
_initializeRefinements(State state)
Initialize the refinements of the specified state.
|
protected boolean |
_isRefinementOutput(IOPort port,
int channel)
Return true if the channel of the port is connected to an output
port of the refinement of current state.
|
protected boolean |
_isSafeToClear(IOPort port,
int channel,
State state,
boolean immediateOnly,
java.util.HashSet<State> visitedStates)
Given an output port and channel, determine whether the
output port must be absent on the specified channel, given whatever
current information about the inputs is available (the inputs
may be known or unknown).
|
protected void |
_readInputs(IOPort port,
int channel)
Read tokens from the given channel of the given input port and
make them accessible to the expressions of guards and
transitions through the port scope.
|
protected boolean |
_schedule(NamedObj actor,
Time timestamp)
Schedule an actor for execution on a ExecutionAspect.
|
protected void |
_setCurrentConnectionMap()
Set the map from input ports to boolean flags indicating whether a
channel is connected to an output port of the refinement of the
current state.
|
protected void |
_setTimeForRefinement(Actor refinement)
Set the refinements current time equal to the matching environment,
or if there is no environment, do nothing.
|
void |
addChosenTransition(State state,
Transition transition)
Add a chosen transition to the set of chosen transitions.
|
void |
addInitializable(Initializable initializable)
Add the specified object to the list of objects whose
preinitialize(), initialize(), and wrapup()
methods should be invoked upon invocation of the corresponding
methods of this object.
|
void |
attributeChanged(Attribute attribute)
If the attribute is seed
then create the base random number generator.
|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
void |
createReceivers()
Create receivers for each input port.
|
State |
currentState()
Return the current state of this actor.
|
java.util.List |
enabledTransitions(java.util.List transitionList,
boolean preemptive,
boolean immediateOnly)
Return a list of enabled transitions among the given list of
transitions.
|
void |
exportSubmodel(java.io.Writer output,
int depth,
java.lang.String name)
Write this FSMActor into the output writer as a submodel.
|
void |
fire()
Set the values of input variables.
|
boolean |
foundUnknown()
Return true if the most recent call to enabledTransition()
or chooseTransition() found guard expressions or output value
expressions that could not be evaluated due to unknown inputs.
|
CausalityInterface |
getCausalityInterface()
Return a causality interface for this actor.
|
Entity |
getContext()
Return the change context being made explicit.
|
Director |
getDirector()
Return the director responsible for the execution of this actor.
|
Director |
getExecutiveDirector()
Return the executive director (same as getDirector()).
|
State |
getInitialState()
Return the initial state of this actor.
|
Transition |
getLastChosenTransition()
Deprecated.
Use
getLastChosenTransitions() instead. |
java.util.Map<State,Transition> |
getLastChosenTransitions()
Get the last chosen transitions.
|
java.util.List<Transition> |
getLastTakenTransitions()
Get the last taken transitions.
|
Manager |
getManager()
Return the Manager responsible for execution of this actor,
if there is one.
|
java.util.List |
getModifiedVariables()
Return a list of variables that this entity modifies.
|
ParserScope |
getPortScope()
Return a scope object that has current values from input ports
of this FSMActor in scope.
|
boolean |
handleModelError(NamedObj context,
IllegalActionException exception)
Handle a model error.
|
boolean |
hasInput()
Test whether new input tokens have been received at the input ports.
|
boolean |
hasInput(Port port)
Test whether new input tokens have been received at the given input
port.
|
void |
initialize()
Initialize this actor by setting the current state to the
initial state.
|
java.util.List |
inputPortList()
Return a list of the input ports.
|
boolean |
isBackwardTypeInferenceEnabled()
Return false because backward type inference is not implemented
for this actor.
|
boolean |
isFireFunctional()
Return false.
|
boolean |
isOpaque()
Return true.
|
boolean |
isStrict()
Return false.
|
int |
iterate(int count)
Invoke a specified number of iterations of the actor.
|
Port |
newPort(java.lang.String name)
Create a new TypedIOPort with the specified name.
|
Receiver |
newReceiver()
Return a new receiver obtained from the director.
|
ComponentRelation |
newRelation(java.lang.String name)
Create a new instance of Transition with the specified name in
this actor, and return it.
|
java.util.List |
outputPortList()
Return a list of the output ports.
|
boolean |
postfire()
Execute actions on the last chosen transition.
|
boolean |
prefire()
Return true.
|
void |
preinitialize()
Create receivers and input variables for the input ports of
this actor, and validate attributes of this actor, and
attributes of the ports of this actor.
|
void |
readInputs()
Set the value of the shadow variables for input ports of this actor.
|
void |
readOutputsFromRefinement()
Set the input variables for channels that are connected to an
output port of the refinement of current state.
|
void |
removeInitializable(Initializable initializable)
Remove the specified object from the list of objects whose
preinitialize(), initialize(), and wrapup()
methods should be invoked upon invocation of the corresponding
methods of this object.
|
void |
reset()
Reset current state to the initial state.
|
void |
setLastChosenTransition(Transition transition)
Deprecated.
Use addChosenTransition(State, Transition)
|
void |
setNewIteration(boolean newIteration)
Set the flag indicating whether we are at the start of
a new iteration (firing).
|
void |
setSupportMultirate(boolean supportMultirate)
Set true indicating that this actor supports multirate firing.
|
void |
stop()
Request that execution of the current iteration stop as soon
as possible.
|
void |
stopFire()
Do nothing.
|
void |
terminate()
Call stop().
|
java.util.Set<Inequality> |
typeConstraints()
Return the type constraints of this actor.
|
boolean |
wasTransitionTaken()
Return true if a transition was taken in the previous
iteration, or if this is before the first iteration concludes,
true if during initialize an immediate transition was taken.
|
void |
wrapup()
Do nothing except invoke the wrapup method of any objects
that have been added using addInitializable().
|
_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _exportMoMLContents, _finishedAddEntity, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, setContainer, statistics, uniqueName
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _removePort, connectedPortList, connectedPorts, connectionsChanged, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public Parameter errorCause
public StringParameter errorClass
public StringParameter errorMessage
public Parameter probability
public SharedParameter resetOnEachRun
public SharedParameter seed
public Parameter timeout
public StringAttribute finalStateNames
public StringAttribute initialStateName
public Parameter stateDependentCausality
protected State _currentState
protected java.util.Set<Actor> _disabledRefinements
protected transient java.util.List<Initializable> _initializables
protected java.util.Map _inputTokenMap
protected Transition _lastChosenTransition
protected java.util.HashMap<State,Transition> _lastChosenTransitions
protected java.util.List<Transition> _lastTakenTransitions
protected java.util.List<Actor> _stateRefinementsToPostfire
protected boolean _stopRequested
State _initialState
public FSMActor()
public FSMActor(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this actor 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.public FSMActor(Workspace workspace)
workspace
- The workspace that will list the actor.public void addChosenTransition(State state, Transition transition) throws IllegalActionException
state
- The state that has the last chosen transition.transition
- The last chosen transition.IllegalActionException
- If there is already a chosen
transition associated with the specified state and it is not
the same transition.getLastChosenTransitions()
public void addInitializable(Initializable initializable)
addInitializable
in interface Initializable
initializable
- The object whose methods should be invoked.removeInitializable(Initializable)
,
CompositeActor.addPiggyback(Executable)
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- If the change is not acceptable
to this container (not thrown in this base class).public boolean isBackwardTypeInferenceEnabled()
isBackwardTypeInferenceEnabled
in interface TypedActor
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class CompositeEntity
workspace
- The workspace for the new actor.java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void createReceivers() throws IllegalActionException
createReceivers
in interface Actor
IllegalActionException
- If any port throws it.AtomicActor.createReceivers()
,
CompositeActor.createReceivers()
public State currentState()
public java.util.List enabledTransitions(java.util.List transitionList, boolean preemptive, boolean immediateOnly) throws IllegalActionException
After calling this method, you can call foundUnknown() to determine whether any guard expressions were found in the specified transition list that referred to input ports that are not currently known.
transitionList
- A list of transitions.preemptive
- True to consider only preemptive transitions,
false to consider only non-preemptive transitions.immediateOnly
- True to consider only immediate transitions,
false to consider both immediate and non-immediate transitions.IllegalActionException
- If the guard expression of any
transition can not be evaluated.public void exportSubmodel(java.io.Writer output, int depth, java.lang.String name) throws java.io.IOException
output
- The output stream to write to.depth
- The depth in the hierarchy, to determine indenting.name
- The name to use in the exported MoML.java.io.IOException
- If an I/O error occurs.public void fire() throws IllegalActionException
fire
in interface Executable
IllegalActionException
- If there is more than one
transition enabled.public boolean foundUnknown()
enabledTransitions(List, boolean, boolean)
,
call this method to see whether there were guard expressions
in the specified list that could not be evaluated. After
calling
_chooseTransitions(List, boolean, boolean, boolean, boolean)
,
call this to determine whether any guard expressions or output
value expressions on a transition whose guard evaluates to
true were found in the specified transition list that referred
to input ports that are not currently known.public CausalityInterface getCausalityInterface()
FSMCausalityInterface
if the enclosing director
returns true in its implementsStrictActorSemantics() method.
Otherwise, it returns an interface of class
DefaultCausalityInterface
.getCausalityInterface
in interface Actor
public Entity getContext()
getContext
in interface ExplicitChangeContext
public Director getDirector()
getDirector
in interface Actor
public Director getExecutiveDirector()
getExecutiveDirector
in interface Actor
public State getInitialState() throws IllegalActionException
IllegalActionException
- If this actor does not contain
a state with the specified name.@Deprecated public Transition getLastChosenTransition()
getLastChosenTransitions()
instead.setLastChosenTransition(Transition)
public java.util.Map<State,Transition> getLastChosenTransitions()
addChosenTransition(State,Transition)
public java.util.List<Transition> getLastTakenTransitions()
setLastChosenTransition(Transition)
public Manager getManager()
getManager
in interface Actor
public java.util.List getModifiedVariables() throws IllegalActionException
getModifiedVariables
in interface ExplicitChangeContext
IllegalActionException
- If a valid destination object can not
be found.FSMDirector.getModifiedVariables()
public ParserScope getPortScope()
public boolean handleModelError(NamedObj context, IllegalActionException exception) throws IllegalActionException
handleModelError
in interface ModelErrorHandler
handleModelError
in class NamedObj
context
- The object in which the error occurred.exception
- An exception that represents the error.IllegalActionException
- If the handler handles the
error by throwing an exception.NamedObj.setModelErrorHandler(ModelErrorHandler handler)
public boolean hasInput()
public boolean hasInput(Port port)
port
- The input port.public void initialize() throws IllegalActionException
initialize
in interface Initializable
IllegalActionException
- If a derived class throws it.public java.util.List inputPortList()
inputPortList
in interface Actor
public boolean isFireFunctional()
isFireFunctional
in interface Executable
public boolean isOpaque()
isOpaque
in class CompositeEntity
CompositeEntity
public boolean isStrict() throws IllegalActionException
isStrict
in interface Executable
IllegalActionException
- Not thrown in this base class.public int iterate(int count) throws IllegalActionException
iterate
in interface Executable
count
- The number of iterations to perform.IllegalActionException
- If iterating is not
permitted, or if prefire(), fire(), or postfire() throw it.public Port newPort(java.lang.String name) throws NameDuplicationException
newPort
in class ComponentEntity
name
- The name for the new port.NameDuplicationException
- If the actor already has a port
with the specified name.public Receiver newReceiver() throws IllegalActionException
newReceiver
in interface Actor
IllegalActionException
- If there is no director.public ComponentRelation newRelation(java.lang.String name) throws IllegalActionException, NameDuplicationException
newRelation
in class CompositeEntity
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.List outputPortList()
outputPortList
in interface Actor
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
IllegalActionException
- If any action throws it.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
IllegalActionException
- Not thrown in this base class.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
IllegalActionException
- If this actor does not contain an
initial state.public void readInputs() throws IllegalActionException
IllegalActionException
- If a shadow variable cannot take
the token read from its corresponding channel (should not occur).public void readOutputsFromRefinement() throws IllegalActionException
IllegalActionException
- If a value variable cannot take
the token read from its corresponding channel.public void removeInitializable(Initializable initializable)
removeInitializable
in interface Initializable
initializable
- The object whose methods should no longer be invoked.addInitializable(Initializable)
,
CompositeActor.removePiggyback(Executable)
public void reset() throws IllegalActionException
IllegalActionException
- If thrown while
getting the initial state or setting the current connection map.@Deprecated public void setLastChosenTransition(Transition transition)
transition
- The last chosen transition.getLastChosenTransition()
public void setNewIteration(boolean newIteration)
newIteration
- A boolean variable indicating whether this is
a new iteration.public void setSupportMultirate(boolean supportMultirate)
supportMultirate
- A boolean variable indicating whether this
actor supports multirate firing.public void stop()
stop
in interface Executable
public void stopFire()
stopFire
in interface Executable
public void terminate()
terminate
in interface Executable
public java.util.Set<Inequality> typeConstraints()
typeConstraints
in interface TypedActor
Inequality
public boolean wasTransitionTaken()
public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
IllegalActionException
- Not thrown in this base class.protected void _addEntity(ComponentEntity entity) throws IllegalActionException, NameDuplicationException
_addEntity
in class CompositeEntity
entity
- State to contain.IllegalActionException
- If the state has no name, or the
action would result in a recursive containment structure, or the
argument is not an instance of State.NameDuplicationException
- If the name collides with a name
already on the state list.protected void _addRelation(ComponentRelation relation) throws IllegalActionException, NameDuplicationException
_addRelation
in class CompositeEntity
relation
- Transition 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.protected boolean _areAllImmediateTransitionsDisabled(State state) throws IllegalActionException
state
- The state to check for immediate transitions.IllegalActionException
- If the guard expression cannot be parsed
or if it cannot yet be evaluated.protected void _chooseTransitions(java.util.List<Transition> transitionList, boolean preemptive, boolean immediateOnly, boolean inInitialize, boolean inPreinitialize) throws IllegalActionException
transitionList
- The candidate transitions.preemptive
- True to consider only preemptive transitions,
and false to consider only non-preemptive transitions.immediateOnly
- If true, look only at immediate
transitions from the current state. Otherwise, look
at both immediate and non-immediate transitions.inInitialize
- True when this method is called
from initialize or preinitialize, in which case, firing and initializing
refinements is not allowed; note that the refinements
will be initialized by the initialize method, but this
prevents them from being initialized more than once.
This could be important if, for example, the refinement
produces an output during initialize in a domain where
outputs are consumed, such as SDF.inPreinitialize
- True if this is being called in
preinitialize. Outputs must not be produced in preinitialize,
so we don't execute output actions if this argument is true.IllegalActionException
- If something goes wrong.protected State _destinationState() throws IllegalActionException
IllegalActionException
- If no controller is found.protected int _getChannelForIdentifier(java.lang.String identifier) throws IllegalActionException
identifier
- An identifier.IllegalActionException
- If getting the width of the port fails.protected IOPort _getPortForIdentifier(java.lang.String identifier) throws IllegalActionException
identifier
- The specified identifier.IllegalActionException
- If getting the width of the port fails.protected java.util.List<Actor> _getStateRefinementsToPostfire()
protected java.util.List<Actor> _getTransitionRefinementsToPostfire()
protected void _initializeRefinements(State state) throws IllegalActionException
state
- The state.IllegalActionException
- If initialization fails.protected boolean _isRefinementOutput(IOPort port, int channel) throws IllegalActionException
port
- An input port of this actor.channel
- A channel of the input port.IllegalActionException
- If the refinement specified for
one of the states is not valid.protected boolean _isSafeToClear(IOPort port, int channel, State state, boolean immediateOnly, java.util.HashSet<State> visitedStates) throws IllegalActionException
The way this works is that it examines all the outgoing transitions of the current state. If the guard on the transition can be evaluated to false, then as far as this transition is concerned, the output port can be absent. Otherwise, two things happen. First, we check to see whether the output actions of a transition writes to the specified port. Second, we look at the destination state of the transition and examine all immediate transition emanating from that state. If none of the transitions makes an assignment to the output port, then we can safely assert that the output is absent, with one exception. If the output port already has a value, that value was probably set by another refinement. Thus, we should leave it alone.
This method ignores any state refinements, and consequently its analysis is valid only if all state refinements also assert that the output is absent.
port
- The IOPort in question.channel
- The channel in question.state
- The state whose transitions are examined.immediateOnly
- True to examine only immediate transitions.visitedStates
- The set of states already visited, or null
if none have yet been visited.IllegalActionException
- If we cannot determine whether
the port is known and absent.protected void _readInputs(IOPort port, int channel) throws IllegalActionException
port
- An input port of this actor.channel
- A channel of the input port.IllegalActionException
- If the port is not contained by
this actor.protected void _setCurrentConnectionMap() throws IllegalActionException
IllegalActionException
- If the refinement specified
for one of the states is not valid.protected void _setTimeForRefinement(Actor refinement) throws IllegalActionException
refinement
- The refinement.IllegalActionException
- If setModelTime() throws it.protected boolean _schedule(NamedObj actor, Time timestamp) throws IllegalActionException
actor
- The actor.timestamp
- The time the actor requests to be scheduled.IllegalActionException
- Thrown if parameters cannot be read, actor cannot be
scheduled or container cannot be fired at future time.protected void _init()