1 module hunt.sql.ast.expr.SQLValuesExpr;
2 import hunt.sql.ast.SQLExprImpl;
3 import hunt.sql.ast.SQLObject;
4 import hunt.collection;
5 import hunt.sql.visitor.SQLASTVisitor;
6 import hunt.sql.ast.SQLExpr;
7 import hunt.sql.ast.expr.SQLListExpr;
8 
9 public class SQLValuesExpr : SQLExprImpl {
10 
11     private List!SQLListExpr values;
12 
13     this()
14     {
15         values = new ArrayList!SQLListExpr();
16     }
17     public List!SQLListExpr getValues() {
18         return values;
19     }
20 
21     protected override void accept0(SQLASTVisitor visitor) {
22         if (visitor.visit(this)) {
23             acceptChild!SQLListExpr(visitor, values);
24         }
25         visitor.endVisit(this);
26     }
27 
28     public override bool opEquals(Object o) {
29         if (this == o) return true;
30         if (o is null || typeid(SQLValuesExpr) != typeid(o)) return false;
31 
32         SQLValuesExpr that = cast(SQLValuesExpr) o;
33 
34         return (cast(Object)(values)).opEquals(cast(Object)(that.values));
35     }
36 
37     public override size_t toHash() @trusted nothrow {
38         return (cast(Object)values).toHash();
39     }
40 
41     public override SQLExpr clone() {
42         SQLValuesExpr x = new SQLValuesExpr();
43 
44         foreach (SQLListExpr value ; values) {
45             SQLListExpr value2 = value.clone();
46             value2.setParent(x);
47             x.values.add(value2);
48         }
49 
50         return x;
51     }
52 
53     public override  List!SQLObject getChildren() {
54         return cast(List!SQLObject)values;
55     }
56 }