Prev - Next - Down | SDMetrics - the UML design measurement tool |

Contents > 8 Defining Custom Design Metrics and Rules > 8.5 Expression Terms > 8.5.3 Set Expressions

- A+B: the union of A and B.

If both A and B are regular sets, the resulting set will be a regular set containing the elements that occur in A or in B or both.

If A or B is a multiset, the resulting set will be a multiset, respecting the cardinality of elements. For example, if element*e*occurs five times in multiset A, and twice in multiset B, its cardinality in the union is seven. If B is a regular set containing element*e*, the cardinality of*e*in the union is six. - A*B: the intersection of A and B.

If A or B is a regular set, the resulting set will be a regular set containing the elements that occur both in A and in B.

If both A and B are multisets, the resulting set will be a multiset, respecting the cardinality of elements. For example, if element*e*occurs five times in multiset A, and twice in multiset B, its cardinality in the intersection is two. - A-B: A without B.

If A is a regular set, the resulting set will be a regular set containing all elements that occur in A but not in B.

If A is a multiset, the resulting set will be a multiset, respecting the cardinality of elements. For example, if element*e*occurs five times in multiset A, and twice in multiset B, its cardinality in the resulting set is three. If B is a regular set containing element*e*, the cardinality of*e*in the resulting set is four. -
`a`.B: set B of model element`a`.

The dot operator (see Section 8.5.2.2 "Special Operators") is also available in set expressions. The difference is that the right hand side, B, must be a set expression. Evaluating expression`a`.B for model element*e*thus works as follows:- Evaluate metric expression
`a`for model element*e*. This yields a second model element,*e'*. - Evaluate set expression B for model element
*e'*. This is the result of`a`.B. - If an error occurs during evaluation of expression
`a`or B, or if expression`a`does not yield a model element, no error is reported. Instead, a regular empty set is returned as value of`a.B`.

- Evaluate metric expression

An example for a valid set expression is ((A+B)-context.C)*D.

Prev | Up | Next |

Section 8.5.2.2 "Special Operators" | Contents | Section 8.5.4 "Condition Expressions" |