Package org.somox.metrics.hierarchy
Class AbstractHierarchyMapping<T>
java.lang.Object
org.somox.metrics.abstractmetrics.AbstractMetric
org.somox.metrics.hierarchy.AbstractHierarchyMapping<T>
- All Implemented Interfaces:
IMetric
- Direct Known Subclasses:
DirectoryMapping
,PackageMapping
Unified parent of package and directory mapping. Realizes hierarchy conformance mapping metrics.
Mapping metric: Checks how well component candidates are arranged in the same or at least
comparable packages / directories.
Naming: PackageDirectory must be read as an entity: can be either package or directory at the instance level. TODO: check efficiency
Naming: PackageDirectory must be read as an entity: can be either package or directory at the instance level. TODO: check efficiency
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
getPath
(org.emftext.language.java.types.Type clazz) Return the path segment in the subclasses' meaning of hierarchy where this GAST class is directly attached to.protected abstract T
Return the parent path segment of the passed element Tprotected 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, getLaunchConfigurationTab, getMetric, getMetricParameters, initialize
-
Constructor Details
-
AbstractHierarchyMapping
public AbstractHierarchyMapping()
-
-
Method Details
-
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
-
internalComputeDirected
Template method to be implemented by subclasses to effectively compute the metric value Idea: 1) navigate to root for both elements 2) navigate down from root one individual of the both elements deviates 3) continue navigation to concrete element and memorize number of package steps. (optional) 4) map sum of deviating steps to result (improve weights with this)- Specified by:
internalComputeDirected
in classAbstractMetric
- Parameters:
relationToCompute
- The relation to compute
-
getPath
Return the path segment in the subclasses' meaning of hierarchy where this GAST class is directly attached to. For example, for the directory hierachy, return the directory in which this GAST class is located- Parameters:
clazz
- The GASTClass for which to retrieve the path segment- Returns:
- The parent of the GASTClass as defined by our subclass or null if this class is not contained in the hierarchy as defined by the subclass
-
getPath
Return the parent path segment of the passed element T- Parameters:
element
- The element (i.e. Directory or Package) for which to return the parent (i.e. parent package or parent directory)- Returns:
- The parent if the element or null if there is no parent
-
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.
-