# Section 8.16.1.5:
$FSTRING

This page contains the definition of the two generic $FSTRING abstract classes.

###### abstract class $FSTRING{ELT < $IS_EQ} < $FSTRINGS

#### 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 ;
$FSTRING_ELT = set of object_type
state
multi : $FSTRING_ELT
inv multi_types ==
forall obj in set multi_types & sub_type($FSTRING_ELT,obj)

NOTE | See the important note about vdm state in the notes on vdm-sl usage in this specification.

This abstract class characterises the concept of all forms of mutable string whether binary, text or other as sequences of the argument class (elements) which must sub-type from $IS_EQ.

###### abstract class $FSTRING{ELT < $IS_EQ, STP < $STRING{ELT}, FSTP < $FSTRING{ELT}}
< $FSTRING{ELT}, $BINARY, $ELT{ELT}

#### 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 ;
$FSTRING_ELT_FTP_STP = set of object_type
state
multi : $FSTRING_ELT_FTP_STP
inv multi_types ==
forall obj in set multi_types & sub_type($FSTRING_ELT_FTP_STP,obj)

NOTE | See the important note about vdm state in the notes on vdm-sl usage in this specification.

This abstract class characterises the concept of mutable non-text strings as sequences of the argument class (elements) which must sub-type from $IS_EQ. The second and third class arguments are the 'corresponding' mutable ($FSTRINGS{ELT}) and immutable (sub-typing from this abstract class) string classes.

acopy( str : STP ) ; -- This is a bit-pattern copy of str into self.
acopy( fstr : FSTP ) ; -- This is a bit-pattern copy of the 'fast' string fstr into self.
acopyn( str : STP, cnt : CARD ) ; -- This is a bit-pattern copy of cnt elements from str into self.
acopyn( fstr : FSTP, cnt : CARD ) ; -- This is a bit-pattern copy of cnt elements from the 'fast' string -- fstr into self.
acopy( beg : CARD, src : STP ) ; -- This routine copies from src to self beginning at the element beg.
acopy( beg : CARD, src : FSTP ) ; -- This routine copies elements from the 'fast' string fsrc to self -- beginning at the element beg.
index_of( val : ELT ) : CARD ; -- This routine returns the index of the first element (from the -- beginning) which contains the given value - or CARD::maxval if not found.
push( elem : ELT ) : SAME ; -- This routine adds another element to the end of self and then returns -- self. If self is void, it creates a new list.
plus( fstr : FSTP ) : SAME ; -- This routine appends the string fstr to self and then returns self.
plus( str : STP ) : SAME ; -- This routine appends the string fstr to self and returns it.
plus( elem : ELT ) : SAME ; -- This routine appends the element elem to self and returns self.
clear ; -- This routine sets self to be the empty string.
ind! : CARD ; -- This iter yields allof the indices of string elements in turn.
elt! : ELT ; -- This iter yields every element of the string in sequence in an -- implemementation-dependent order.

| Language Index |  | Library Index |  | String Index

Comments or enquiries should be made to Keith Hopper . Page last modified: Thursday, 20 July 2000. |