Contents > 8 Defining Custom Design Metrics and Rules > 8.2 Definition of Sets > 8.2.1 Projection > 8.2.1.4 Attribute "valueset"

8.2.1.4 Attribute "valueset"

So far, the examples shown were element sets, containing UML model elements. With the valueset attribute, you can define value sets containing the values of metric expressions.

For example, if a metric "Signature" for operations contains the signature string of the operation, you can define the set of signatures for the operations of a class as follows:

<set name="Sigs" domain="class"> 
  <description>The set of signatures of the operations in the 
     class.</description>
  <projection relation="context" target="operation"
              valueset="Signature" />
</set>
The metric expression "Signature" is evaluated for each operation; the resulting values are stored in the set.

Attribute valueset may be used in combination with all other attributes except set or exclude_self.