1 module hunt.sql.ast.SQLSubPartitionBy;
2 
3 import hunt.sql.visitor.SQLASTVisitor;
4 import hunt.sql.ast.SQLObjectImpl;
5 import hunt.sql.ast.SQLExpr;
6 import hunt.sql.ast.SQLSubPartition;
7 import hunt.collection;
8 import hunt.sql.ast.statement.SQLAssignItem;
9 
10 
11 public abstract class SQLSubPartitionBy : SQLObjectImpl {
12 
13     protected SQLExpr               subPartitionsCount;
14     protected bool               linear;
15     protected List!SQLAssignItem   options;
16     protected List!SQLSubPartition subPartitionTemplate;
17 
18     this()
19     {
20         options              = new ArrayList!SQLAssignItem();
21         subPartitionTemplate = new ArrayList!SQLSubPartition();
22     }
23 
24     public SQLExpr getSubPartitionsCount() {
25         return subPartitionsCount;
26     }
27 
28     public void setSubPartitionsCount(SQLExpr subPartitionsCount) {
29         if (subPartitionsCount !is null) {
30             subPartitionsCount.setParent(this);
31         }
32 
33         this.subPartitionsCount = subPartitionsCount;
34     }
35 
36     public bool isLinear() {
37         return linear;
38     }
39 
40     public void setLinear(bool linear) {
41         this.linear = linear;
42     }
43 
44     public List!SQLAssignItem getOptions() {
45         return options;
46     }
47 
48     public List!SQLSubPartition getSubPartitionTemplate() {
49         return subPartitionTemplate;
50     }
51 
52     public void cloneTo(SQLSubPartitionBy x) {
53         if (subPartitionsCount !is null) {
54             x.setSubPartitionsCount(subPartitionsCount.clone());
55         }
56         x.linear = linear;
57         foreach (SQLAssignItem option ; options) {
58             SQLAssignItem option2 = option.clone();
59             option2.setParent(x);
60             x.options.add(option2);
61         }
62 
63         foreach (SQLSubPartition p ; subPartitionTemplate) {
64             SQLSubPartition p2 = p.clone();
65             p2.setParent(x);
66             x.subPartitionTemplate.add(p2);
67         }
68     }
69 
70     public override abstract SQLSubPartitionBy clone();
71 }