![]() |
Section 8.1.1.11:
|
![]() |
The following abstract type ($ELT) is the first of two with this name. The second one is $ELT{ETP}. Both are defined on this page.
This abstract class defines a state component which is a set of all instantiations of objects of any class sub-typing from this class in addition to the vdm model types used wherever this class name is used. Note that SAME has to be an instantiated class, not an abstract one.
types SAME = object_type ; $ELT = set of object_type state multi : $ELT inv multi_types == forall obj | obj in set multi_types & sub_type($ELT,obj)
NOTE | See the important note about vdm state in the notes on vdm-sl usage in this specification. |
This abstract class defines the concept of an object which contains a nnumber of other objects of an arbitrary type. It defines two features.
This feature is provided to return the count of elements in the sub-typing class.
size(self : SAME) res : CARD
Note that in contrast to a pre-condition written in Sather source code, in vdm-sl the type SAME is not an optional type and therefore self must exist, leading to the pre-condition being vacuously true.
post res = card elems self
This feature returns the count of elements in self. Note that this may be zero since, while self may exist it does not necessarily have to contain anything.
This feature yields in turn all of the values of the components of the object in an implementation-dependent order. The underlying implementation is entitled to change this order at any time, so any particular order must not be relied upon in use.
Note that this feature requirement differs from the more stringent requirement of array iterators.
Note that the formal name of the iter has been changed to replace the exclamation mark iter symbol to a name acceptable to vdm tools.
elt_iter(self : SAME) yld : $OB
Pre-condition
Note that, in contrast to a pre-condition written in Sather source code, in vdm-sl the type SAME is not an optional type and therefore self must exist, leading to the vacuous pre-condition - true.
Post-condition
This post-condition makes use of the history concept from vdm++ (see the vdm dialect notes).
post ((history~ = []) or (yld = self(card elems history~ + 1))) and (history = history~ ^ yld)
Quit condition
For quit actions see the specificatiion of the quit statement.
errs QUIT : (elems, history~ = elems self) -> quit
This iterator yields successive elements of self without duplication in any order until all have been returned, when the iterator quits.
This abstract class defines a state component which is a set of all instantiations of objects of any class sub-typing from this class in addition to the vdm model types used wherever this class name is used. Note that SAME has to be an instantiated class, not an abstract one.
types SAME = object_type ; $ELT_ETP = set of object_type state multi : $ELT_ETP inv multi_types == forall obj in set multi_types & typeof(obj) = ETP
NOTE | See the important note about vdm state in the notes on vdm-sl usage in this specification. |
This abstract class defines the concept of an object which contains a nnumber of other objects of an arbitrary type. Inheriting from $ELT, it defines only the single iterator since the size feature requirement is inherited.
This feature yields in turn all of the values of the components of the object in an implementation-dependent order. The underlying implementation is entitled to change this order at any time, so it should not be relied upon.
Note that this feature requirement differs from the more stringent requirement of array iterators.
elt! | : ETP |
Note that the formal name of the iter has been changed to replace the exclamation mark iter symbol to a name acceptable to vdm tools.
elt_iter(self : SAME) yld : ETP
Note that, in contrast to a pre-condition written in Sather source code, in vdm-sl the type SAME is not an optional type and therefore self must exist, leading to the pre-condition being vacuously true.
This post-condition makes use of the history concept from vdm++ (see the vdm dialect notes).
post ((history~ = []) or (yld = self(card elems history~ + 1))) and (history = history~ ^ yld)
Quit condition
For quit actions see the specificatiion of the quit statement.
errs QUIT : (elems history~ = elems self) -> quit
This iterator yields successive elements of self (which are of the type of the argument to this class) in any order until all have been returned when the iterator quits.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Basic Index |
Comments
or enquiries should be made toKeith Hopper. Page last modified: Thursday, 29 March 2001. |
![]() |