mpv /r:ClientServer.dll ClientServer.Factory.CreateServerOnly
Figure 7.4 shows the diagram that mpv displays. The client feature was excluded
from the model program, so only a few server actions are enabled (the ones that do
not involve communication with the client).
7.2.3 Combining features
Features can be combined to model interacting features in the implementation, or
to achieve scenario control. To combine features, give some of their action methods
the same names. Action methods in classes that are not features (which are always
included in the model program) can also have the same names. All of the action
methods that have the same name are parts of the same action; they are executed
together. The combined action is enabled only when all the enabling conditions for
Systems with Finite Models 119
namespace ClientServer
{
...
static class ClientServer
{
// State variables used by all features
internal static Socket serverSocket = Socket.None;
...
}
[Feature]
static class Server
{
// Server action methods and enabling conditions
...
public static bool ServerSocketEnabled()
...
[Action]
public static void ServerSocket()
...
}
[Feature]
class Client
{
// Client action methods and enabling conditions
...
}
// Factory class, several factory methods select different features
public static class Factory
{
// No features argument in constructor, include all features
public static ModelProgram Create()
{
return new LibraryModelProgram(typeof(Factory).
Pages:
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180