SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 216 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

"Model-Based Software Testing and Analysis with C#"

Clients may join and leave the session at any time. If the model
of the server state uses a set to keep track of active clients, then the order in which
clients arrive will not matter. This is a useful abstraction, especially if no operations
of the system depend on the order of client entry.
static Set clients = Set.EmptySet;
[Action]
static void AddClient(string client)
{
clients = clients.Add(client);
}
160 Modeling Systems with Structured State
[Action]
static void RemoveClient(string client)
{
clients = clients.Remove(client);
}
This model program shows the basic operation of sets. The expression Set.
EmptySet is a way to denote the empty set of strings. This is analogous to the
expression string.Empty provided by the .NET framework that returns the empty
string. We say ???the??? empty string because all empty strings are equal.4 It is useful
to think that there is just one empty string value, just as there is only one value for
0 or 1. Similarly, there is just one empty set of strings.
We should point out that in the set implementation provided by NModel, the
values Set.EmptySet and Set.EmptySet are not equal. You can think
of each set as having a subscript based on the type parameter inside the angle
brackets. This is true even for subtypes: values of type Set and Set
are never equal, even if they contain the same elements.


Pages:
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6