![]() |
Section 7.2.3:
|
This pervasive class is defined as a 'constructor' class. Immutable classes which include this class must redefine asize to get a non-trivial class. This class encapsulates the concept of a value array, the components of which are themselves are of type T which must itself be an immutable class.
Together with the pervasive class BIT this is the fundamental class for the construction of objects. As with the class AREF, all feature names begin with "a" to minimize name conflicts when included in other implementation classes.
The type of numeric arguments and results in this class is given as nat in order that implementations of the language which do not need the Required Library but wish to conform to the language specification may implement this unsigned number type in some suitable way - which must be implementation-defined. Where an implementation is providing the Required Library then these values must be of class CARD.
asize | : nat |
This feature returns the number of elements of type T of which self is composed.
NOTE | The including class must define a non-zero constant value for this feature, otherwise the objects generated will be null! It is not possible to alter this value after an object has been created! |
This feature provides the default indexed value retrieval operation. See the infix expression version which uses square brackets '[' and ']' to surround the index value.
aget | ( |
index : nat | |
) : T |
This routine returns the value of the element of self which has the given index.
NOTE | The index used in the vdm application to self in the above post-condition is one greater than that used in Sather. Indices in vdm-sl are an ordinal sequence starting at 1 - in Sather indices start from 0! |
This feature is the value setting counterpart of aget above. The corresponding 'infix' assignment version using square brackets '[' and ']' is defined in the assignment statement section of this document.
aset | ( |
index : nat | |
val : T | |
) |
This routine sets the element of self indicated by the given index to val.
This feature is an iterator over the indices of the array, yielding each one in sequence from zero upwards.
aind! | : nat |
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.
This post-condition makes use of the history concept from vdm++ (see the vdm dialect notes).
For quit actions see the specificatiion of the quit statement.
This iter yields the indices of self in numeric order, starting with zero. The iter quits when applied after yielding the value of the highest index of the array.
This iter yields in sequence all of the array element values beginning with that element indexed by zero.
aelt! | : T |
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.
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 all of the elements of self in the order that they would be produced by applying the sequence of indices produced by aind! to self.
This variant of aelt! takes an argument which is evaluated on first entry to give the index of the first element to be yielded.
aelt! | ( |
once | beg : nat |
) : T |
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.
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 all of the elements of self in the order that they would be produced by applying the sequence of indices produced by aind! to self starting with the value indicated by the parameter.
This variant of aelt!, in addition to the starting index argument, takes a second argument indicating the number of element values that are to be yielded.
aelt! | ( |
once | beg : nat |
once | num : nat |
) : T |
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.
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 the order that they would be produced by applying the sequence of indices produced by aind! to self starting with the value indicated by the parameter.
This final variant of aelt! takes three arguments - the index of the first element to be yielded, the count of elements and the increment/decrement of the index value between each application.
aelt! | ( |
once | beg : nat |
once | num : nat |
once | step : int |
) : T |
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.
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 the order that they would be produced by applying the sequence of indices produced by aind! multiplied by step to self starting with the value indicated by the parameter.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Section 7 Index |
Comments
or enquiries should be made to Keith Hopper. Page last modified: Friday, 19 May 2000. |
![]() |