Predefined Iterator Expressions
This section defines the standard OCL iterator expressions. In the abstract
syntax these are all instances of IteratorExp. These iterator expressions
always have a collection expression as their source, as is defined in the
well-formedness rules in Chapter 8 ("Abstract Syntax"). The defined iterator
expressions are shown per source collection type. The semantics of each
iterator expression is defined through a mapping from the iterator to the
'iterate' construct. this means that the semantics of the iterator
expressions does not need to be defined seperately in the sementics sections.
Whenever a new itertor is added to the library, the mapping to the iterate
expression must be defined. If this is not done, the semantics of the new
iterator is undefined.
In all of the following OCL expressions, the lefthand side of the equals
sign is the IteratorExp to be defined, and the righthand side of
the equals sign is the equivalent as an IterateExp. The names source,
body and iterator refer to the role names in the abstract
syntax:
-
source The source expression of the IteratorExp
-
body The body expression of the IteratorExp
-
iterator The iterator variable of the IteratorExp
-
result The result variable of the IterateExp
Extending the standard library with iterator
expressions
When new iterator expressions are added to the standard library, there
mapping to existing constructs should be fully defines. If this is done,
the semantics of the new iterator expression will be defined.