Class AbstractMetric
java.lang.Object
org.somox.metrics.abstractmetrics.AbstractMetric
- All Implemented Interfaces:
IMetric
- Direct Known Subclasses:
AbstractComposedMetric,AbstractCountingMetric,AbstractHierarchyMapping,NameResemblance,SliceLayerArchitectureQuality,SubsystemComponent
Abstract base class of all metrics, contains convenience functions and basic
method implementations
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Set<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier>calculateUnion(Set<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier> classes1, Set<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier> classes2) Helper method which computes the union of two sets of GASTClassesprotected Set<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier>calculateUnion(ComponentImplementingClassesLink component1, ComponentImplementingClassesLink component2) Helper method which computes the union of the classes implementing the two componentsprotected booleancheckMetricPostCondition(ClusteringRelation relationToCompute) Method used to implement a metric postcondition.protected booleancheckMetricPreCondition(ClusteringRelation relationToCompute) Method used to implement a metric precondition.voidcomputeDirected(ClusteringRelation relationToCompute) Computes the metric for the given clustering relation and stores the value in itprotected AccessCacheGraphprotected ComponentToImplementingClassesHelperReturns the GUI launch configuration tab that can be used to configure the metric.protected IMetricHelper method used to securely retrieve a metric from a map of metricsThe parameters needed by this metric for its computation.voidinitialize(Root gastModel, SoMoXConfiguration somoxConfiguration, Map<MetricID, IMetric> allMetrics, org.jgrapht.graph.DefaultDirectedGraph<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier, ClassAccessGraphEdge> accessGraph, ComponentToImplementingClassesHelper componentToClassHelper) Initializes the Metric.protected abstract voidinternalComputeDirected(ClusteringRelation relationToCompute) Template method to be implemented by subclasses to effectively compute the metric valueabstract booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.somox.metrics.IMetric
getMID, isNormalised
-
Constructor Details
-
AbstractMetric
public AbstractMetric()
-
-
Method Details
-
computeDirected
Description copied from interface:IMetricComputes the metric for the given clustering relation and stores the value in it- Specified by:
computeDirectedin interfaceIMetric
-
getLaunchConfigurationTab
Description copied from interface:IMetricReturns the GUI launch configuration tab that can be used to configure the metric. Override if the metric supplies a tab- Specified by:
getLaunchConfigurationTabin interfaceIMetric
-
getMetricParameters
Description copied from interface:IMetricThe parameters needed by this metric for its computation. Parameters will be shown on the UI and their values will be passed to the metric during initialization of the metric- Specified by:
getMetricParametersin interfaceIMetric- Returns:
- A list of parameter descriptors for the parameters of this metric
-
isCommutative
public abstract boolean isCommutative()- Specified by:
isCommutativein interfaceIMetric- Returns:
- true if the metric gives the same result if firstComponent and secondComponent are swapped
-
initialize
public void initialize(Root gastModel, SoMoXConfiguration somoxConfiguration, Map<MetricID, IMetric> allMetrics, org.jgrapht.graph.DefaultDirectedGraph<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier, ClassAccessGraphEdge> accessGraph, ComponentToImplementingClassesHelper componentToClassHelper) Description copied from interface:IMetricInitializes the Metric. Must be called before metrics are computed. Should be called again, if the model changed- Specified by:
initializein interfaceIMetric- 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 thecomponentToClassHelper- Helper initialized graph
-
internalComputeDirected
Template method to be implemented by subclasses to effectively compute the metric value- Parameters:
relationToCompute- The relation to compute
-
checkMetricPostCondition
Method used to implement a metric postcondition. Used if Somox runs with assertions enabled and helps in debugging the metrics- Parameters:
relationToCompute- The computed metric relation- Returns:
- true if the postcondition holds
-
checkMetricPreCondition
Method used to implement a metric precondition. Used if Somox runs with assertions enabled and helps in debugging the metrics- Parameters:
relationToCompute- The computed metric relation- Returns:
- true if the precondition holds
-
getAccessGraphCache
- Returns:
- the accessGraphCache
-
getMetric
Helper method used to securely retrieve a metric from a map of metrics- Parameters:
allMetrics- Map of metrics and their IDsmetricId- ID to retrieve- Returns:
- The requested metric
-
calculateUnion
protected Set<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier> calculateUnion(Set<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier> classes1, Set<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier> classes2) Helper method which computes the union of two sets of GASTClasses- Parameters:
classes1- first setclasses2- second set- Returns:
- Union of set1 and set2
-
calculateUnion
protected Set<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier> calculateUnion(ComponentImplementingClassesLink component1, ComponentImplementingClassesLink component2) Helper method which computes the union of the classes implementing the two components- Parameters:
component1- First componentcomponent2- Second component- Returns:
- Union of all classes implementing component1 and component2
-
getComponentToClassHelper
- Returns:
- the componentToClassHelper
-