All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.puresoltechnologies.purifinity.server.metrics.entropy.AbstractEntropyResults Maven / Gradle / Ivy

package com.puresoltechnologies.purifinity.server.metrics.entropy;

import static com.puresoltechnologies.purifinity.server.metrics.entropy.EntropyMetricEvaluatorParameter.N_DIFF;
import static com.puresoltechnologies.purifinity.server.metrics.entropy.EntropyMetricEvaluatorParameter.N_TOTAL;
import static com.puresoltechnologies.purifinity.server.metrics.entropy.EntropyMetricEvaluatorParameter.R;
import static com.puresoltechnologies.purifinity.server.metrics.entropy.EntropyMetricEvaluatorParameter.RS;
import static com.puresoltechnologies.purifinity.server.metrics.entropy.EntropyMetricEvaluatorParameter.R_NORM;
import static com.puresoltechnologies.purifinity.server.metrics.entropy.EntropyMetricEvaluatorParameter.S;
import static com.puresoltechnologies.purifinity.server.metrics.entropy.EntropyMetricEvaluatorParameter.S_MAX;
import static com.puresoltechnologies.purifinity.server.metrics.entropy.EntropyMetricEvaluatorParameter.S_NORM;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.puresoltechnologies.purifinity.evaluation.domain.metrics.AbstractMetrics;
import com.puresoltechnologies.purifinity.evaluation.domain.metrics.MetricValue;

public abstract class AbstractEntropyResults extends AbstractMetrics {

    private static final long serialVersionUID = 2241293026079625803L;

    public AbstractEntropyResults(Date time) {
	super(EntropyMetric.ID, EntropyMetric.PLUGIN_VERSION, time);
    }

    protected Map> convertToRow(EntropyResult result) {
	EntropyMetricResult entropy = result.getEntropyMetricResult();
	Map> row = new HashMap<>();
	row.put(N_DIFF.getName(), new MetricValue(entropy.getNDiff(),
		N_DIFF));

	row.put(N_TOTAL.getName(), new MetricValue(
		entropy.getNTotal(), N_TOTAL));
	row.put(S.getName(), new MetricValue(entropy.getEntropy(), S));
	row.put(S_MAX.getName(),
		new MetricValue(entropy.getMaxEntropy(), S_MAX));
	row.put(S_NORM.getName(),
		new MetricValue(entropy.getNormEntropy(), S_NORM));
	row.put(RS.getName(),
		new MetricValue(entropy.getEntropyRedundancy(), RS));
	row.put(R.getName(),
		new MetricValue(entropy.getRedundancy(), R));
	row.put(R_NORM.getName(),
		new MetricValue(entropy.getNormalizedRedundancy(),
			R_NORM));
	return row;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy