Sather Home Page

Section 8.16.1.5:
$FSTRINGS

abstract class $FSTRINGS < $STRINGS

Inheritance map $IS_EQ $ELT $HASH

Formal Definitions

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 it is possible to create and manipulate strings of this kind with lower overheads than for a corresponding immutable string.


Reader/Writer Routines

This abstraction defines reader and writer routines for the feature loc - as follows :-


octets

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 : CARD
Formal Signature
octets(self : SAME) res : CARD
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.

pre true
Post-condition

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 to Keith Hopper.
Page last modified: Tuesday, 28 November 2000.
Produced with Amaya