1 | /** |
---|
2 | */ |
---|
3 | package de.ugoe.cs.swe.bnftools.ebnf.impl; |
---|
4 | |
---|
5 | import de.ugoe.cs.swe.bnftools.ebnf.EbnfPackage; |
---|
6 | import de.ugoe.cs.swe.bnftools.ebnf.HookCombinator; |
---|
7 | |
---|
8 | import java.util.Collection; |
---|
9 | |
---|
10 | import org.eclipse.emf.common.notify.Notification; |
---|
11 | |
---|
12 | import org.eclipse.emf.common.util.EList; |
---|
13 | |
---|
14 | import org.eclipse.emf.ecore.EClass; |
---|
15 | |
---|
16 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
---|
17 | |
---|
18 | import org.eclipse.emf.ecore.util.EDataTypeEList; |
---|
19 | |
---|
20 | /** |
---|
21 | * <!-- begin-user-doc --> |
---|
22 | * An implementation of the model object '<em><b>Hook Combinator</b></em>'. |
---|
23 | * <!-- end-user-doc --> |
---|
24 | * <p> |
---|
25 | * The following features are implemented: |
---|
26 | * <ul> |
---|
27 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.HookCombinatorImpl#getName <em>Name</em>}</li> |
---|
28 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.HookCombinatorImpl#getRuleext <em>Ruleext</em>}</li> |
---|
29 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.HookCombinatorImpl#getLABEL <em>LABEL</em>}</li> |
---|
30 | * </ul> |
---|
31 | * </p> |
---|
32 | * |
---|
33 | * @generated |
---|
34 | */ |
---|
35 | public class HookCombinatorImpl extends MergeRuleImpl implements HookCombinator |
---|
36 | { |
---|
37 | /** |
---|
38 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
---|
39 | * <!-- begin-user-doc --> |
---|
40 | * <!-- end-user-doc --> |
---|
41 | * @see #getName() |
---|
42 | * @generated |
---|
43 | * @ordered |
---|
44 | */ |
---|
45 | protected static final String NAME_EDEFAULT = null; |
---|
46 | |
---|
47 | /** |
---|
48 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
---|
49 | * <!-- begin-user-doc --> |
---|
50 | * <!-- end-user-doc --> |
---|
51 | * @see #getName() |
---|
52 | * @generated |
---|
53 | * @ordered |
---|
54 | */ |
---|
55 | protected String name = NAME_EDEFAULT; |
---|
56 | |
---|
57 | /** |
---|
58 | * The default value of the '{@link #getRuleext() <em>Ruleext</em>}' attribute. |
---|
59 | * <!-- begin-user-doc --> |
---|
60 | * <!-- end-user-doc --> |
---|
61 | * @see #getRuleext() |
---|
62 | * @generated |
---|
63 | * @ordered |
---|
64 | */ |
---|
65 | protected static final int RULEEXT_EDEFAULT = 0; |
---|
66 | |
---|
67 | /** |
---|
68 | * The cached value of the '{@link #getRuleext() <em>Ruleext</em>}' attribute. |
---|
69 | * <!-- begin-user-doc --> |
---|
70 | * <!-- end-user-doc --> |
---|
71 | * @see #getRuleext() |
---|
72 | * @generated |
---|
73 | * @ordered |
---|
74 | */ |
---|
75 | protected int ruleext = RULEEXT_EDEFAULT; |
---|
76 | |
---|
77 | /** |
---|
78 | * The cached value of the '{@link #getLABEL() <em>LABEL</em>}' attribute list. |
---|
79 | * <!-- begin-user-doc --> |
---|
80 | * <!-- end-user-doc --> |
---|
81 | * @see #getLABEL() |
---|
82 | * @generated |
---|
83 | * @ordered |
---|
84 | */ |
---|
85 | protected EList<String> label; |
---|
86 | |
---|
87 | /** |
---|
88 | * <!-- begin-user-doc --> |
---|
89 | * <!-- end-user-doc --> |
---|
90 | * @generated |
---|
91 | */ |
---|
92 | protected HookCombinatorImpl() |
---|
93 | { |
---|
94 | super(); |
---|
95 | } |
---|
96 | |
---|
97 | /** |
---|
98 | * <!-- begin-user-doc --> |
---|
99 | * <!-- end-user-doc --> |
---|
100 | * @generated |
---|
101 | */ |
---|
102 | @Override |
---|
103 | protected EClass eStaticClass() |
---|
104 | { |
---|
105 | return EbnfPackage.Literals.HOOK_COMBINATOR; |
---|
106 | } |
---|
107 | |
---|
108 | /** |
---|
109 | * <!-- begin-user-doc --> |
---|
110 | * <!-- end-user-doc --> |
---|
111 | * @generated |
---|
112 | */ |
---|
113 | public String getName() |
---|
114 | { |
---|
115 | return name; |
---|
116 | } |
---|
117 | |
---|
118 | /** |
---|
119 | * <!-- begin-user-doc --> |
---|
120 | * <!-- end-user-doc --> |
---|
121 | * @generated |
---|
122 | */ |
---|
123 | public void setName(String newName) |
---|
124 | { |
---|
125 | String oldName = name; |
---|
126 | name = newName; |
---|
127 | if (eNotificationRequired()) |
---|
128 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.HOOK_COMBINATOR__NAME, oldName, name)); |
---|
129 | } |
---|
130 | |
---|
131 | /** |
---|
132 | * <!-- begin-user-doc --> |
---|
133 | * <!-- end-user-doc --> |
---|
134 | * @generated |
---|
135 | */ |
---|
136 | public int getRuleext() |
---|
137 | { |
---|
138 | return ruleext; |
---|
139 | } |
---|
140 | |
---|
141 | /** |
---|
142 | * <!-- begin-user-doc --> |
---|
143 | * <!-- end-user-doc --> |
---|
144 | * @generated |
---|
145 | */ |
---|
146 | public void setRuleext(int newRuleext) |
---|
147 | { |
---|
148 | int oldRuleext = ruleext; |
---|
149 | ruleext = newRuleext; |
---|
150 | if (eNotificationRequired()) |
---|
151 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.HOOK_COMBINATOR__RULEEXT, oldRuleext, ruleext)); |
---|
152 | } |
---|
153 | |
---|
154 | /** |
---|
155 | * <!-- begin-user-doc --> |
---|
156 | * <!-- end-user-doc --> |
---|
157 | * @generated |
---|
158 | */ |
---|
159 | public EList<String> getLABEL() |
---|
160 | { |
---|
161 | if (label == null) |
---|
162 | { |
---|
163 | label = new EDataTypeEList<String>(String.class, this, EbnfPackage.HOOK_COMBINATOR__LABEL); |
---|
164 | } |
---|
165 | return label; |
---|
166 | } |
---|
167 | |
---|
168 | /** |
---|
169 | * <!-- begin-user-doc --> |
---|
170 | * <!-- end-user-doc --> |
---|
171 | * @generated |
---|
172 | */ |
---|
173 | @Override |
---|
174 | public Object eGet(int featureID, boolean resolve, boolean coreType) |
---|
175 | { |
---|
176 | switch (featureID) |
---|
177 | { |
---|
178 | case EbnfPackage.HOOK_COMBINATOR__NAME: |
---|
179 | return getName(); |
---|
180 | case EbnfPackage.HOOK_COMBINATOR__RULEEXT: |
---|
181 | return getRuleext(); |
---|
182 | case EbnfPackage.HOOK_COMBINATOR__LABEL: |
---|
183 | return getLABEL(); |
---|
184 | } |
---|
185 | return super.eGet(featureID, resolve, coreType); |
---|
186 | } |
---|
187 | |
---|
188 | /** |
---|
189 | * <!-- begin-user-doc --> |
---|
190 | * <!-- end-user-doc --> |
---|
191 | * @generated |
---|
192 | */ |
---|
193 | @SuppressWarnings("unchecked") |
---|
194 | @Override |
---|
195 | public void eSet(int featureID, Object newValue) |
---|
196 | { |
---|
197 | switch (featureID) |
---|
198 | { |
---|
199 | case EbnfPackage.HOOK_COMBINATOR__NAME: |
---|
200 | setName((String)newValue); |
---|
201 | return; |
---|
202 | case EbnfPackage.HOOK_COMBINATOR__RULEEXT: |
---|
203 | setRuleext((Integer)newValue); |
---|
204 | return; |
---|
205 | case EbnfPackage.HOOK_COMBINATOR__LABEL: |
---|
206 | getLABEL().clear(); |
---|
207 | getLABEL().addAll((Collection<? extends String>)newValue); |
---|
208 | return; |
---|
209 | } |
---|
210 | super.eSet(featureID, newValue); |
---|
211 | } |
---|
212 | |
---|
213 | /** |
---|
214 | * <!-- begin-user-doc --> |
---|
215 | * <!-- end-user-doc --> |
---|
216 | * @generated |
---|
217 | */ |
---|
218 | @Override |
---|
219 | public void eUnset(int featureID) |
---|
220 | { |
---|
221 | switch (featureID) |
---|
222 | { |
---|
223 | case EbnfPackage.HOOK_COMBINATOR__NAME: |
---|
224 | setName(NAME_EDEFAULT); |
---|
225 | return; |
---|
226 | case EbnfPackage.HOOK_COMBINATOR__RULEEXT: |
---|
227 | setRuleext(RULEEXT_EDEFAULT); |
---|
228 | return; |
---|
229 | case EbnfPackage.HOOK_COMBINATOR__LABEL: |
---|
230 | getLABEL().clear(); |
---|
231 | return; |
---|
232 | } |
---|
233 | super.eUnset(featureID); |
---|
234 | } |
---|
235 | |
---|
236 | /** |
---|
237 | * <!-- begin-user-doc --> |
---|
238 | * <!-- end-user-doc --> |
---|
239 | * @generated |
---|
240 | */ |
---|
241 | @Override |
---|
242 | public boolean eIsSet(int featureID) |
---|
243 | { |
---|
244 | switch (featureID) |
---|
245 | { |
---|
246 | case EbnfPackage.HOOK_COMBINATOR__NAME: |
---|
247 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
---|
248 | case EbnfPackage.HOOK_COMBINATOR__RULEEXT: |
---|
249 | return ruleext != RULEEXT_EDEFAULT; |
---|
250 | case EbnfPackage.HOOK_COMBINATOR__LABEL: |
---|
251 | return label != null && !label.isEmpty(); |
---|
252 | } |
---|
253 | return super.eIsSet(featureID); |
---|
254 | } |
---|
255 | |
---|
256 | /** |
---|
257 | * <!-- begin-user-doc --> |
---|
258 | * <!-- end-user-doc --> |
---|
259 | * @generated |
---|
260 | */ |
---|
261 | @Override |
---|
262 | public String toString() |
---|
263 | { |
---|
264 | if (eIsProxy()) return super.toString(); |
---|
265 | |
---|
266 | StringBuffer result = new StringBuffer(super.toString()); |
---|
267 | result.append(" (name: "); |
---|
268 | result.append(name); |
---|
269 | result.append(", ruleext: "); |
---|
270 | result.append(ruleext); |
---|
271 | result.append(", LABEL: "); |
---|
272 | result.append(label); |
---|
273 | result.append(')'); |
---|
274 | return result.toString(); |
---|
275 | } |
---|
276 | |
---|
277 | } //HookCombinatorImpl |
---|