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

public abstract class AbstractHierarchyMapping<T> extends AbstractMetric
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
  • Constructor Details

    • AbstractHierarchyMapping

      public AbstractHierarchyMapping()
  • Method Details

    • isCommutative

      public boolean isCommutative()
      Specified by:
      isCommutative in interface IMetric
      Specified by:
      isCommutative in class AbstractMetric
      Returns:
      true if the metric gives the same result if firstComponent and secondComponent are swapped
    • internalComputeDirected

      protected void internalComputeDirected(ClusteringRelation relationToCompute)
      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 class AbstractMetric
      Parameters:
      relationToCompute - The relation to compute
    • getPath

      protected abstract T getPath(tools.mdsd.jamopp.model.java.types.Type clazz)
      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

      protected abstract T getPath(T element)
      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.