The NModel framework includes several families of compound values as built-in
types. These are documented in Appendix A and in the NModel package itself.
These types are used frequently in software models. In the following sections, we
will describe these built-in types for sets, maps, sequences, bags, pairs, and triples.
All of these built-in types are immutable value types, like the string type. If you
can program using strings, you should be able to master the modeling collection
types.
10.3.1 Sets
A set is an unordered collection of distinct elements. Sets are immutable values but
you can construct new sets by operations such as union and intersection, just as you
can construct .NET string values by concatenation. Appendix A.2.2 provides a list
of set operations provided by the NModel library.
You will find that sets, which are unordered, are preferable to ordered sequences
in many modeling examples because they reduce the number of states that must be
considered for design analysis and testing. States that use sets are more abstract than
states that use ordered data structures like sequences.
Two sets that contain the same elements are equal, regardless of the order in
which their elements were added. Sequences, on the other hand, are not equal if
their elements appear in different orders.
For example, consider a network model where there are some clients communicating
with a server.
Pages:
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227