![]() |
Section 8.16.1.5:
|
![]() |
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 ; $FSTRINGS = set of object_type
state
multi : $FSTRINGS inv multi_types == forall obj in set multi_types & sub_type($FSTRINGS,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 a mutable string of any kind which may be imported or exported from/to the program environment. Because it is mutable an implementation should ensure that it is possible to create and manipulate strings of this kind with lower overheads than for a corresponding immutable string.
This abstraction defines reader and writer routines for the feature loc - as follows :-
pre locn <= size(self)
This feature provides the facility to determine how many storage octets are occupied by the string, irrespective of kind or size of string element.
octets(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 vacuous pre-condition - true.
This post-condition is much weaker than that for the size feature. This arises from the necessarily implementation-defined (possibly even dynamic) relation between element count and storage octets occupied.
post res >= card dom self
This feature returns the number of storage units (octets) occupied by the string.
![]() |
Language Index | ![]() |
Library Index | ![]() |
String Index |
Comments
or enquiries should be made toKeith Hopper. Page last modified: Sunday, 25 March 2001. |
![]() |