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

lu.uni.serval.ikora.smells.SmellResults Maven / Gradle / Ivy

package lu.uni.serval.ikora.smells;

import lu.uni.serval.ikora.core.model.SourceNode;

import java.util.*;

public class SmellResults implements Iterable {
    private final EnumMap results;

    public SmellResults(){
        this.results = new EnumMap<>(SmellMetric.Type.class);
    }

    public void add(SmellResult smellResult){
        this.results.put(smellResult.getType(), smellResult);
    }

    public double getRawValue(SmellMetric.Type type){
        final SmellResult smellResult = results.get(type);

        if(smellResult == null){
            return Double.NaN;
        }

        return smellResult.getRawValue();
    }

    public double getNormalizedValue(SmellMetric.Type type){
        final SmellResult smellResult = results.get(type);

        if(smellResult == null){
            return Double.NaN;
        }

        return smellResult.getNormalizedValue();
    }

    public Set getNodes(SmellMetric.Type type){
        final SmellResult smellResult = results.get(type);

        if(smellResult == null){
            return Collections.emptySet();
        }

        return smellResult.getNodes();
    }

    @Override
    public Iterator iterator() {
        return results.values().iterator();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy