Sather Home Page

Section 8.16.1.6:
$FTEXT_STRING

This page defines two generic abstract classes named $FTEXT_STRING which have different numbers of class arguments

abstract class $FTEXT_STRING{ELT < $IS_EQ} < $FSTRINGS

Inheritance map
$FSTRINGS $IS_EQ $HASH $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 ;
$FTEXT_STRING_ELT = set of object_type

state

multi : $FTEXT_STRING_ELT
inv multi_types ==
forall obj in set multi_types & sub_type($FTEXT_STRING_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 a mutable text string as sequences of the argument class (elements) which must sub-type from $IS_EQ.


index_lib

This feature is the cultural description and coding which is associated with the string. It need not be the default culture and coding for the environment in which the program is executing, since a program may manipulate culture objects independently of local textual representations.

index_lib : LIBCHARS
Formal Signature
index_lib(self : SAME) res : LIBCHARS
Pre-condition

Since the string has to exist then so does this component. The pre-condition, therefore, is vacuously true.

Post-condition

Thie is also vacuously true, since it is a component of every string of text.

This feature provides access to all of the cultural and environment dependencies relating to this character string.


abstract class $FTEXT_STRING{ELT < $IS_EQ, STP < $TEXT_STRING{ELT},
FSTP < $FTEXT_STRING{ELT}} < $TEXT_STRING{ELT}
Inheritance map
$IS_EQ $ELT $HASH $FSTRINGS $STRINGS $FTEXT_STRING{ELT} $TEXT_STRING{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 ;
$FTEXT_STRING_ELT_FTP_STP = set of object_type

state

multi : $FTEXT_STRING_ELT_FTP_STP
inv multi_types ==
forall obj in set multi_types & sub_type($FTEXT_STRING_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 a mutable text string as a sequence of the argument class (elements) which must sub-type from $IS_EQ. The second and third class arguments are the 'corresponding' mutable ($FTEXT_STRING{ELT}) and immutable (sub-typing from $TEXT_STRING{ELT}) string classes.

build( cursor : BIN_CURSOR, lib : LIBCHARS ) : SAME ; -- This routine builds the string from the binary string indicated using -- the encoding and repertoire defined by lib. If there is not an exact -- number of character codes in the string then void is returned and the -- cursor has not been moved.

strip : SAME ; -- This routine 'strips' any number of contiguous line_marks from the -- end of self -- if present.

elt!( once start : CARD ) : ELT ; -- This iter yields the elements of self in order beginning with the -- character at the given starting index.

elt!( once start, once num : CARD ) : ELT ; -- This iter yields num elements of the string in sequence, starting with -- the one indexed by start.

code! : CHAR_CODE ; -- This iter yields each individual character encoding in self -- in sequence.

code!( once start_code : CARD ) : CHAR_CODE ; -- This iter yields each individual character encoding in self -- in sequence.
Language Index Library Index String Index
Comments or enquiries should be made to Keith Hopper.
Page last modified: Monday, 22 May 2000.
Produced with Amaya