Java Reference
In-Depth Information
WorkCell
DiscreteProcess
DiscreteClock
publisher
subscriber
Subscription
PieceSource
DiscreteEvent
String eventName
Figure 9.8 The class diagram of the first prototype
Decision point
How do we represent events?
Class EventObject has been part of the java.util package since version 1.1
of the Java 2 Platform. This is the root class of a deep hierarchy of classes for
handling event-based communication between the components of any
graphical user interface. The event model of the work cell simulator is sub-
stantially different from the event model of the java.util package. Thus, we
decide to introduce the new class DiscreteEvent , which records the following
information:
the name of the event;
the raise time;
the data associated with the event;
the name of the process that activates this event.
Decision point
How does the clock schedule events?
The clock maintains a sorted collection of events that is updated when-
ever a new event is activated. The first event is the event that will be raised
next, that is the event with the shortest time residue. The current time is
always equal to the raise time of the last fired event, which is triggered by the
user who controls the simulation. When an event is raised, the clock notifies
the event to all the subscribed processes.
Search WWH ::




Custom Search