Skip to content
Snippets Groups Projects
Commit 56277099 authored by Nikolaus Huber's avatar Nikolaus Huber
Browse files

implemented switch to get the weight for a metric that has not been specified...

implemented switch to get the weight for a metric that has not been specified in the ObservationRepository but has the similar name

git-svn-id: https://se1.informatik.uni-wuerzburg.de/usvn/svn/code/code/DMM/trunk@11767 9e42b895-fcda-4063-8a3b-11be15eb1bbd
parent 8b82ee4c
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ public class WeightedSumCalculator implements IWeightingFunctionCalculator { ...@@ -51,7 +51,7 @@ public class WeightedSumCalculator implements IWeightingFunctionCalculator {
afterMetricValue.getMetricType()); afterMetricValue.getMetricType());
if (Double.isNaN(weightOfMetric)) if (Double.isNaN(weightOfMetric))
logger.info("No weight found for metric type: " + afterMetricValue.getMetricType().getName() + ", skipping..."); logger.debug("WeightingFunction "+ weightingFunction.getName()+" hos no weight specified for metric type " + afterMetricValue.getMetricType().getName() + ". Skipping...");
else { else {
// add it // add it
newWeight += weightOfMetric * delta; newWeight += weightOfMetric * delta;
......
package edu.kit.ipd.descartes.adaptation.model.dmm.util; package edu.kit.ipd.descartes.adaptation.model.dmm.util;
import org.apache.log4j.Logger;
import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.util.EcoreUtil;
...@@ -10,6 +11,8 @@ import edu.kit.ipd.descartes.perfdatarepo.MetricValue; ...@@ -10,6 +11,8 @@ import edu.kit.ipd.descartes.perfdatarepo.MetricValue;
import edu.kit.ipd.descartes.perfdatarepo.Result; import edu.kit.ipd.descartes.perfdatarepo.Result;
public class WeightingFunctionHelper { public class WeightingFunctionHelper {
static Logger logger = Logger.getLogger(WeightingFunctionHelper.class);
/** /**
* *
...@@ -24,6 +27,10 @@ public class WeightingFunctionHelper { ...@@ -24,6 +27,10 @@ public class WeightingFunctionHelper {
for (WeightedMetric weightedMetric : weightedMetrics) { for (WeightedMetric weightedMetric : weightedMetrics) {
if (EcoreUtil.equals(weightedMetric.getMetricType(), metricType)) if (EcoreUtil.equals(weightedMetric.getMetricType(), metricType))
return weightedMetric.getWeight(); return weightedMetric.getWeight();
else if (weightedMetric.getMetricType().getName().equals(metricType.getName())) {
logger.debug("Could not find identical metric, using matching name instead");
return weightedMetric.getWeight();
}
} }
return Double.NaN; return Double.NaN;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment