7.7.2.11. Module axivion.style.metric¶
Base classes for metric rules.
Classes¶
|
|
|
Accessor for an attribute of an element of an RFG. |
MetricBase¶
- class axivion.style.metric.MetricBase(rulename, *, rule_config=None, **kwargs)¶
Bases:
BasicRFGMetricBase,ABC- Parameters:
rulename (
str)rule_config (
typing.Optional[axivion.analysis.RuleConfiguration])kwargs (
typing.Any)
- propagate: bool = True¶
Propagate and aggregate the metric values (leaf values) up through the hierarchy view.
- report_propagated_values: ReportPropagatedMetricValues = 'root'¶
Report propagated metric values. ‘no’: Don’t report (only store in RFG). ‘root’: Report value at hierarchy root node. ‘all’: Report all propagated values.
- hierarchy_view_name: str | None = None¶
Name of the hierarchy view used to propagate the metric values. If None, a view is chosen based on the base_view and the available views in the rfg.
- hierarchy_edge_name: str = 'Belongs_To'¶
Name of the edge used to traverse the hierarchy view.
- get_hierarchy_edge_name()¶
Gets the name of the edge used to traverse the hierarchy view.
- Return type:
str
- is_propagate()¶
Return True if propagation is enabled for this metric.
- Return type:
bool
- get_report_propagated_values()¶
Get the report level for propagated metric values.
‘no’: Don’t report (only store in RFG). ‘root’: Report value at hierarchy root node. ‘all’: Report all propagated values.
- Return type:
axivion.style.metric_conf.ReportPropagatedMetricValues
- create_propagation_strategies()¶
Creates the strategies to propagate the metric values along the hierarchy view, none if propagation is disabled.
- Return type:
typing.Iterable[axivion.style.propagation_strategy.AbstractPropagationStrategy]
RfgMetricStore¶
- class axivion.style.metric.RfgMetricStore(rfg_node, rfg_metric_desc)¶
Bases:
objectAccessor for an attribute of an element of an RFG. It contains an RFG element and an attribute. So the value of the attribute can be accessed easily with this store.
- get_value()¶
Gets the value of the attribute.
- Return type:
typing.Union[float,int,str,bool]
- set_value(new_value)¶
Sets the value of the attribute.
- Parameters:
new_value (
typing.Union[float,int,str,bool])- Return type:
None
- has_value()¶
Whether the element has a value for the attribute.
- Return type:
bool