Class AbstractComposedMetric
java.lang.Object
org.somox.metrics.abstractmetrics.AbstractMetric
org.somox.metrics.abstractmetrics.AbstractComposedMetric
- All Implemented Interfaces:
IMetric
- Direct Known Subclasses:
AbstractRatioMetric
,AbstractStepwiseMetric
,AbstractWeightedComposedMetric
,DefaultCompositionIndicatingMetric
,DefaultMergeIndicatingMetric
,DMS
,Instability
Base class for a metric which uses other (child) metrics and a function to calculate the overall
metric value.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionIMetric[]
protected abstract IMetric[]
getChildMetrics
(Map<MetricID, IMetric> allMetrics) In a subclass override this method and return the subset of metrics in allMetrics which are needed in this composed metric.protected abstract ICompositionFunction
getCompositionFunction
(SoMoXConfiguration somoxConfiguration) Return the function used to compose the set of child metricsvoid
initialize
(Root gastModel, SoMoXConfiguration somoxConfiguration, Map<MetricID, IMetric> allMetrics, org.jgrapht.DirectedGraph<org.emftext.language.java.classifiers.ConcreteClassifier, ClassAccessGraphEdge> accessGraph, ComponentToImplementingClassesHelper componentToImplementingClassesHelper) Initializes the Metric.protected void
internalComputeDirected
(ClusteringRelation relationToCompute) Template method to be implemented by subclasses to effectively compute the metric valueboolean
protected IMetric[]
metricIDToIMetric
(MetricID[] metrics, Map<MetricID, IMetric> allMetrics) Methods inherited from class org.somox.metrics.abstractmetrics.AbstractMetric
calculateUnion, calculateUnion, checkMetricPostCondition, checkMetricPreCondition, computeDirected, getAccessGraphCache, getComponentToClassHelper, getLaunchConfigurationTab, getMetric, getMetricParameters
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.somox.metrics.IMetric
getMID, isNormalised
-
Constructor Details
-
AbstractComposedMetric
public AbstractComposedMetric()
-
-
Method Details
-
initialize
public void initialize(Root gastModel, SoMoXConfiguration somoxConfiguration, Map<MetricID, IMetric> allMetrics, org.jgrapht.DirectedGraph<org.emftext.language.java.classifiers.ConcreteClassifier, ClassAccessGraphEdge> accessGraph, ComponentToImplementingClassesHelper componentToImplementingClassesHelper) Description copied from interface:IMetric
Initializes the Metric. Must be called before metrics are computed. Should be called again, if the model changed- Specified by:
initialize
in interfaceIMetric
- Overrides:
initialize
in classAbstractMetric
- Parameters:
gastModel
- the Root object of the GAST modelsomoxConfiguration
- the configuration of the metric computationallMetrics
- A map of all metrics available in the running SoMoX instance, maps metricID to Metric implementationaccessGraph
- A graph which contains the number of accesses from the source GASTClass to the target GASTClass for all edges in thecomponentToImplementingClassesHelper
- Helper initialized graph
-
internalComputeDirected
Description copied from class:AbstractMetric
Template method to be implemented by subclasses to effectively compute the metric value- Specified by:
internalComputeDirected
in classAbstractMetric
- Parameters:
relationToCompute
- The relation to compute
-
isCommutative
public boolean isCommutative()- Specified by:
isCommutative
in interfaceIMetric
- Specified by:
isCommutative
in classAbstractMetric
- Returns:
- true if the metric gives the same result if firstComponent and secondComponent are swapped
-
getChildMetrics
In a subclass override this method and return the subset of metrics in allMetrics which are needed in this composed metric.- Parameters:
allMetrics
- The set of all metrics registered in the system via the metric extension point- Returns:
- The subset of all metrics needed in this composed metric
-
getCompositionFunction
protected abstract ICompositionFunction getCompositionFunction(SoMoXConfiguration somoxConfiguration) Return the function used to compose the set of child metrics- Parameters:
somoxConfiguration
- The somox configuration object used to initialize the function- Returns:
- The function used to compute the composed metric
-
getAllChildMetrics
- Returns:
- the allChildMetrics
-
metricIDToIMetric
- Parameters:
metrics
-allMetrics
-- Returns:
-