Contents > 8 Defining Custom Design Metrics and Rules > 8.2 Definition of Sets > 8.2.1 Projection > 8.2.1.2 Attribute "set"
8.2.1.2 Attribute "set"
The set attribute is the set counterpart of the sum
attribute for metrics. If you specify a set expression using the
set attribute, the set expression is evaluated for each
element in the projection, and the union over all these sets is
taken.
In the following example, we assume we have defined two sets for
classes:
- "AssCls" - the set of classes that have an association with the
given class
- "DepCls" - the set of class that have a dependency (client or
supplier) with the given class
We can then define, for a package, the set of classes that have an
association or dependency link with a class in the package:
<set name="AssCls" domain="package">
<projection relation="context" target="class"
set="AssCls+DepCls" />
</set>
The sets referenced in the set expression may be either all
element sets, or all value sets (see also Section 8.2.1.4 "Attribute "valueset""). The
resulting set will be of the same type as the constituent sets.
Prev |
Up |
Next |
Section 8.2.1.1 "Attribute "recurse"" | Contents | Section 8.2.1.3 "Attribute "exclude_self"" |