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 233 control is shown by a single transition divided into multiple arrows pointing to multiple states or substates. The divide is accomplished with the fork bar you used in the Activity diagram and is illustrated in Figure 22-8. Merge of control can be modeled as multiple transition arrows pointing to a synchronization bar, as you saw earlier in learning about the Activity diagram. Synchronization is not shown in Figure 22-8. when temperature received(temperature) [temperature>76F]/ ^AirConditioner.turnOn() Cooling after tempdelay(seconds) ^Thermometer.getTemperature() Monitor Cooling Monitor Device Exit:^AirConditioner.turnOff() Figure 22-8 Split of control Concurrency By allowing multiple Statecharts within a state, the UML supports concurrency within a state. To model concurrency, simply split the superstate internal transition compartment into as many separate compartments as needed, one for each sub-Statechart. In the thermostat example, the Thermostat is doing two jobs at the same time: monitoring the cooling device and watching for problems with the device. So the Cooling state internal transition compartment is split in two by a line. Note that in this particular example each substate provides a different transition out of the superstate. The Monitor Cooling substate is watching for the event “when temperature received(temperature) [temperature < 70].” If it receives this event, it takes the Thermostat out of the Cooling state and back to monitoring the temperature. So what happens to the other substate Well, this hits on the definition of substate. A substate is a state within a state — in this case, Monitor Device within Cooling. If the Thermostat leaves the Cooling state, by definition it also leaves the Monitor Device state. This is illustrated in Figure 22-9. The same is true if the Monitor Device state receives the event it is waiting for.

234 Sunday Morning Monitor when temperature received(temperature) [temperature>76F]/ ^AirConditioner.turnOn() Cooling after tempdelay(seconds) ^Thermometer.getTemperature() when temperature received(temperature) [temperature

234<br />

Sunday Morning<br />

Monitor<br />

when temperature received(temperature)<br />

[temperature>76F]/<br />

^AirConditioner.turnOn()<br />

Cooling<br />

after tempdelay(seconds)<br />

^Thermometer.getTemperature()<br />

when temperature received(temperature)<br />

[temperature

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

Saved successfully!

Ooh no, something went wrong!