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

org.vertexium.query.AggregationResult Maven / Gradle / Ivy

There is a newer version: 4.10.0
Show newest version
package org.vertexium.query;

import org.vertexium.VertexiumException;

import java.util.ArrayList;

public abstract class AggregationResult {
    public static  TResult createEmptyResult(Class resultType) {
        if (resultType.equals(TermsResult.class)) {
            return resultType.cast(new TermsResult(new ArrayList<>()));
        }
        if (resultType.equals(StatisticsResult.class)) {
            return resultType.cast(new StatisticsResult(0, 0.0, 0.0, 0.0, 0.0));
        }
        if (resultType.equals(HistogramResult.class)) {
            return resultType.cast(new HistogramResult(new ArrayList<>()));
        }
        if (resultType.equals(RangeResult.class)) {
            return resultType.cast(new RangeResult(new ArrayList<>()));
        }
        if (resultType.equals(PercentilesResult.class)) {
            return resultType.cast(new PercentilesResult(new ArrayList<>()));
        }
        if (resultType.equals(GeohashResult.class)) {
            return resultType.cast(new GeohashResult(new ArrayList<>()));
        }
        if (resultType.equals(CardinalityResult.class)) {
            return resultType.cast(new CardinalityResult(0));
        }
        throw new VertexiumException("Unhandled type to create empty results for: " + resultType.getName());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy