State entry exit

Some actions may have to be executed when a state is entered and left. The element onEntry and onExit holds the actions to performs. Usually, actions done upon entering and actions done when leaving are opposite: start and stop a timer, open and close a database etc ...

In the UrlGet example, urlGet.httpStart() is called when entering the state HttpGet.

In the TrafficLight example, light.TurnOnRed() is called and the timer TimerRed is started when entering the state Red. light.TurnOffRed() is called and the timer TimerRed is stopped when leaving this state.