Java Reference
In-Depth Information
Table 9.3 List of event subscriptions
Event
Broadcaster
Listener
WORKDONE
Drill
Drill, AGV
FULL
Drill
Inventory
NOTFULL
Drill
Inventory
WORKDONE
Cutter
Cutter, AGV
FULL
Cutter
Inventory
NOTFULL
Cutter
Inventory
WORKDONE
Assembler
Assembler
EMPTY
Assembler
Inventory
NOTEMPTY
Assembler
Inventory
ARRIVED
AGV
AGV
UNLOADED
AGV
AGV, Drill, Cutter
LOADED
AGV
AGV, Assembler
UNLOADED
Inventory
Inventory, Assembler
LOADED
Inventory
Inventory, Drill, Cutter
Interactions occur as exchanges of events between two or more sub-
systems. Each subsystem can play two roles: that of event broadcaster or
event listener. The event broadcaster raises an event at random time
instants (e.g. the inventory system generates a new raw piece for the drill
machine) or owing to a state transition (e.g. the drill notifies the completion
of its current operation). One or more subsystems might be listening to
events. For example, the automated inventory system is listening to the
events raised by the drill in order to know when its input buffer gets full or
starts getting empty.
Subsystems might play both roles simultaneously. In particular, a sub-
system might be listening to events raised by itself. For example, the drill
raises the WORKDONE event when the current operation gets completed.
The same event triggers a state transition that starts a new operation.
9.5.2
Design
The work cell subsystems are specializations of class DiscreteProcess (see
Figure 9.11). Every subclass needs to redefine the notifyEvent() method in
order to implement the state transitions of the corresponding finite state
automaton.
Decision point
How do we implement finite state automata?
Sidebar 5.2 (see page 99) describes a procedure to translate a subset of
UML statecharts into Java code. It consists of a sequence of steps starting
 
Search WWH ::




Custom Search