1 module hunt.sql.ast.SQLPartitionValue;
2 
3 import hunt.sql.ast.SQLDataType;
4 import hunt.sql.ast.SQLObjectImpl;
5 import hunt.sql.ast.SQLExpr;
6 import hunt.sql.ast.SQLName;
7 import hunt.sql.visitor.SQLASTVisitor;
8 import hunt.collection;
9 import hunt.sql.ast.SQLObject;
10 
11 public class SQLPartitionValue : SQLObjectImpl {
12 
13     protected Operator            operator;
14     protected  List!SQLExpr items;
15 
16     public this(Operator operator){
17         super();
18         items = new ArrayList!SQLExpr();
19         this.operator = operator;
20     }
21 
22     public List!SQLExpr getItems() {
23         return items;
24     }
25     
26     public void addItem(SQLExpr item) {
27         if (item !is null) {
28             item.setParent(this);
29         }
30         this.items.add(item);
31     }
32 
33     public Operator getOperator() {
34         return operator;
35     }
36 
37     public static enum Operator {
38                                  LessThan, //
39                                  In, //
40                                  List
41     }
42 
43     protected override void accept0(SQLASTVisitor visitor) {
44         if (visitor.visit(this)) {
45             acceptChild!SQLExpr(visitor, getItems());
46         }
47         visitor.endVisit(this);
48     }
49 
50     public override SQLPartitionValue clone() {
51         SQLPartitionValue x = new SQLPartitionValue(operator);
52 
53         foreach (SQLExpr item ; items) {
54             SQLExpr item2 = item.clone();
55             item2.setParent(x);
56             x.items.add(item2);
57         }
58 
59         return x;
60     }
61 }