Contents > 8 Defining Custom Design Metrics and Rules > 8.2 Definition of Sets > 8.2.1 Projection
8.2.1 Projection
We have already seen how projections work for the definition of
metrics (Section 8.1.1 "Projection"). The definition of sets via projections
works almost the same way. For example, an element set containing the
child classes of a class can be defined as follows:
<set name="Children" domain="class">
<description>The set of children of the class.</description>
<projection relation="genparent" target="generalization"
element="genchild" eltype="class"/>
</set>
The following example defines a multiset containing the supplier
classes to which a class has a dependency link. If a class has
multiple dependency links to the same supplier class, that supplier
class will occur multiple times in the resulting set.
<set name="SuppClasses" domain="class" multiset="true">
<description>The supplier classes of which the class
is a client in a dependency.</description>
<projection relation="depclient" target="dependency"
element="depsupplier" eltype="class" />
</set>
The following attributes we know from projections for metrics (see
Section 8.1.1 "Projection") are also available for set projections:
- relation: name of the relation that contains the elements to include
in the set
- relset: a set expression defining the elements of the
set. Exactly one of the attributes relation or relset must be
specified.
- target: element type(s) of related elements
- element: for relations with an indirection, relation
links to follow
- eltype: for relations with an indirection, type(s) of
indirectly related element
- targetcondition and condition: reduce set to
elements which fulfill the specified expression
- scope: reduce set to elements which fulfill a scope
condition in relation to the element for which the set is defined
In the remainder of this section, we describe set projection
attributes that are new or have changed meanings from the metric
projection attributes.
8.2.1.1 Attribute "recurse"
8.2.1.2 Attribute "set"
8.2.1.3 Attribute "exclude_self"
8.2.1.4 Attribute "valueset"
Prev |
Up |
Next |
Section 8.2 "Definition of Sets" | Contents | Section 8.2.1.1 "Attribute "recurse"" |