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

io.keen.client.java.result.MultiAnalysisResult Maven / Gradle / Ivy

There is a newer version: 6.0.0
Show newest version
package io.keen.client.java.result;

import java.util.Collections;
import java.util.Map;

/**
 * Represents a mapping of sub-analysis labels, as specified in a MultiAnalysis, to QueryResults.
 *
 * @author masojus
 */
public class MultiAnalysisResult extends QueryResult {
    private final Map analysesResults;

    /**
     * Constructs a MultiAnalysisResult to hold the given mapping of labels to results.
     *
     * @param analysesResults The map of sub-analysis labels to results.
     */
    public MultiAnalysisResult(Map analysesResults) {
        this.analysesResults = Collections.unmodifiableMap(analysesResults);
    }

    /**
     * Provides the result for a sub-analysis.
     *
     * @param subAnalysisLabel The label that was assigned to this sub-analysis in the
     *                         MultiAnalysis request.
     * @return The result of the given sub-analysis.
     */
    public QueryResult getResultFor(String subAnalysisLabel) {
        if (!this.analysesResults.containsKey(subAnalysisLabel)) {
            throw new IllegalArgumentException("No results for a sub-analysis with that label.");
        }

        return this.analysesResults.get(subAnalysisLabel);
    }

    /**
     * Provides the mapping of all results.
     *
     * @return An unmodifiable mapping of all sub-analysis labels to results.
     */
    public Map getAllResults() {
        return this.analysesResults;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy