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

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

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

import org.vertexium.Element;
import org.vertexium.util.CloseableIterable;
import org.vertexium.util.JoinIterable;

import java.io.IOException;

public class QueryResultsJoinIterable extends JoinIterable implements QueryResultsIterable {
    @SuppressWarnings("unchecked")
    public QueryResultsJoinIterable(Iterable... iterables) {
        super(iterables);
    }

    @Override
    @SuppressWarnings("unchecked")
    public  TResult getAggregationResult(String name, Class resultType) {
        for (Iterable iterable : getIterables()) {
            if (iterable instanceof QueryResultsIterable) {
                TResult aggResult = ((QueryResultsIterable) iterable).getAggregationResult(name, resultType);
                if (aggResult != null) {
                    return aggResult;
                }
            }
        }
        return AggregationResult.createEmptyResult(resultType);
    }

    @Override
    public void close() throws IOException {
        for (Iterable iterable : getIterables()) {
            if (iterable instanceof CloseableIterable) {
                ((CloseableIterable) iterable).close();
            }
        }
    }

    @Override
    public long getTotalHits() {
        long total = 0;
        for (Iterable iterable : getIterables()) {
            if (iterable instanceof IterableWithTotalHits) {
                total += ((IterableWithTotalHits) iterable).getTotalHits();
            }
        }
        return total;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy