Exercise 2 solution
TrafficLight
arrowsOff ?
emergencyVehicle ?
xor TrafficSignals
proceed
prepareToGo
allStop
advancedLeft
extendedLeft
abstract xor Lamp
on
off
flashing
TrafficLightSystem
Lamps
LeftGreenArrow ?
RightGreenArrow ?
redAndYellowToGreen ?
allWayFlashingRedAsStop ?
allWayYellow ?
xor advancedOrExtendedLeft ?
greenFlashing
leftArrow
Let’s try it out. Again, assert certain signals and see what are the states of the lamps. E.g., when you turn all features off and assume the presence or absence of an emergencyVehicle:
|
|
Module Statistics:
|
All clafers: 32 | Abstract: 1 | Concrete: 31 | Reference: 0 | Constraints: 63 | Goals: 0 | Global scope: 1..* | Can skip name resolver: no
|
Back to linking signals and lamps.