Package ptolemy.domains.metroII.kernel
Class BlockingFire
- java.lang.Object
-
- ptolemy.domains.metroII.kernel.FireMachine
-
- ptolemy.domains.metroII.kernel.BlockingFire
-
- All Implemented Interfaces:
StartOrResumable
public class BlockingFire extends FireMachine
BlockingFire is a wrapper for Ptolemy actors to adapt to MetroII semantics. It provides an implementation of the state transitions for the abstract wrapper FireMachine (@see FireMachine), which wraps an actor with a set of FSM interfaces so that the actor can be seen as a FSM from outside. In particular, startOrResume(event_list) is the function that reacts to the MetroII events that trigger the FSM.The FireMachine has the following states. Each represents a state of the wrapped actor:
- START: initial state.
- BEGIN: the actor is not fired.
- END: the actor is fired.
- FINAL: final state.
And each of the states BEGIN and END is associated with a 'state event', which is the full name of the actor without model name plus one of the following suffixes:
- FIRE_BEGIN
- FIRE_END
For example, 'Ramp' is the name of a top level actor in a model 'Test'. The full actor name is 'Test.Ramp'. The MetroII state event associated with the state BEGIN of the actor is 'Ramp.FIRE_BEGIN'.
Neither START nor FINAL is associated with any state event.
To understand the transition table of the FSM,
startOrResume(LinkedList)
.- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Liangpeng Guo
- Pt.AcceptedRating:
- Red (glp)
- Pt.ProposedRating:
- Red (glp)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.domains.metroII.kernel.FireMachine
FireMachine.State
-
-
Constructor Summary
Constructors Constructor Description BlockingFire(Actor actor)
Construct a basic wrapper and wrap the input actor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
startOrResume(java.util.LinkedList<metroIIcomm.Event.Builder> metroIIEventList)
When startOrResume(eventList) is called, the wrapper checks if the MetroII event associated with the current state is changed to NOTIFIED.-
Methods inherited from class ptolemy.domains.metroII.kernel.FireMachine
actor, getState, getStateEvent, proposeStateEvent, reset, setState, wrapup
-
-
-
-
Constructor Detail
-
BlockingFire
public BlockingFire(Actor actor)
Construct a basic wrapper and wrap the input actor.- Parameters:
actor
- the actor to be wrapped.
-
-
Method Detail
-
startOrResume
public void startOrResume(java.util.LinkedList<metroIIcomm.Event.Builder> metroIIEventList) throws IllegalActionException
When startOrResume(eventList) is called, the wrapper checks if the MetroII event associated with the current state is changed to NOTIFIED. If the event is notified, call related function of the wrapped actor, transition to the next state, clear eventList and add the MetroII event associated with the state to eventList (referred to as propose events). If the state is associated with no state event, eventList is an empty list. The 'next' state is defined as follows: STAR -> BEGIN -> END -> FINAL. For example,action: propose FIRE_BEGIN START ---------------------------------------> BEGIN guard: FIRE_BEGIN is notified action: call fire(), propose FIRE_END BEGIN ---------------------------------------> FIRE_END guard: FIRE_BEGIN is not notified action: propose FIRE_BEGIN BEGIN ---------------------------------------> BEGIN
- Parameters:
metroIIEventList
- a list of MetroII events that are proposed. It is set by startOrResume() not the caller.- Throws:
IllegalActionException
- If the wrapped actor is in an illegal state or any called method throws it.
-
-