Package org.somox.metrics.naming
Class NameResemblance
java.lang.Object
org.somox.metrics.abstractmetrics.AbstractMetric
org.somox.metrics.naming.NameResemblance
- All Implemented Interfaces:
IMetric
NameResemblance metric. Counts for all
Type
s in any of the two component candidates the
similar names and divides it by the total amount of names. The names are trimmed before they are
compared, i.e., their prefixes and suffixes are removed as configured on this metric's
configuration tab.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the GUI launch configuration tab that can be used to configure the metric.getMID()
Returns the Metric ID of the Metricvoid
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
boolean
Methods inherited from class org.somox.metrics.abstractmetrics.AbstractMetric
calculateUnion, calculateUnion, checkMetricPostCondition, checkMetricPreCondition, computeDirected, getAccessGraphCache, getComponentToClassHelper, getMetric, getMetricParameters
-
Field Details
-
METRIC_ID
-
-
Constructor Details
-
NameResemblance
public NameResemblance()
-
-
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
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
-
getLaunchConfigurationTab
Returns the GUI launch configuration tab that can be used to configure the metric. Override if the metric supplies a tab- Specified by:
getLaunchConfigurationTab
in interfaceIMetric
- Overrides:
getLaunchConfigurationTab
in classAbstractMetric
-
getMID
Returns the Metric ID of the Metric- Returns:
- the metric id of the instance
-
isNormalised
public boolean isNormalised()- Returns:
- whether the metric is normalized. If it is normalized, values of this metric must be between 0.0 and 1.0.
-