), and they are alwayes
called with the same arguments (the tools ensure this). An enabling condition may
have fewer parameters than its action method. An enabling condition may use its
parameters, as well as the state variables, to compute its return value.
An action method may have more than one enabling condition by overloading
(they have the same name but different parameters). All of the enabling conditions
must be true to enable the action. A static enabling condition method may be used
for an instance-based action method (Chapter 15).
An enabling condition must be a pure method: it can only return true or false; it
must not have any side effects that update state variables or parameters. An enabling
condition can include calls to helper methods, provided that those methods are also
pure.
You can code the enabling conditions of several action methods such that more
than one action is enabled in some states. For example, in our initial state both
SelectMessages and ShowTitles are enabled. This is typical. Our model program
exhibits nondeterminism: it is not possible to predict (from the model program itself)
which of the enabled actions will be invoked. Any enabled action can be chosen at
run time by the tool that executes the model program. A model program that exhibits
70 Model Programs
[Test]
[Category("AllowedRun")]
public void AllowedRun()
{
Assert.
Pages:
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114