25.07.2014 Views

VDM-10 Language Manual

VDM-10 Language Manual

VDM-10 Language Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>VDM</strong>-<strong>10</strong> <strong>Language</strong> <strong>Manual</strong><br />

The overall invariant expression of a class is all the invariant definitions of the class and its<br />

superclasses combined by logical and in the order that they are defined in 1) the superclasses<br />

and 2) the class itself.<br />

This operation is private, has no parameters and returns a boolean corresponding to the<br />

execution of the invariant expression.<br />

Example: The following examples show instance variable definitions. The first class specifies one<br />

instance variable:<br />

✞<br />

class GroupPhase<br />

types<br />

GroupName = | | | | | | | ;<br />

Team = ... -- as on page 24<br />

Score::team : Team<br />

won : nat<br />

drawn : nat<br />

lost : nat<br />

points : nat;<br />

instance variables<br />

gps : map GroupName to set of Score;<br />

inv forall gp in set rng gps &<br />

(card gp = 4 and<br />

forall sc in set gp & sc.won + sc.lost + sc.drawn

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!