UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory UML Weekend Crash Course™ - To Parent Directory

crnarupa.singidunum.ac.rs
from crnarupa.singidunum.ac.rs More from this publisher
01.01.2015 Views

SESSION 22 Modeling the Extended Features of the Statechart Session Checklist ✔ Explaining the various transition event types ✔ Explaining superstates and substates So far you’ve learned that events trigger transitions between states. Events come in a variety of forms, however. Clarifying at least five different event types, so that you know what to look for when you evaluate the problem statement, will be worth the time. In this section, I cover call events, time events, change events, send events, and guard conditions. I also explain how you can make these events conditional. Modeling Transition Events Figure 22-1 illustrates the Statechart diagram for an Order object. The Order is created in the initial state of Tentative. Two events could cause it to change to the Placed state. From Placed it may either be cancelled, or packed and made ready for shipping. After it is packed, it may be shipped. Then, whether it was cancelled or shipped, the Order is archived after 90 days.

228 Sunday Morning receivePmt(amt)[amt not < amt_due]/ placeOrder() Tentative authorizeOverride(mgr)/ placeOrder() Placed On entry/issueConf() Cancelled cancel(datetime) packed(packer)/ setPacked() Packaged after 3 days/upgradeShippingPriority() when today < (last update +90 days)/ setArchived() shipped(carrier, datetime)/ setShipped(), Customer.notify(Shipment, Order) Shipped Figure 22-1 when today < (last update + 90 days)/ setArchived() The Statechart for a typical Order object Call event A call event is the most common event type. It is basically the invocation of an operation on the receiving object. This type of event is the merge of an event and an event action. The event itself is an instruction to perform an operation. However, this doesn’t prevent you from adding other actions. Figure 22-2 shows the transition from Placed to Cancelled. The transition is triggered by the cancel(datetime) event. “cancel(datetime)” is actually the operation signature on the Order.

SESSION<br />

22<br />

Modeling the Extended<br />

Features of the Statechart<br />

Session Checklist<br />

✔ Explaining the various transition event types<br />

✔ Explaining superstates and substates<br />

So far you’ve learned that events trigger transitions between states. Events come in a<br />

variety of forms, however. Clarifying at least five different event types, so that you<br />

know what to look for when you evaluate the problem statement, will be worth the<br />

time. In this section, I cover call events, time events, change events, send events, and guard<br />

conditions. I also explain how you can make these events conditional.<br />

Modeling Transition Events<br />

Figure 22-1 illustrates the Statechart diagram for an Order object. The Order is created in<br />

the initial state of Tentative. Two events could cause it to change to the Placed state. From<br />

Placed it may either be cancelled, or packed and made ready for shipping. After it is packed,<br />

it may be shipped. Then, whether it was cancelled or shipped, the Order is archived after<br />

90 days.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!