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

io.deephaven.api.agg.Aggregations Maven / Gradle / Ivy

The newest version!
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.api.agg;

import io.deephaven.annotations.BuildableStyle;
import org.immutables.value.Value.Check;
import org.immutables.value.Value.Immutable;
import org.immutables.value.Value.Parameter;

import java.util.List;

/**
 * Aggregations is an {@link Aggregation} that is a collection of two or more {@link Aggregation aggregations}.
 */
@Immutable
@BuildableStyle
public abstract class Aggregations implements Aggregation {

    public static Aggregations.Builder builder() {
        return ImmutableAggregations.builder();
    }

    public abstract List aggregations();

    @Override
    public final  V walk(V visitor) {
        visitor.visit(this);
        return visitor;
    }

    @Check
    final void checkSize() {
        if (aggregations().size() < 2) {
            throw new IllegalArgumentException(String.format("%s should have at least two aggregations, has %d",
                    Aggregations.class, aggregations().size()));
        }
    }

    public interface Builder {
        Builder addAggregations(Aggregation aggregation);

        Builder addAggregations(Aggregation... aggregations);

        Builder addAllAggregations(Iterable aggregations);

        Aggregations build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy