Chapter 2 – Statecharts
暂无分享,去创建一个
Publisher Summary
Statecharts extend finite state machines (FSMs) with several capabilities—events and conditions; hierarchy (state nesting); concurrence, or state orthogonality; and history states. This chapter relates statecharts to the StateRoverTM tool. The StateRover is a statechart, VisioTM-based, code generator and visual debug animator. The two basic components of statecharts, like those of finite automata (FA) and FSMs are states and transitions. Code generation for flat FSMs is rather simple. The FSM's state space is coded as integers, namely every state is identified by an integer symbol. The present state (PS) is used to memorize the currently visited state. The transitions of the FSM are then coded as a switch statement. The StateRover's code generator generates a class per statechart model. This statechart class is a convenient level of encapsulation for a controller statechart that lives within a heterogeneous system of Java or C++ objects created by various tools or perhaps hand-coded. The class can then be dynamically instantiated according to the needs of the system.