![]() |
Section 8.16.1.3: |
![]() |
This page contains the definition of the two generic $STRING abstract classes.
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.
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 simple string whether binary, text or other as sequences of the argument class (elements) which must sub-type from $IS_EQ. Classes which sub-type from this shall have immutable semantics!
This class defines NO features of its own.
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.
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 simple 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. Classes which sub-type from this class shall have immutable semantics!
This is the first version of the string append operation which appends another string of the same kind to self and returns the result.
plus | ( |
vals : SAME | |
) : SAME |
This feature returns a new string formed by appending the contents of other to the contents of self.
This version of the string append operation a single element to self and returns the result.
plus | ( |
val : ELT | |
) : SAME |
This feature returns a new string formed by appending the single element given to the contents of self.
This version of the string append operation takes a mutable string as argument.
plus | ( |
vals : FSTP | |
) : SAME |
This feature returns a new string formed by appending the contents of the mutable string to the contents of self.
reverse | : SAME |
Since the domain of the result is identical to the domain of self, the pre-condition is vacuously true.
This routine returns a new string which has the same contents as self with all elements in the reverse order.
This iter version and the one following complement the one inherited by this abstraction. This permits the first element yielded to be the element indexed by the start argument.
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.
Since the iter may quit if start is not in the domain of indices of self, the pre-condition is vacuously true.
This post-condition makes use of the history concept from vdm++ (see the vdm dialect notes).
For quit actions see the specification of the quit statement.
This iter yields the elements of self in order beginning with the element at the given starting index.
This iter version specifies both the element to yield first and the number of elements to be yielded.
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.
Since the iter may quit if start is not in the domain of indices of self, the pre-condition is vacuously true.
This post-condition makes use of the history concept from vdm++ (see the vdm dialect notes).
For quit actions see the specification of the quit statement.
This iter yields num elements of self in order beginning with the element at the given starting index.
This iter yields provides a substring sequence facility, the lengths of each dependent on the argument at each invocation. Note that the last iteration before quitting will yield the sub-sequence of the size indicated or the remainder of the string, whichever is the shortest sequence.
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.
Since the iter may quit when all elements have been yielded, the pre-condition is vacuously true.
This post-condition makes use of the history concept from vdm++ (see the vdm dialect notes). Note also that the vdm sub-sequence operation yields a sub-sequence which is no longer than the range indicated if that would extend beyond the end of the sequence.
For quit actions see the specification of the quit statement.
This iter yields in sequence successive sub-sequences of self the length of each being determined by the argument.
This iter yields the character encodings of self in sequence starting at the one indicated.
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.
Since the iter may quit if start is not in the domain of indices of self, the pre-condition is vacuously true.
This post-condition makes use of the history concept from vdm++ (see the vdm dialect notes). Note also that the vdm sub-sequence operation yields a sub-sequence which is no longer than the range indicated if that would extend beyond the end of the sequence.
For quit actions see the specification of the quit statement.
This iter yields successive sub-sequences of elements of self, starting the first sub-sequence at the given index.
![]() |
Language Index | ![]() |
Library Index | ![]() |
String Index |
Comments or enquiries should be made to
Keith
Hopper. Page last modified: Monday, 26 February 2001. |
![]() |