• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Shenzhen Kaihong Digital.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package grammar;
17 
18 import utils.TsToken;
19 
20 import java.util.List;
21 import java.util.concurrent.CopyOnWriteArrayList;
22 
23 /**
24  * <h3>类名:该类用于xxx</h3>
25  * description enum grammar
26  *
27  * @author Administrator
28  *         date 2025-02-28
29  * @version 1.0
30  * @since 2025-02-28
31  */
32 public class EnumObj extends GBaseObject {
33     private String name;
34     private String alias;
35     private List<String> memberList;
36     private List<String> valueList;
37 
38     /**
39      * 构造函数
40      */
EnumObj()41     public EnumObj() {
42         this.token = TsToken.TS_TOKEN_ENUM;
43         this.memberList = new CopyOnWriteArrayList<>();
44         this.valueList = new CopyOnWriteArrayList<>();
45     }
46 
47     /**
48      * 构造函数
49      *
50      * @param nv 名称
51      * @param av 别名
52      * @param ml 成员
53      * @param vl54      */
EnumObj(String nv, String av, List<String> ml, List<String> vl)55     public EnumObj(String nv, String av, List<String> ml, List<String> vl) {
56         this.name = nv;
57         this.alias = av;
58         this.memberList = ml;
59         this.valueList = vl;
60     }
61 
62     /**
63      * 获取名称
64      *
65      * @return 名称
66      */
getName()67     public String getName() {
68         return name;
69     }
70 
71     /**
72      * 设置名称
73      *
74      * @param name 名称
75      */
setName(String name)76     public void setName(String name) {
77         this.name = name;
78     }
79 
80     /**
81      * 读取别名
82      *
83      * @return 别名
84      */
getAlias()85     public String getAlias() {
86         return alias;
87     }
88 
89     /**
90      * 设置名称
91      *
92      * @param alias 别名
93      */
setAlias(String alias)94     public void setAlias(String alias) {
95         this.alias = alias;
96     }
97 
98     /**
99      * 获取成员列表
100      *
101      * @return 成员列表
102      */
getMemberList()103     public List<String> getMemberList() {
104         return memberList;
105     }
106 
107     /**
108      * 设置成员列表
109      *
110      * @param memberList 成员列表
111      */
setMemberList(List<String> memberList)112     public void setMemberList(List<String> memberList) {
113         this.memberList = memberList;
114     }
115 
116     /**
117      * 获取值
118      *
119      * @return 值列表
120      */
getValueList()121     public List<String> getValueList() {
122         return valueList;
123     }
124 
125     /**
126      * 设置值列表
127      *
128      * @param valueList 值列表
129      */
setValueList(List<String> valueList)130     public void setValueList(List<String> valueList) {
131         this.valueList = valueList;
132     }
133 
134     /**
135      * 添加成员
136      *
137      * @param memName 成员名称
138      */
addMemberItem(String memName)139     public void addMemberItem(String memName) {
140         this.memberList.add(memName);
141     }
142 
143     /**
144      * 添加成员值
145      *
146      * @param memValue 成员值
147      */
addMemberValue(String memValue)148     public void addMemberValue(String memValue) {
149         this.valueList.add(memValue);
150     }
151 
152 
153 }
154