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.dialect.mysql.ast.MySqlIndexHintImpl;
17 
18 
19 import hunt.collection;
20 
21 import hunt.sql.ast.SQLName;
22 import hunt.sql.dialect.mysql.visitor.MySqlASTVisitor;
23 import hunt.sql.dialect.mysql.ast.MySqlObject;
24 import hunt.sql.dialect.mysql.ast.MySqlObjectImpl;
25 import hunt.sql.dialect.mysql.ast.MySqlIndexHint;
26 
27 
28 public abstract class MySqlIndexHintImpl : MySqlObjectImpl , MySqlIndexHint {
29 
30     alias accept0 = MySqlObjectImpl.accept0;
31 
32     private MySqlIndexHint.Option option;
33 
34     private List!(SQLName)         indexList;
35 
36     this()
37     {
38         indexList = new ArrayList!(SQLName)();
39     }
40 
41     override
42     public abstract void accept0(MySqlASTVisitor visitor);
43 
44     public MySqlIndexHint.Option getOption() {
45         return option;
46     }
47 
48     public void setOption(MySqlIndexHint.Option option) {
49         this.option = option;
50     }
51 
52     public List!(SQLName) getIndexList() {
53         return indexList;
54     }
55 
56     public void setIndexList(List!(SQLName) indexList) {
57         this.indexList = indexList;
58     }
59 
60     public abstract override MySqlIndexHintImpl clone();
61 
62     public void cloneTo(MySqlIndexHintImpl x) {
63         x.option = option;
64         foreach(SQLName name ; indexList) {
65             SQLName name2 = name.clone();
66             name2.setParent(x);
67             x.indexList.add(name2);
68         }
69     }
70 }