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

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

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


Global version
namespace RevisionControl
{
partial static class Repository
{
public static int currentRevision = 0;
}
}
In C# the keyword partial may be used to break up a class definition into several
blocks. We use this here to indicate that blocks of code separated by explanatory
text all belong to the same class.
The state of the revision control system includes a global version number currentRevision.
This represents number of times any change has been committed to
the repository.
172 Modeling Systems with Structured State
In the code snippets that follow, we will omit for brevity the RevisionControl
namespace declaration that defines the model??™s scope, but this can be assumed.
Revision data type
In addition to the int and string data types, we will use an additional data record
to define the concept of a ???revision.???
enum Op { Add, Delete, Change }
class Revision : CompoundValue
{
public readonly Op op;
public readonly int revisionNumber;
public Revision(Op op, int revisionNumber)
{
this.op = op;
this.revisionNumber = revisionNumber;
}
}
The enumeration Op defines the kind of edit operations provided by the revision
control system. Edits may consist of adding a file, changing the contents of an existing
file, or deleting a file.
We define a new compound value type Revision that is a pair of values: an
operation and a revision number that says in which version of the repository the
change appears.


Pages:
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6