Values shown are for the variables in this order: page, style, sort
The initial state is Topics, WithText, ByMostRecent
Topics
TitlesOnly
ByMostRecent
Messages
TitlesOnly
ByMostRecent
SelectMessages()
Topics
WithText
ByMostRecent
ShowText()
Topics
TitlesOnly
ByFirst
SortByFirst() SelectTopics() ShowTitles()
Messages
WithText
ByMostRecent
SelectMessages()SelectTopics()
Topics
WithText
ByFirst
Messages
WithText
ByFirst
SelectMessages()
ShowTitles()
SelectTopics()
SortByMostRecent()
ShowText()
Messages
TitlesOnly
ByFirst
SelectMessages() SelectTopics()
Figure 6.2. Newsreader true FSM: state transition diagram.
Compare the state transition table (Table 6.2) to the model program (Chapter 5,
Figures 5.4 and 5.5). Notice that there is a row in the table for each action in the
program, and notice how the current state and the next state entries in the table
correspond to the enabling conditions and action methods in the program, respectively.
In fact, we wrote the state transition table first, and coded the model program
from it. This is often an effective way to design and code a model program that has
a small number of states and actions.
Systems with Finite Models 99
Model programs need not have a small number of states and actions. State variables
can be numbers, strings, objects, or other data types that can have a great many
values.
Pages:
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150