1 /*
2  * Copyright 2015-2018 HuntLabs.cn
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 module hunt.sql.ast.statement.SQLAlterTableReOrganizePartition;
17 
18 import hunt.collection;
19 
20 import hunt.sql.ast.SQLName;
21 import hunt.sql.ast.SQLObject;
22 import hunt.sql.ast.SQLObjectImpl;
23 import hunt.sql.visitor.SQLASTVisitor;
24 import hunt.sql.ast.statement.SQLAlterTableItem;
25 
26 public class SQLAlterTableReOrganizePartition : SQLObjectImpl , SQLAlterTableItem {
27 
28     private  List!SQLName   names;
29 
30     private  List!SQLObject partitions;
31 
32     this()
33     {
34         names       = new ArrayList!SQLName();
35         partitions  = new ArrayList!SQLObject(4);
36     }
37 
38     public List!SQLObject getPartitions() {
39         return partitions;
40     }
41 
42     public void addPartition(SQLObject partition) {
43         if (partition !is null) {
44             partition.setParent(this);
45         }
46         this.partitions.add(partition);
47     }
48 
49     public List!SQLName getNames() {
50         return names;
51     }
52 
53     
54     override  protected void accept0(SQLASTVisitor visitor) {
55         if (visitor.visit(this)) {
56             acceptChild(visitor, partitions);
57         }
58         visitor.endVisit(this);
59     }
60 }