1. Newsreader scenario FSM: state transition diagram.
Figure 6.1 shows a state transition diagram for the same run. This is another way
to represent the same FSM that is shown in Table 6.1. The diagram is a picture of a
data structure called a graph, where bubbles called nodes (or vertices) are connected
by arrows called links (or arcs or edges). In a state transition diagram, the nodes
represent states. The links represent state transitions. Each is labeled by its action (a
method invocation). The diagram shows a directed graph because each link points
in one direction, from the current state to the next state. We can reconstruct the run
from the diagram by following the links. In our diagrams the initial state is usually
distinguished by shading.
It is important to understand that the effects of an action only depend on the
current state. To compute (or predict) the effects (the next state), it is not necessary
to keep track of the history leading up to the current state.
An FSM represents behavior compactly because each transition only occurs once
in the FSM, no matter how many times it occurs in the run. In a state transition
diagram, each state also appears only once. If the run reaches the same state more
than once, the diagram contains loops called cycles. In this example there are cycles
through all of the states.
6.1.1 Runs and scenarios
We generated our FSM (Table 6.
Pages:
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146