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

public abstract class AbstractComposedMetric extends AbstractMetric
Base class for a metric which uses other (child) metrics and a function to calculate the overall metric value.
  • 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 interface IMetric
      Overrides:
      initialize in class AbstractMetric
      Parameters:
      gastModel - the Root object of the GAST model
      somoxConfiguration - the configuration of the metric computation
      allMetrics - A map of all metrics available in the running SoMoX instance, maps metricID to Metric implementation
      accessGraph - A graph which contains the number of accesses from the source GASTClass to the target GASTClass for all edges in the
      componentToImplementingClassesHelper - Helper initialized graph
    • internalComputeDirected

      protected void internalComputeDirected(ClusteringRelation relationToCompute)
      Description copied from class: AbstractMetric
      Template method to be implemented by subclasses to effectively compute the metric value
      Specified by:
      internalComputeDirected in class AbstractMetric
      Parameters:
      relationToCompute - The relation to compute
    • 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
    • getChildMetrics

      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.
      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

      public IMetric[] getAllChildMetrics()
      Returns:
      the allChildMetrics
    • metricIDToIMetric

      protected IMetric[] metricIDToIMetric(MetricID[] metrics, Map<MetricID,IMetric> allMetrics)
      Parameters:
      metrics -
      allMetrics -
      Returns: