01.01.2015 Views

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

230<br />

Sunday Morning<br />

Figure 22-4 represents the change events that cause the Order to be archived. In both<br />

cases, the Order is waiting until there has been no activity on the Order for 90 days.<br />

Cancelled<br />

when today ><br />

(last update +90 days)/<br />

setArchived()<br />

Shipped<br />

when today > (last update + 90 days)/<br />

setArchived()<br />

Figure 22-4 Change event “when today > (last update +90 days)”<br />

As a reminder, note that this event is only evaluated while the Order is either Cancelled<br />

or Shipped. The fact that the event is not drawn from the other states to archived means<br />

that the object will not test for that condition while in those states. Remember that what<br />

does not show on a Statechart tells you almost as much as what is shown on the diagram.<br />

Making events conditional<br />

A guard condition controls the response to an event. When an event occurs, the condition is<br />

tested. If the condition tests true, the corresponding transition takes place along with any<br />

and all associated actions; otherwise, the event is ignored.<br />

Figure 22-5 models one of the transitions from the Tentative state to the Placed state.<br />

The triggering event is “receivePmt(amt).” But receiving the payment will not upgrade the<br />

Order to Placed unless it was actually enough to pay for the Order. The net effect of the<br />

event is that the object acknowledges the event, evaluates the effectiveness of the event,<br />

and either accepts or rejects it based on the guard condition. If the event is rejected, the<br />

object remains unchanged.<br />

receivePmt(amt)[amt not < amt_due]/<br />

placeOrder()<br />

Tentative<br />

Placed<br />

On entry/issueConf()<br />

Figure 22-5<br />

Guard condition [amt not

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

Saved successfully!

Ooh no, something went wrong!