These assignments are
sometimes called updates and an action method is sometimes called an update rule.
Here is the ShowTitles action method from this example. It causes the titles only
to be displayed on Topics pages by setting the style state variable to TitlesOnly.
[Action]
static void ShowTitles()
{
style = Style.TitlesOnly;
}
In addition, an action method may consume input or produce output. It is often
useful for an action method to return a value, but this is not required. An action
method may have parameters. (In this example, none of the action methods performs
input or output, returns a value, or has parameters.)
An action method can be a static method or an instance method (Chapter 15). (In
this example, they are all static.)
Action methods cannot be overloaded; each action method must have a different
name.
The action methods must all be at top level: the model program only defines
them; it cannot call them.
A model program can also contain helper methods that do not represent actions.
Any code in the model program can call a helper method. (There are no helper
methods in this example.)
5.4.4 Enabling conditions
In addition to action methods, a model program has methods that check when
each action method is enabled (allowed to be invoked). These are called enabling
Systems with Finite Models 69
conditions, preconditions, or guards.
Pages:
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112