1 | /**
|
---|
2 | */
|
---|
3 | package de.ugoe.cs.swe.bnftools.ebnf.impl;
|
---|
4 |
|
---|
5 | import de.ugoe.cs.swe.bnftools.ebnf.DefinitionList;
|
---|
6 | import de.ugoe.cs.swe.bnftools.ebnf.EbnfPackage;
|
---|
7 | import de.ugoe.cs.swe.bnftools.ebnf.Rule;
|
---|
8 |
|
---|
9 | import org.eclipse.emf.common.notify.Notification;
|
---|
10 | import org.eclipse.emf.common.notify.NotificationChain;
|
---|
11 |
|
---|
12 | import org.eclipse.emf.ecore.EClass;
|
---|
13 | import org.eclipse.emf.ecore.InternalEObject;
|
---|
14 |
|
---|
15 | import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
---|
16 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * <!-- begin-user-doc -->
|
---|
20 | * An implementation of the model object '<em><b>Rule</b></em>'.
|
---|
21 | * <!-- end-user-doc -->
|
---|
22 | * <p>
|
---|
23 | * The following features are implemented:
|
---|
24 | * <ul>
|
---|
25 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.RuleImpl#getRulenumber <em>Rulenumber</em>}</li>
|
---|
26 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.RuleImpl#getRulevariant <em>Rulevariant</em>}</li>
|
---|
27 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.RuleImpl#getName <em>Name</em>}</li>
|
---|
28 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.RuleImpl#getDefinitionList <em>Definition List</em>}</li>
|
---|
29 | * </ul>
|
---|
30 | * </p>
|
---|
31 | *
|
---|
32 | * @generated
|
---|
33 | */
|
---|
34 | public class RuleImpl extends MinimalEObjectImpl.Container implements Rule
|
---|
35 | {
|
---|
36 | /**
|
---|
37 | * The default value of the '{@link #getRulenumber() <em>Rulenumber</em>}' attribute.
|
---|
38 | * <!-- begin-user-doc -->
|
---|
39 | * <!-- end-user-doc -->
|
---|
40 | * @see #getRulenumber()
|
---|
41 | * @generated
|
---|
42 | * @ordered
|
---|
43 | */
|
---|
44 | protected static final int RULENUMBER_EDEFAULT = 0;
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * The cached value of the '{@link #getRulenumber() <em>Rulenumber</em>}' attribute.
|
---|
48 | * <!-- begin-user-doc -->
|
---|
49 | * <!-- end-user-doc -->
|
---|
50 | * @see #getRulenumber()
|
---|
51 | * @generated
|
---|
52 | * @ordered
|
---|
53 | */
|
---|
54 | protected int rulenumber = RULENUMBER_EDEFAULT;
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * The default value of the '{@link #getRulevariant() <em>Rulevariant</em>}' attribute.
|
---|
58 | * <!-- begin-user-doc -->
|
---|
59 | * <!-- end-user-doc -->
|
---|
60 | * @see #getRulevariant()
|
---|
61 | * @generated
|
---|
62 | * @ordered
|
---|
63 | */
|
---|
64 | protected static final String RULEVARIANT_EDEFAULT = null;
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * The cached value of the '{@link #getRulevariant() <em>Rulevariant</em>}' attribute.
|
---|
68 | * <!-- begin-user-doc -->
|
---|
69 | * <!-- end-user-doc -->
|
---|
70 | * @see #getRulevariant()
|
---|
71 | * @generated
|
---|
72 | * @ordered
|
---|
73 | */
|
---|
74 | protected String rulevariant = RULEVARIANT_EDEFAULT;
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * The default value of the '{@link #getName() <em>Name</em>}' attribute.
|
---|
78 | * <!-- begin-user-doc -->
|
---|
79 | * <!-- end-user-doc -->
|
---|
80 | * @see #getName()
|
---|
81 | * @generated
|
---|
82 | * @ordered
|
---|
83 | */
|
---|
84 | protected static final String NAME_EDEFAULT = null;
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
|
---|
88 | * <!-- begin-user-doc -->
|
---|
89 | * <!-- end-user-doc -->
|
---|
90 | * @see #getName()
|
---|
91 | * @generated
|
---|
92 | * @ordered
|
---|
93 | */
|
---|
94 | protected String name = NAME_EDEFAULT;
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * The cached value of the '{@link #getDefinitionList() <em>Definition List</em>}' containment reference.
|
---|
98 | * <!-- begin-user-doc -->
|
---|
99 | * <!-- end-user-doc -->
|
---|
100 | * @see #getDefinitionList()
|
---|
101 | * @generated
|
---|
102 | * @ordered
|
---|
103 | */
|
---|
104 | protected DefinitionList definitionList;
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * <!-- begin-user-doc -->
|
---|
108 | * <!-- end-user-doc -->
|
---|
109 | * @generated
|
---|
110 | */
|
---|
111 | protected RuleImpl()
|
---|
112 | {
|
---|
113 | super();
|
---|
114 | }
|
---|
115 |
|
---|
116 | /**
|
---|
117 | * <!-- begin-user-doc -->
|
---|
118 | * <!-- end-user-doc -->
|
---|
119 | * @generated
|
---|
120 | */
|
---|
121 | @Override
|
---|
122 | protected EClass eStaticClass()
|
---|
123 | {
|
---|
124 | return EbnfPackage.Literals.RULE;
|
---|
125 | }
|
---|
126 |
|
---|
127 | /**
|
---|
128 | * <!-- begin-user-doc -->
|
---|
129 | * <!-- end-user-doc -->
|
---|
130 | * @generated
|
---|
131 | */
|
---|
132 | public int getRulenumber()
|
---|
133 | {
|
---|
134 | return rulenumber;
|
---|
135 | }
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * <!-- begin-user-doc -->
|
---|
139 | * <!-- end-user-doc -->
|
---|
140 | * @generated
|
---|
141 | */
|
---|
142 | public void setRulenumber(int newRulenumber)
|
---|
143 | {
|
---|
144 | int oldRulenumber = rulenumber;
|
---|
145 | rulenumber = newRulenumber;
|
---|
146 | if (eNotificationRequired())
|
---|
147 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.RULE__RULENUMBER, oldRulenumber, rulenumber));
|
---|
148 | }
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * <!-- begin-user-doc -->
|
---|
152 | * <!-- end-user-doc -->
|
---|
153 | * @generated
|
---|
154 | */
|
---|
155 | public String getRulevariant()
|
---|
156 | {
|
---|
157 | return rulevariant;
|
---|
158 | }
|
---|
159 |
|
---|
160 | /**
|
---|
161 | * <!-- begin-user-doc -->
|
---|
162 | * <!-- end-user-doc -->
|
---|
163 | * @generated
|
---|
164 | */
|
---|
165 | public void setRulevariant(String newRulevariant)
|
---|
166 | {
|
---|
167 | String oldRulevariant = rulevariant;
|
---|
168 | rulevariant = newRulevariant;
|
---|
169 | if (eNotificationRequired())
|
---|
170 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.RULE__RULEVARIANT, oldRulevariant, rulevariant));
|
---|
171 | }
|
---|
172 |
|
---|
173 | /**
|
---|
174 | * <!-- begin-user-doc -->
|
---|
175 | * <!-- end-user-doc -->
|
---|
176 | * @generated
|
---|
177 | */
|
---|
178 | public String getName()
|
---|
179 | {
|
---|
180 | return name;
|
---|
181 | }
|
---|
182 |
|
---|
183 | /**
|
---|
184 | * <!-- begin-user-doc -->
|
---|
185 | * <!-- end-user-doc -->
|
---|
186 | * @generated
|
---|
187 | */
|
---|
188 | public void setName(String newName)
|
---|
189 | {
|
---|
190 | String oldName = name;
|
---|
191 | name = newName;
|
---|
192 | if (eNotificationRequired())
|
---|
193 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.RULE__NAME, oldName, name));
|
---|
194 | }
|
---|
195 |
|
---|
196 | /**
|
---|
197 | * <!-- begin-user-doc -->
|
---|
198 | * <!-- end-user-doc -->
|
---|
199 | * @generated
|
---|
200 | */
|
---|
201 | public DefinitionList getDefinitionList()
|
---|
202 | {
|
---|
203 | return definitionList;
|
---|
204 | }
|
---|
205 |
|
---|
206 | /**
|
---|
207 | * <!-- begin-user-doc -->
|
---|
208 | * <!-- end-user-doc -->
|
---|
209 | * @generated
|
---|
210 | */
|
---|
211 | public NotificationChain basicSetDefinitionList(DefinitionList newDefinitionList, NotificationChain msgs)
|
---|
212 | {
|
---|
213 | DefinitionList oldDefinitionList = definitionList;
|
---|
214 | definitionList = newDefinitionList;
|
---|
215 | if (eNotificationRequired())
|
---|
216 | {
|
---|
217 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EbnfPackage.RULE__DEFINITION_LIST, oldDefinitionList, newDefinitionList);
|
---|
218 | if (msgs == null) msgs = notification; else msgs.add(notification);
|
---|
219 | }
|
---|
220 | return msgs;
|
---|
221 | }
|
---|
222 |
|
---|
223 | /**
|
---|
224 | * <!-- begin-user-doc -->
|
---|
225 | * <!-- end-user-doc -->
|
---|
226 | * @generated
|
---|
227 | */
|
---|
228 | public void setDefinitionList(DefinitionList newDefinitionList)
|
---|
229 | {
|
---|
230 | if (newDefinitionList != definitionList)
|
---|
231 | {
|
---|
232 | NotificationChain msgs = null;
|
---|
233 | if (definitionList != null)
|
---|
234 | msgs = ((InternalEObject)definitionList).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.RULE__DEFINITION_LIST, null, msgs);
|
---|
235 | if (newDefinitionList != null)
|
---|
236 | msgs = ((InternalEObject)newDefinitionList).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.RULE__DEFINITION_LIST, null, msgs);
|
---|
237 | msgs = basicSetDefinitionList(newDefinitionList, msgs);
|
---|
238 | if (msgs != null) msgs.dispatch();
|
---|
239 | }
|
---|
240 | else if (eNotificationRequired())
|
---|
241 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.RULE__DEFINITION_LIST, newDefinitionList, newDefinitionList));
|
---|
242 | }
|
---|
243 |
|
---|
244 | /**
|
---|
245 | * <!-- begin-user-doc -->
|
---|
246 | * <!-- end-user-doc -->
|
---|
247 | * @generated
|
---|
248 | */
|
---|
249 | @Override
|
---|
250 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
|
---|
251 | {
|
---|
252 | switch (featureID)
|
---|
253 | {
|
---|
254 | case EbnfPackage.RULE__DEFINITION_LIST:
|
---|
255 | return basicSetDefinitionList(null, msgs);
|
---|
256 | }
|
---|
257 | return super.eInverseRemove(otherEnd, featureID, msgs);
|
---|
258 | }
|
---|
259 |
|
---|
260 | /**
|
---|
261 | * <!-- begin-user-doc -->
|
---|
262 | * <!-- end-user-doc -->
|
---|
263 | * @generated
|
---|
264 | */
|
---|
265 | @Override
|
---|
266 | public Object eGet(int featureID, boolean resolve, boolean coreType)
|
---|
267 | {
|
---|
268 | switch (featureID)
|
---|
269 | {
|
---|
270 | case EbnfPackage.RULE__RULENUMBER:
|
---|
271 | return getRulenumber();
|
---|
272 | case EbnfPackage.RULE__RULEVARIANT:
|
---|
273 | return getRulevariant();
|
---|
274 | case EbnfPackage.RULE__NAME:
|
---|
275 | return getName();
|
---|
276 | case EbnfPackage.RULE__DEFINITION_LIST:
|
---|
277 | return getDefinitionList();
|
---|
278 | }
|
---|
279 | return super.eGet(featureID, resolve, coreType);
|
---|
280 | }
|
---|
281 |
|
---|
282 | /**
|
---|
283 | * <!-- begin-user-doc -->
|
---|
284 | * <!-- end-user-doc -->
|
---|
285 | * @generated
|
---|
286 | */
|
---|
287 | @Override
|
---|
288 | public void eSet(int featureID, Object newValue)
|
---|
289 | {
|
---|
290 | switch (featureID)
|
---|
291 | {
|
---|
292 | case EbnfPackage.RULE__RULENUMBER:
|
---|
293 | setRulenumber((Integer)newValue);
|
---|
294 | return;
|
---|
295 | case EbnfPackage.RULE__RULEVARIANT:
|
---|
296 | setRulevariant((String)newValue);
|
---|
297 | return;
|
---|
298 | case EbnfPackage.RULE__NAME:
|
---|
299 | setName((String)newValue);
|
---|
300 | return;
|
---|
301 | case EbnfPackage.RULE__DEFINITION_LIST:
|
---|
302 | setDefinitionList((DefinitionList)newValue);
|
---|
303 | return;
|
---|
304 | }
|
---|
305 | super.eSet(featureID, newValue);
|
---|
306 | }
|
---|
307 |
|
---|
308 | /**
|
---|
309 | * <!-- begin-user-doc -->
|
---|
310 | * <!-- end-user-doc -->
|
---|
311 | * @generated
|
---|
312 | */
|
---|
313 | @Override
|
---|
314 | public void eUnset(int featureID)
|
---|
315 | {
|
---|
316 | switch (featureID)
|
---|
317 | {
|
---|
318 | case EbnfPackage.RULE__RULENUMBER:
|
---|
319 | setRulenumber(RULENUMBER_EDEFAULT);
|
---|
320 | return;
|
---|
321 | case EbnfPackage.RULE__RULEVARIANT:
|
---|
322 | setRulevariant(RULEVARIANT_EDEFAULT);
|
---|
323 | return;
|
---|
324 | case EbnfPackage.RULE__NAME:
|
---|
325 | setName(NAME_EDEFAULT);
|
---|
326 | return;
|
---|
327 | case EbnfPackage.RULE__DEFINITION_LIST:
|
---|
328 | setDefinitionList((DefinitionList)null);
|
---|
329 | return;
|
---|
330 | }
|
---|
331 | super.eUnset(featureID);
|
---|
332 | }
|
---|
333 |
|
---|
334 | /**
|
---|
335 | * <!-- begin-user-doc -->
|
---|
336 | * <!-- end-user-doc -->
|
---|
337 | * @generated
|
---|
338 | */
|
---|
339 | @Override
|
---|
340 | public boolean eIsSet(int featureID)
|
---|
341 | {
|
---|
342 | switch (featureID)
|
---|
343 | {
|
---|
344 | case EbnfPackage.RULE__RULENUMBER:
|
---|
345 | return rulenumber != RULENUMBER_EDEFAULT;
|
---|
346 | case EbnfPackage.RULE__RULEVARIANT:
|
---|
347 | return RULEVARIANT_EDEFAULT == null ? rulevariant != null : !RULEVARIANT_EDEFAULT.equals(rulevariant);
|
---|
348 | case EbnfPackage.RULE__NAME:
|
---|
349 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
---|
350 | case EbnfPackage.RULE__DEFINITION_LIST:
|
---|
351 | return definitionList != null;
|
---|
352 | }
|
---|
353 | return super.eIsSet(featureID);
|
---|
354 | }
|
---|
355 |
|
---|
356 | /**
|
---|
357 | * <!-- begin-user-doc -->
|
---|
358 | * <!-- end-user-doc -->
|
---|
359 | * @generated
|
---|
360 | */
|
---|
361 | @Override
|
---|
362 | public String toString()
|
---|
363 | {
|
---|
364 | if (eIsProxy()) return super.toString();
|
---|
365 |
|
---|
366 | StringBuffer result = new StringBuffer(super.toString());
|
---|
367 | result.append(" (rulenumber: ");
|
---|
368 | result.append(rulenumber);
|
---|
369 | result.append(", rulevariant: ");
|
---|
370 | result.append(rulevariant);
|
---|
371 | result.append(", name: ");
|
---|
372 | result.append(name);
|
---|
373 | result.append(')');
|
---|
374 | return result.toString();
|
---|
375 | }
|
---|
376 |
|
---|
377 | } //RuleImpl
|
---|