25.07.2014 Views

VDM-10 Language Manual

VDM-10 Language Manual

VDM-10 Language Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

✞<br />

✡✝<br />

Domain : map nat to nat | seq of (nat*nat) -> set of nat<br />

Domain(m) ==<br />

if is_(m, map nat to nat)<br />

then dom m<br />

else {d | mk_(d,-) in set elems m}<br />

✆<br />

In addition there are examples on page 27.<br />

6.18 Base Class Membership (<strong>VDM</strong>++ and <strong>VDM</strong>-RT)<br />

Syntax: expression = . . .<br />

| isofbaseclass expression<br />

| . . . ;<br />

isofbaseclass expression = ‘isofbaseclass’, ‘(’, name, expression, ‘)’ ;<br />

Semantic: The function isofbaseclass when applied to an object reference expression<br />

and a class name name yields the boolean value true if and only if name is a root superclass<br />

in the inheritance chain of the object referenced to by expression, and false otherwise.<br />

Examples: Suppose that BinarySearchTree is a subclass of Tree, Tree is not a subclass of<br />

any other class and Queue is not related by inheritance to either Tree or BinarySearchTree.<br />

Let t be an instance of textttTree, b is an instance of BinarySearchTree and q is an<br />

instance of Queue. Then:<br />

isofbaseclass(Tree, t) ≡ true<br />

isofbaseclass(BinarySearchTree, b) ≡ false<br />

isofbaseclass(Queue, q) ≡ true<br />

isofbaseclass(Tree, b) ≡ true<br />

isofbaseclass(Tree, q) ≡ false<br />

6.19 Class Membership<br />

Syntax expression = . . .<br />

| isofclass expression<br />

| . . . ;<br />

isofclass expression = ‘isofclass’, ‘(’, name, expression, ‘)’ ;<br />

Semantics: The function isofclass when applied to an object reference expression and a class<br />

name name yields the boolean value true if and only if expression refers to an object of<br />

class name or to an object of any of the subclasses of name, and false otherwise.<br />

64

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

Saved successfully!

Ooh no, something went wrong!