- 18.01 (released) ...
Metric Definition Panel
In the metric definition panel, you can do the following:
- Manage user-defined metrics, such as defining new metrics and modify or remove existing ones. Metrics with a small lock in their icons are predefined metrics which cannot be changed or remvoed
- Import metrics from other systems
- Backup user-defined metrics
The following figure shows the layout of the metric definition panel:
Let's have a look at the buttons in the main toolbar which is highlighted in the following figure:
New metricUse this button to create a new metric. First you need to select a metric type (basic, linear or ratio) and then you may need to select a unit (only for basic and linear metrics). Once a metric is created, its unit cannot be changed.
Clone selected metric to a new metricIf you want to define a new metric but the new metric is quite similar to an existing one, then you can use this button to simplify your work: just clone an existing one and do the modifications.
Open user-defined metric file in external editorMetrics are stored in XML format, and this button opens the XML file of user-defined metrics in a an external editor which can be specified in the preferences.
Reload metricsThis button reloads all metrics including predefined and user-defined metrics. It's useful when you modify the metric XML file in an external editor and want the changes to have an effect without restarting EiffelStudio.
Define New Metrics
To define a new metric, you need to choose the metric type and unit (for basic metric and linear metric). The following figure shows how to choose metric type and unit:
The following figure shows a new basic class metric:
When defining basic metrics, you can press
Space in a cell in the criterion column (the first column in "definition" area) to get a list of all applicable criteria. You can also type "and" or "or" in that cell to get criterion connectors. And you can put "not" in front of a criterion name to get its negation. After typing the criterion name and hitting enter, if the criterion needs further setup, the property cell of that criterion will be highlighted. For domain criterion such as ancestor_is, caller_is, you can pick an item and drop it into this property cell.
The following figure shows a new linear feature metric:
For every metric referenced in a linear metric, you need to specify a coefficient. You can pick a metric and drop it into a cell of the "Metrics" column in the "Metric Definition" area.
The following figure shows a new ratio metric:
For the numerator or denominator metric, you need to specify a coefficient. When the denominator part evaluates to zero, the result of the ratio metric will be "Undefined". You can pick a metric and drop it into the numerator or denominator metric area.
In order to reuse metrics defined in a different system, you need to import them into current system. The following figure shows how to import metrics:
Backup User-defined Metrics
The following figure shows how to back user-defined metrics: