org.babyfish.jimmer.sql.ast.impl.Tuples Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jimmer-sql Show documentation
Show all versions of jimmer-sql Show documentation
A revolutionary ORM framework for both java and kotlin
The newest version!
package org.babyfish.jimmer.sql.ast.impl;
import org.babyfish.jimmer.sql.ast.Selection;
import org.babyfish.jimmer.sql.ast.impl.render.AbstractSqlBuilder;
import org.babyfish.jimmer.sql.ast.tuple.*;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public class Tuples {
private Tuples() {}
public static class Expr2
extends AbstractExpression>
implements TupleExpressionImplementor> {
private final Selection expr1;
private final Selection expr2;
public Expr2(
Selection expr1,
Selection expr2
) {
this.expr1 = Objects.requireNonNull(expr1, "expr1 cannot be null");
this.expr2 = Objects.requireNonNull(expr2, "expr2 cannot be null");
}
@SuppressWarnings("unchecked")
@Override
public Class> getType() {
return (Class>)(Class>)Tuple2.class;
}
@Override
public int precedence() {
return 0;
}
@Override
public void accept(@NotNull AstVisitor visitor) {
((Ast) expr1).accept(visitor);
((Ast) expr2).accept(visitor);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder) {
renderTo(builder, false);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder, boolean ignoreBrackets) {
if (!ignoreBrackets) {
builder.enter(AbstractSqlBuilder.ScopeType.TUPLE);
}
renderChild((Ast) expr1, builder);
builder.sql(", ");
renderChild((Ast) expr2, builder);
if (!ignoreBrackets) {
builder.leave();
}
}
@Override
protected boolean determineHasVirtualPredicate() {
return hasVirtualPredicate(expr1) ||
hasVirtualPredicate(expr2);
}
@Override
protected Ast onResolveVirtualPredicate(AstContext ctx) {
return new Tuples.Expr2<>(
ctx.resolveVirtualPredicate(expr1),
ctx.resolveVirtualPredicate(expr2)
);
}
@Override
public int size() {
return 2;
}
@Override
public Selection> get(int index) {
switch (index) {
case 0: return expr1;
case 1: return expr2;
default: throw new IllegalArgumentException(
"Index must between 0 and " + (size() - 1)
);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Expr2, ?> expr21 = (Expr2, ?>) o;
return expr1.equals(expr21.expr1) && expr2.equals(expr21.expr2);
}
@Override
public int hashCode() {
return Objects.hash(expr1, expr2);
}
}
public static class Expr3
extends AbstractExpression>
implements TupleExpressionImplementor> {
private final Selection expr1;
private final Selection expr2;
private final Selection expr3;
public Expr3(
Selection expr1,
Selection expr2,
Selection expr3
) {
this.expr1 = Objects.requireNonNull(expr1, "expr1 cannot be null");
this.expr2 = Objects.requireNonNull(expr2, "expr2 cannot be null");
this.expr3 = Objects.requireNonNull(expr3, "expr3 cannot be null");
}
@SuppressWarnings("unchecked")
@Override
public Class> getType() {
return (Class>)(Class>)Tuple3.class;
}
@Override
public int precedence() {
return 0;
}
@Override
public void accept(@NotNull AstVisitor visitor) {
((Ast) expr1).accept(visitor);
((Ast) expr2).accept(visitor);
((Ast) expr3).accept(visitor);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder) {
renderTo(builder, false);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder, boolean ignoreBrackets) {
if (!ignoreBrackets) {
builder.enter(AbstractSqlBuilder.ScopeType.TUPLE);
}
renderChild((Ast) expr1, builder);
builder.sql(", ");
renderChild((Ast) expr2, builder);
builder.sql(", ");
renderChild((Ast) expr3, builder);
if (!ignoreBrackets) {
builder.leave();
}
}
@Override
protected boolean determineHasVirtualPredicate() {
return hasVirtualPredicate(expr1) ||
hasVirtualPredicate(expr2) ||
hasVirtualPredicate(expr3);
}
@Override
protected Ast onResolveVirtualPredicate(AstContext ctx) {
return new Tuples.Expr3<>(
ctx.resolveVirtualPredicate(expr1),
ctx.resolveVirtualPredicate(expr2),
ctx.resolveVirtualPredicate(expr3)
);
}
@Override
public int size() {
return 3;
}
@Override
public Selection> get(int index) {
switch (index) {
case 0: return expr1;
case 1: return expr2;
case 2: return expr3;
default: throw new IllegalArgumentException(
"Index must between 0 and " + (size() - 1)
);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Expr3, ?, ?> expr31 = (Expr3, ?, ?>) o;
return expr1.equals(expr31.expr1) &&
expr2.equals(expr31.expr2) &&
expr3.equals(expr31.expr3);
}
@Override
public int hashCode() {
return Objects.hash(expr1, expr2, expr3);
}
}
public static class Expr4
extends AbstractExpression>
implements TupleExpressionImplementor>{
private final Selection expr1;
private final Selection expr2;
private final Selection expr3;
private final Selection expr4;
public Expr4(
Selection expr1,
Selection expr2,
Selection expr3,
Selection expr4
) {
this.expr1 = Objects.requireNonNull(expr1, "expr1 cannot be null");
this.expr2 = Objects.requireNonNull(expr2, "expr2 cannot be null");
this.expr3 = Objects.requireNonNull(expr3, "expr3 cannot be null");
this.expr4 = Objects.requireNonNull(expr4, "expr4 cannot be null");
}
@SuppressWarnings("unchecked")
@Override
public Class> getType() {
return (Class>)(Class>)Tuple4.class;
}
@Override
public int precedence() {
return 0;
}
@Override
public void accept(@NotNull AstVisitor visitor) {
((Ast) expr1).accept(visitor);
((Ast) expr2).accept(visitor);
((Ast) expr3).accept(visitor);
((Ast) expr4).accept(visitor);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder) {
renderTo(builder, false);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder, boolean ignoreBrackets) {
if (!ignoreBrackets) {
builder.enter(AbstractSqlBuilder.ScopeType.TUPLE);
}
renderChild((Ast) expr1, builder);
builder.sql(", ");
renderChild((Ast) expr2, builder);
builder.sql(", ");
renderChild((Ast) expr3, builder);
builder.sql(", ");
renderChild((Ast) expr4, builder);
if (!ignoreBrackets) {
builder.leave();
}
}
@Override
protected boolean determineHasVirtualPredicate() {
return hasVirtualPredicate(expr1) ||
hasVirtualPredicate(expr2) ||
hasVirtualPredicate(expr3) ||
hasVirtualPredicate(expr4);
}
@Override
protected Ast onResolveVirtualPredicate(AstContext ctx) {
return new Tuples.Expr4<>(
ctx.resolveVirtualPredicate(expr1),
ctx.resolveVirtualPredicate(expr2),
ctx.resolveVirtualPredicate(expr3),
ctx.resolveVirtualPredicate(expr4)
);
}
@Override
public int size() {
return 4;
}
@Override
public Selection> get(int index) {
switch (index) {
case 0: return expr1;
case 1: return expr2;
case 2: return expr3;
case 3: return expr4;
default: throw new IllegalArgumentException(
"Index must between 0 and " + (size() - 1)
);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Expr4, ?, ?, ?> expr41 = (Expr4, ?, ?, ?>) o;
return expr1.equals(expr41.expr1) &&
expr2.equals(expr41.expr2) &&
expr3.equals(expr41.expr3) &&
expr4.equals(expr41.expr4);
}
@Override
public int hashCode() {
return Objects.hash(expr1, expr2, expr3, expr4);
}
}
public static class Expr5
extends AbstractExpression>
implements TupleExpressionImplementor> {
private final Selection expr1;
private final Selection expr2;
private final Selection expr3;
private final Selection expr4;
private final Selection expr5;
public Expr5(
Selection expr1,
Selection expr2,
Selection expr3,
Selection expr4,
Selection expr5
) {
this.expr1 = Objects.requireNonNull(expr1, "expr1 cannot be null");
this.expr2 = Objects.requireNonNull(expr2, "expr2 cannot be null");
this.expr3 = Objects.requireNonNull(expr3, "expr3 cannot be null");
this.expr4 = Objects.requireNonNull(expr4, "expr4 cannot be null");
this.expr5 = Objects.requireNonNull(expr5, "expr5 cannot be null");
}
@SuppressWarnings("unchecked")
@Override
public Class> getType() {
return (Class>)(Class>)Tuple5.class;
}
@Override
public int precedence() {
return 0;
}
@Override
public void accept(@NotNull AstVisitor visitor) {
((Ast) expr1).accept(visitor);
((Ast) expr2).accept(visitor);
((Ast) expr3).accept(visitor);
((Ast) expr4).accept(visitor);
((Ast) expr5).accept(visitor);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder) {
renderTo(builder, false);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder, boolean ignoreBrackets) {
if (!ignoreBrackets) {
builder.enter(AbstractSqlBuilder.ScopeType.TUPLE);
}
renderChild((Ast) expr1, builder);
builder.sql(", ");
renderChild((Ast) expr2, builder);
builder.sql(", ");
renderChild((Ast) expr3, builder);
builder.sql(", ");
renderChild((Ast) expr4, builder);
builder.sql(", ");
renderChild((Ast) expr5, builder);
if (!ignoreBrackets) {
builder.leave();
}
}
@Override
protected boolean determineHasVirtualPredicate() {
return hasVirtualPredicate(expr1) ||
hasVirtualPredicate(expr2) ||
hasVirtualPredicate(expr3) ||
hasVirtualPredicate(expr4) ||
hasVirtualPredicate(expr5);
}
@Override
protected Ast onResolveVirtualPredicate(AstContext ctx) {
return new Tuples.Expr5<>(
ctx.resolveVirtualPredicate(expr1),
ctx.resolveVirtualPredicate(expr2),
ctx.resolveVirtualPredicate(expr3),
ctx.resolveVirtualPredicate(expr4),
ctx.resolveVirtualPredicate(expr5)
);
}
@Override
public int size() {
return 5;
}
@Override
public Selection> get(int index) {
switch (index) {
case 0: return expr1;
case 1: return expr2;
case 2: return expr3;
case 3: return expr4;
case 4: return expr5;
default: throw new IllegalArgumentException(
"Index must between 0 and " + (size() - 1)
);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Expr5, ?, ?, ?, ?> expr51 = (Expr5, ?, ?, ?, ?>) o;
return expr1.equals(expr51.expr1) &&
expr2.equals(expr51.expr2) &&
expr3.equals(expr51.expr3) &&
expr4.equals(expr51.expr4) &&
expr5.equals(expr51.expr5);
}
@Override
public int hashCode() {
return Objects.hash(expr1, expr2, expr3, expr4, expr5);
}
}
public static class Expr6
extends AbstractExpression>
implements TupleExpressionImplementor> {
private final Selection expr1;
private final Selection expr2;
private final Selection expr3;
private final Selection expr4;
private final Selection expr5;
private final Selection expr6;
public Expr6(
Selection expr1,
Selection expr2,
Selection expr3,
Selection expr4,
Selection expr5,
Selection expr6
) {
this.expr1 = Objects.requireNonNull(expr1, "expr1 cannot be null");
this.expr2 = Objects.requireNonNull(expr2, "expr2 cannot be null");
this.expr3 = Objects.requireNonNull(expr3, "expr3 cannot be null");
this.expr4 = Objects.requireNonNull(expr4, "expr4 cannot be null");
this.expr5 = Objects.requireNonNull(expr5, "expr5 cannot be null");
this.expr6 = Objects.requireNonNull(expr6, "expr6 cannot be null");
}
@SuppressWarnings("unchecked")
@Override
public Class> getType() {
return (Class>)(Class>)Tuple6.class;
}
@Override
public int precedence() {
return 0;
}
@Override
public void accept(@NotNull AstVisitor visitor) {
((Ast) expr1).accept(visitor);
((Ast) expr2).accept(visitor);
((Ast) expr3).accept(visitor);
((Ast) expr4).accept(visitor);
((Ast) expr5).accept(visitor);
((Ast) expr6).accept(visitor);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder) {
renderTo(builder, false);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder, boolean ignoreBrackets) {
if (!ignoreBrackets) {
builder.enter(AbstractSqlBuilder.ScopeType.TUPLE);
}
renderChild((Ast) expr1, builder);
builder.sql(", ");
renderChild((Ast) expr2, builder);
builder.sql(", ");
renderChild((Ast) expr3, builder);
builder.sql(", ");
renderChild((Ast) expr4, builder);
builder.sql(", ");
renderChild((Ast) expr5, builder);
builder.sql(", ");
renderChild((Ast) expr6, builder);
if (!ignoreBrackets) {
builder.leave();
}
}
@Override
protected boolean determineHasVirtualPredicate() {
return hasVirtualPredicate(expr1) ||
hasVirtualPredicate(expr2) ||
hasVirtualPredicate(expr3) ||
hasVirtualPredicate(expr4) ||
hasVirtualPredicate(expr5) ||
hasVirtualPredicate(expr6);
}
@Override
protected Ast onResolveVirtualPredicate(AstContext ctx) {
return new Tuples.Expr6<>(
ctx.resolveVirtualPredicate(expr1),
ctx.resolveVirtualPredicate(expr2),
ctx.resolveVirtualPredicate(expr3),
ctx.resolveVirtualPredicate(expr4),
ctx.resolveVirtualPredicate(expr5),
ctx.resolveVirtualPredicate(expr6)
);
}
@Override
public int size() {
return 6;
}
@Override
public Selection> get(int index) {
switch (index) {
case 0: return expr1;
case 1: return expr2;
case 2: return expr3;
case 3: return expr4;
case 4: return expr5;
case 5: return expr6;
default: throw new IllegalArgumentException(
"Index must between 0 and " + (size() - 1)
);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Expr6, ?, ?, ?, ?, ?> expr61 = (Expr6, ?, ?, ?, ?, ?>) o;
return expr1.equals(expr61.expr1) &&
expr2.equals(expr61.expr2) &&
expr3.equals(expr61.expr3) &&
expr4.equals(expr61.expr4) &&
expr5.equals(expr61.expr5) &&
expr6.equals(expr61.expr6);
}
@Override
public int hashCode() {
return Objects.hash(expr1, expr2, expr3, expr4, expr5, expr6);
}
}
public static class Expr7
extends AbstractExpression>
implements TupleExpressionImplementor> {
private final Selection expr1;
private final Selection expr2;
private final Selection expr3;
private final Selection expr4;
private final Selection expr5;
private final Selection expr6;
private final Selection expr7;
public Expr7(
Selection expr1,
Selection expr2,
Selection expr3,
Selection expr4,
Selection expr5,
Selection expr6,
Selection expr7
) {
this.expr1 = Objects.requireNonNull(expr1, "expr1 cannot be null");
this.expr2 = Objects.requireNonNull(expr2, "expr2 cannot be null");
this.expr3 = Objects.requireNonNull(expr3, "expr3 cannot be null");
this.expr4 = Objects.requireNonNull(expr4, "expr4 cannot be null");
this.expr5 = Objects.requireNonNull(expr5, "expr5 cannot be null");
this.expr6 = Objects.requireNonNull(expr6, "expr6 cannot be null");
this.expr7 = Objects.requireNonNull(expr7, "expr7 cannot be null");
}
@SuppressWarnings("unchecked")
@Override
public Class> getType() {
return (Class>)(Class>)Tuple7.class;
}
@Override
public int precedence() {
return 0;
}
@Override
public void accept(@NotNull AstVisitor visitor) {
((Ast) expr1).accept(visitor);
((Ast) expr2).accept(visitor);
((Ast) expr3).accept(visitor);
((Ast) expr4).accept(visitor);
((Ast) expr5).accept(visitor);
((Ast) expr6).accept(visitor);
((Ast) expr7).accept(visitor);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder) {
renderTo(builder, false);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder, boolean ignoreBrackets) {
if (!ignoreBrackets) {
builder.enter(AbstractSqlBuilder.ScopeType.TUPLE);
}
renderChild((Ast) expr1, builder);
builder.sql(", ");
renderChild((Ast) expr2, builder);
builder.sql(", ");
renderChild((Ast) expr3, builder);
builder.sql(", ");
renderChild((Ast) expr4, builder);
builder.sql(", ");
renderChild((Ast) expr5, builder);
builder.sql(", ");
renderChild((Ast) expr6, builder);
builder.sql(", ");
renderChild((Ast) expr7, builder);
if (!ignoreBrackets) {
builder.leave();
}
}
@Override
protected boolean determineHasVirtualPredicate() {
return hasVirtualPredicate(expr1) ||
hasVirtualPredicate(expr2) ||
hasVirtualPredicate(expr3) ||
hasVirtualPredicate(expr4) ||
hasVirtualPredicate(expr5) ||
hasVirtualPredicate(expr6) ||
hasVirtualPredicate(expr7);
}
@Override
protected Ast onResolveVirtualPredicate(AstContext ctx) {
return new Tuples.Expr7<>(
ctx.resolveVirtualPredicate(expr1),
ctx.resolveVirtualPredicate(expr2),
ctx.resolveVirtualPredicate(expr3),
ctx.resolveVirtualPredicate(expr4),
ctx.resolveVirtualPredicate(expr5),
ctx.resolveVirtualPredicate(expr6),
ctx.resolveVirtualPredicate(expr7)
);
}
@Override
public int size() {
return 7;
}
@Override
public Selection> get(int index) {
switch (index) {
case 0: return expr1;
case 1: return expr2;
case 2: return expr3;
case 3: return expr4;
case 4: return expr5;
case 5: return expr6;
case 6: return expr7;
default: throw new IllegalArgumentException(
"Index must between 0 and " + (size() - 1)
);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Expr7, ?, ?, ?, ?, ?, ?> expr71 = (Expr7, ?, ?, ?, ?, ?, ?>) o;
return expr1.equals(expr71.expr1) &&
expr2.equals(expr71.expr2) &&
expr3.equals(expr71.expr3) &&
expr4.equals(expr71.expr4) &&
expr5.equals(expr71.expr5) &&
expr6.equals(expr71.expr6) &&
expr7.equals(expr71.expr7);
}
@Override
public int hashCode() {
return Objects.hash(expr1, expr2, expr3, expr4, expr5, expr6, expr7);
}
}
public static class Expr8
extends AbstractExpression>
implements TupleExpressionImplementor> {
private final Selection expr1;
private final Selection expr2;
private final Selection expr3;
private final Selection expr4;
private final Selection expr5;
private final Selection expr6;
private final Selection expr7;
private final Selection expr8;
public Expr8(
Selection expr1,
Selection expr2,
Selection expr3,
Selection expr4,
Selection expr5,
Selection expr6,
Selection expr7,
Selection expr8
) {
this.expr1 = Objects.requireNonNull(expr1, "expr1 cannot be null");
this.expr2 = Objects.requireNonNull(expr2, "expr2 cannot be null");
this.expr3 = Objects.requireNonNull(expr3, "expr3 cannot be null");
this.expr4 = Objects.requireNonNull(expr4, "expr4 cannot be null");
this.expr5 = Objects.requireNonNull(expr5, "expr5 cannot be null");
this.expr6 = Objects.requireNonNull(expr6, "expr6 cannot be null");
this.expr7 = Objects.requireNonNull(expr7, "expr7 cannot be null");
this.expr8 = Objects.requireNonNull(expr8, "expr8 cannot be null");
}
@SuppressWarnings("unchecked")
@Override
public Class> getType() {
return (Class>)(Class>)Tuple8.class;
}
@Override
public int precedence() {
return 0;
}
@Override
public void accept(@NotNull AstVisitor visitor) {
((Ast) expr1).accept(visitor);
((Ast) expr2).accept(visitor);
((Ast) expr3).accept(visitor);
((Ast) expr4).accept(visitor);
((Ast) expr5).accept(visitor);
((Ast) expr6).accept(visitor);
((Ast) expr7).accept(visitor);
((Ast) expr8).accept(visitor);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder) {
renderTo(builder, false);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder, boolean ignoreBrackets) {
if (!ignoreBrackets) {
builder.enter(AbstractSqlBuilder.ScopeType.TUPLE);
}
renderChild((Ast) expr1, builder);
builder.sql(", ");
renderChild((Ast) expr2, builder);
builder.sql(", ");
renderChild((Ast) expr3, builder);
builder.sql(", ");
renderChild((Ast) expr4, builder);
builder.sql(", ");
renderChild((Ast) expr5, builder);
builder.sql(", ");
renderChild((Ast) expr6, builder);
builder.sql(", ");
renderChild((Ast) expr7, builder);
builder.sql(", ");
renderChild((Ast) expr8, builder);
if (!ignoreBrackets) {
builder.leave();
}
}
@Override
protected boolean determineHasVirtualPredicate() {
return hasVirtualPredicate(expr1) ||
hasVirtualPredicate(expr2) ||
hasVirtualPredicate(expr3) ||
hasVirtualPredicate(expr4) ||
hasVirtualPredicate(expr5) ||
hasVirtualPredicate(expr6) ||
hasVirtualPredicate(expr7) ||
hasVirtualPredicate(expr8);
}
@Override
protected Ast onResolveVirtualPredicate(AstContext ctx) {
return new Tuples.Expr8<>(
ctx.resolveVirtualPredicate(expr1),
ctx.resolveVirtualPredicate(expr2),
ctx.resolveVirtualPredicate(expr3),
ctx.resolveVirtualPredicate(expr4),
ctx.resolveVirtualPredicate(expr5),
ctx.resolveVirtualPredicate(expr6),
ctx.resolveVirtualPredicate(expr7),
ctx.resolveVirtualPredicate(expr8)
);
}
@Override
public int size() {
return 8;
}
@Override
public Selection> get(int index) {
switch (index) {
case 0: return expr1;
case 1: return expr2;
case 2: return expr3;
case 3: return expr4;
case 4: return expr5;
case 5: return expr6;
case 6: return expr7;
case 7: return expr8;
default: throw new IllegalArgumentException(
"Index must between 0 and " + (size() - 1)
);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Expr8, ?, ?, ?, ?, ?, ?, ?> expr81 = (Expr8, ?, ?, ?, ?, ?, ?, ?>) o;
return expr1.equals(expr81.expr1) &&
expr2.equals(expr81.expr2) &&
expr3.equals(expr81.expr3) &&
expr4.equals(expr81.expr4) &&
expr5.equals(expr81.expr5) &&
expr6.equals(expr81.expr6) &&
expr7.equals(expr81.expr7) &&
expr8.equals(expr81.expr8);
}
@Override
public int hashCode() {
return Objects.hash(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8);
}
}
public static class Expr9
extends AbstractExpression>
implements TupleExpressionImplementor> {
private final Selection expr1;
private final Selection expr2;
private final Selection expr3;
private final Selection expr4;
private final Selection expr5;
private final Selection expr6;
private final Selection expr7;
private final Selection expr8;
private final Selection expr9;
public Expr9(
Selection expr1,
Selection expr2,
Selection expr3,
Selection expr4,
Selection expr5,
Selection expr6,
Selection expr7,
Selection expr8,
Selection expr9
) {
this.expr1 = Objects.requireNonNull(expr1, "expr1 cannot be null");
this.expr2 = Objects.requireNonNull(expr2, "expr2 cannot be null");
this.expr3 = Objects.requireNonNull(expr3, "expr3 cannot be null");
this.expr4 = Objects.requireNonNull(expr4, "expr4 cannot be null");
this.expr5 = Objects.requireNonNull(expr5, "expr5 cannot be null");
this.expr6 = Objects.requireNonNull(expr6, "expr6 cannot be null");
this.expr7 = Objects.requireNonNull(expr7, "expr7 cannot be null");
this.expr8 = Objects.requireNonNull(expr8, "expr8 cannot be null");
this.expr9 = Objects.requireNonNull(expr9, "expr9 cannot be null");
}
@SuppressWarnings("unchecked")
@Override
public Class> getType() {
return (Class>)(Class>)Tuple9.class;
}
@Override
public int precedence() {
return 0;
}
@Override
public void accept(@NotNull AstVisitor visitor) {
((Ast) expr1).accept(visitor);
((Ast) expr2).accept(visitor);
((Ast) expr3).accept(visitor);
((Ast) expr4).accept(visitor);
((Ast) expr5).accept(visitor);
((Ast) expr6).accept(visitor);
((Ast) expr7).accept(visitor);
((Ast) expr8).accept(visitor);
((Ast) expr9).accept(visitor);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder) {
renderTo(builder, false);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder, boolean ignoreBrackets) {
if (!ignoreBrackets) {
builder.enter(AbstractSqlBuilder.ScopeType.TUPLE);
}
renderChild((Ast) expr1, builder);
builder.sql(", ");
renderChild((Ast) expr2, builder);
builder.sql(", ");
renderChild((Ast) expr3, builder);
builder.sql(", ");
renderChild((Ast) expr4, builder);
builder.sql(", ");
renderChild((Ast) expr5, builder);
builder.sql(", ");
renderChild((Ast) expr6, builder);
builder.sql(", ");
renderChild((Ast) expr7, builder);
builder.sql(", ");
renderChild((Ast) expr8, builder);
builder.sql(", ");
renderChild((Ast) expr9, builder);
if (!ignoreBrackets) {
builder.leave();
}
}
@Override
protected boolean determineHasVirtualPredicate() {
return hasVirtualPredicate(expr1) ||
hasVirtualPredicate(expr2) ||
hasVirtualPredicate(expr3) ||
hasVirtualPredicate(expr4) ||
hasVirtualPredicate(expr5) ||
hasVirtualPredicate(expr6) ||
hasVirtualPredicate(expr7) ||
hasVirtualPredicate(expr8) ||
hasVirtualPredicate(expr9);
}
@Override
protected Ast onResolveVirtualPredicate(AstContext ctx) {
return new Tuples.Expr9<>(
ctx.resolveVirtualPredicate(expr1),
ctx.resolveVirtualPredicate(expr2),
ctx.resolveVirtualPredicate(expr3),
ctx.resolveVirtualPredicate(expr4),
ctx.resolveVirtualPredicate(expr5),
ctx.resolveVirtualPredicate(expr6),
ctx.resolveVirtualPredicate(expr7),
ctx.resolveVirtualPredicate(expr8),
ctx.resolveVirtualPredicate(expr9)
);
}
@Override
public int size() {
return 9;
}
@Override
public Selection> get(int index) {
switch (index) {
case 0: return expr1;
case 1: return expr2;
case 2: return expr3;
case 3: return expr4;
case 4: return expr5;
case 5: return expr6;
case 6: return expr7;
case 7: return expr8;
case 8: return expr9;
default: throw new IllegalArgumentException(
"Index must between 0 and " + (size() - 1)
);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Expr9, ?, ?, ?, ?, ?, ?, ?, ?> expr91 = (Expr9, ?, ?, ?, ?, ?, ?, ?, ?>) o;
return expr1.equals(expr91.expr1) &&
expr2.equals(expr91.expr2) &&
expr3.equals(expr91.expr3) &&
expr4.equals(expr91.expr4) &&
expr5.equals(expr91.expr5) &&
expr6.equals(expr91.expr6) &&
expr7.equals(expr91.expr7) &&
expr8.equals(expr91.expr8) &&
expr9.equals(expr91.expr9);
}
@Override
public int hashCode() {
return Objects.hash(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9);
}
}
}