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 214 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

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


The NModel modeling framework includes a mechanism that makes it easy to
define custom structural types with a built-in base class called CompoundValue. This
data type is a useful building block for many kinds of data structured data values.
For example, a binary tree of integers could be defined in this way:
class IntTree : CompoundValue
{
public readonly int value;
public readonly IntTree left;
public readonly IntTree right;
public IntTree(int value, IntTree left, IntTree right)
{
this.value = value;
this.left = left;
this.right = right;
}
}
All fields of a type that derives from CompoundValue must be marked readonly.
This is because structural data types are immutable values, like strings and integers.
3 The string type isn??™t technically a value type in .NET terminology, but for simplicity we will
use that term because strings are immutable and use structural equality. We ignore the issue of
whether a value is stack-allocated.
Systems with Complex State 159
The data fields of a value are not variable locations of memory like typical instances
of class types.
Note that compound values, although they may be tree-structured, are by construction
not allowed to contain circular references.
The CompoundValue base class provides the necessary support for structural equality,
hash coding, and several other services required by the modeling framework.


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