Skip to content

Commit

Permalink
Adjust GraphLabel Conj/Disj
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed Oct 18, 2024
1 parent d43ee11 commit 3dce47e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
20 changes: 12 additions & 8 deletions partiql-ast/api/partiql-ast.api
Original file line number Diff line number Diff line change
Expand Up @@ -5594,8 +5594,8 @@ public class org/partiql/ast/v1/Ast {
public static fun from (Ljava/util/List;)Lorg/partiql/ast/v1/From;
public static fun fromExpr (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/FromType;Lorg/partiql/ast/v1/Identifier;Lorg/partiql/ast/v1/Identifier;)Lorg/partiql/ast/v1/FromExpr;
public static fun fromJoin (Lorg/partiql/ast/v1/From;Lorg/partiql/ast/v1/From;Lorg/partiql/ast/v1/JoinType;Lorg/partiql/ast/v1/expr/Expr;)Lorg/partiql/ast/v1/FromJoin;
public static fun graphLabelConj (Ljava/util/List;)Lorg/partiql/ast/v1/graph/GraphLabel$Conj;
public static fun graphLabelDisj (Ljava/util/List;)Lorg/partiql/ast/v1/graph/GraphLabel$Disj;
public static fun graphLabelConj (Lorg/partiql/ast/v1/graph/GraphLabel;Lorg/partiql/ast/v1/graph/GraphLabel;)Lorg/partiql/ast/v1/graph/GraphLabel$Conj;
public static fun graphLabelDisj (Lorg/partiql/ast/v1/graph/GraphLabel;Lorg/partiql/ast/v1/graph/GraphLabel;)Lorg/partiql/ast/v1/graph/GraphLabel$Disj;
public static fun graphLabelName (Ljava/lang/String;)Lorg/partiql/ast/v1/graph/GraphLabel$Name;
public static fun graphLabelNegation (Lorg/partiql/ast/v1/graph/GraphLabel;)Lorg/partiql/ast/v1/graph/GraphLabel$Negation;
public static fun graphLabelWildcard ()Lorg/partiql/ast/v1/graph/GraphLabel$Wildcard;
Expand Down Expand Up @@ -7126,30 +7126,34 @@ public abstract class org/partiql/ast/v1/graph/GraphLabel : org/partiql/ast/v1/A
}

public class org/partiql/ast/v1/graph/GraphLabel$Conj : org/partiql/ast/v1/graph/GraphLabel {
public final field args Ljava/util/List;
public fun <init> (Ljava/util/List;)V
public final field lhs Lorg/partiql/ast/v1/graph/GraphLabel;
public final field rhs Lorg/partiql/ast/v1/graph/GraphLabel;
public fun <init> (Lorg/partiql/ast/v1/graph/GraphLabel;Lorg/partiql/ast/v1/graph/GraphLabel;)V
public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public static fun builder ()Lorg/partiql/ast/v1/graph/GraphLabel$Conj$Builder;
public fun children ()Ljava/util/Collection;
}

public class org/partiql/ast/v1/graph/GraphLabel$Conj$Builder {
public fun args (Ljava/util/List;)Lorg/partiql/ast/v1/graph/GraphLabel$Conj$Builder;
public fun build ()Lorg/partiql/ast/v1/graph/GraphLabel$Conj;
public fun lhs (Lorg/partiql/ast/v1/graph/GraphLabel;)Lorg/partiql/ast/v1/graph/GraphLabel$Conj$Builder;
public fun rhs (Lorg/partiql/ast/v1/graph/GraphLabel;)Lorg/partiql/ast/v1/graph/GraphLabel$Conj$Builder;
public fun toString ()Ljava/lang/String;
}

public class org/partiql/ast/v1/graph/GraphLabel$Disj : org/partiql/ast/v1/graph/GraphLabel {
public final field args Ljava/util/List;
public fun <init> (Ljava/util/List;)V
public final field lhs Lorg/partiql/ast/v1/graph/GraphLabel;
public final field rhs Lorg/partiql/ast/v1/graph/GraphLabel;
public fun <init> (Lorg/partiql/ast/v1/graph/GraphLabel;Lorg/partiql/ast/v1/graph/GraphLabel;)V
public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public static fun builder ()Lorg/partiql/ast/v1/graph/GraphLabel$Disj$Builder;
public fun children ()Ljava/util/Collection;
}

public class org/partiql/ast/v1/graph/GraphLabel$Disj$Builder {
public fun args (Ljava/util/List;)Lorg/partiql/ast/v1/graph/GraphLabel$Disj$Builder;
public fun build ()Lorg/partiql/ast/v1/graph/GraphLabel$Disj;
public fun lhs (Lorg/partiql/ast/v1/graph/GraphLabel;)Lorg/partiql/ast/v1/graph/GraphLabel$Disj$Builder;
public fun rhs (Lorg/partiql/ast/v1/graph/GraphLabel;)Lorg/partiql/ast/v1/graph/GraphLabel$Disj$Builder;
public fun toString ()Ljava/lang/String;
}

Expand Down
8 changes: 4 additions & 4 deletions partiql-ast/src/main/java/org/partiql/ast/v1/Ast.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ public static GraphLabel.Negation graphLabelNegation(@NotNull GraphLabel arg) {
}

@NotNull
public static GraphLabel.Conj graphLabelConj(@NotNull List<GraphLabel> args) {
return new GraphLabel.Conj(args);
public static GraphLabel.Conj graphLabelConj(@NotNull GraphLabel lhs, @NotNull GraphLabel rhs) {
return new GraphLabel.Conj(lhs, rhs);
}

@NotNull
public static GraphLabel.Disj graphLabelDisj(@NotNull List<GraphLabel> args) {
return new GraphLabel.Disj(args);
public static GraphLabel.Disj graphLabelDisj(@NotNull GraphLabel lhs, @NotNull GraphLabel rhs) {
return new GraphLabel.Disj(lhs, rhs);
}

@NotNull
Expand Down
30 changes: 22 additions & 8 deletions partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphLabel.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,23 @@ public <R, C> R accept(@NotNull AstVisitor<R, C> visitor, C ctx) {
@Builder(builderClassName = "Builder")
public static class Conj extends GraphLabel {
@NotNull
public final List<GraphLabel> args;
public final GraphLabel lhs;

public Conj(@NotNull List<GraphLabel> args) {
this.args = args;
@NotNull
public final GraphLabel rhs;

public Conj(@NotNull GraphLabel lhs, @NotNull GraphLabel rhs) {
this.lhs = lhs;
this.rhs = rhs;
}

@Override
@NotNull
public Collection<AstNode> children() {
return new ArrayList<>(args);
List<AstNode> kids = new ArrayList<>();
kids.add(lhs);
kids.add(rhs);
return kids;
}

@Override
Expand All @@ -129,16 +136,23 @@ public <R, C> R accept(@NotNull AstVisitor<R, C> visitor, C ctx) {
@Builder(builderClassName = "Builder")
public static class Disj extends GraphLabel {
@NotNull
public final List<GraphLabel> args;
public final GraphLabel lhs;

public Disj(@NotNull List<GraphLabel> args) {
this.args = args;
@NotNull
public final GraphLabel rhs;

public Disj(@NotNull GraphLabel lhs, @NotNull GraphLabel rhs) {
this.lhs = lhs;
this.rhs = rhs;
}

@Override
@NotNull
public Collection<AstNode> children() {
return new ArrayList<>(args);
List<AstNode> kids = new ArrayList<>();
kids.add(lhs);
kids.add(rhs);
return kids;
}

@Override
Expand Down

0 comments on commit 3dce47e

Please sign in to comment.