io.deephaven.qst.column.header.ColumnHeaders6 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-qst Show documentation
Show all versions of deephaven-qst Show documentation
The Deephaven Query Syntax Tree POJOs
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.qst.column.header;
import io.deephaven.annotations.SimpleStyle;
import io.deephaven.qst.array.Array;
import io.deephaven.qst.array.ArrayBuilder;
import io.deephaven.qst.column.Column;
import io.deephaven.qst.table.NewTable;
import io.deephaven.qst.table.TableHeader;
import io.deephaven.qst.type.Type;
import org.immutables.value.Value.Immutable;
import org.immutables.value.Value.Parameter;
import java.util.Iterator;
import java.util.stream.Stream;
import static io.deephaven.qst.column.header.ColumnHeader.DEFAULT_BUILDER_INITIAL_CAPACITY;
@Immutable
@SimpleStyle
public abstract class ColumnHeaders6 implements TableHeader.Buildable {
@Parameter
public abstract ColumnHeader header6();
@Parameter
public abstract ColumnHeaders5 others();
public final ColumnHeaders7 header(String name,
Class clazz) {
return header(ColumnHeader.of(name, clazz));
}
public final ColumnHeaders7 header(String name,
Type type) {
return header(ColumnHeader.of(name, type));
}
public final ColumnHeaders7 header(ColumnHeader header) {
return ImmutableColumnHeaders7.of(header, this);
}
public final Rows start(int initialCapacity) {
return new Rows(initialCapacity);
}
public final Rows row(T1 a, T2 b, T3 c, T4 d, T5 e, T6 f) {
return start(DEFAULT_BUILDER_INITIAL_CAPACITY).row(a, b, c, d, e, f);
}
public class Rows implements NewTable.Buildable {
private final ColumnHeaders5.Rows others;
private final ArrayBuilder builder;
Rows(int initialCapacity) {
others = others().start(initialCapacity);
builder = Array.builder(header6().componentType(), initialCapacity);
}
public final Rows row(T1 a, T2 b, T3 c, T4 d, T5 e, T6 f) {
others.row(a, b, c, d, e);
builder.add(f);
return this;
}
final Stream> stream() {
Column thisColumn = Column.of(header6().name(), builder.build());
return Stream.concat(others.stream(), Stream.of(thisColumn));
}
@Override
public final Iterator> iterator() {
return stream().iterator();
}
}
final Stream> stream() {
return Stream.concat(others().stream(), Stream.of(header6()));
}
@Override
public final Iterator> iterator() {
return stream().iterator();
}
}