1 | /** |
---|
2 | */ |
---|
3 | package de.ugoe.cs.swe.bnftools.ebnf.impl; |
---|
4 | |
---|
5 | import de.ugoe.cs.swe.bnftools.ebnf.BnfEntry; |
---|
6 | import de.ugoe.cs.swe.bnftools.ebnf.DeltaEntry; |
---|
7 | import de.ugoe.cs.swe.bnftools.ebnf.EbnfPackage; |
---|
8 | import de.ugoe.cs.swe.bnftools.ebnf.EtsiBnf; |
---|
9 | import de.ugoe.cs.swe.bnftools.ebnf.ImportSection; |
---|
10 | import de.ugoe.cs.swe.bnftools.ebnf.MergeEntry; |
---|
11 | |
---|
12 | import java.util.Collection; |
---|
13 | |
---|
14 | import org.eclipse.emf.common.notify.Notification; |
---|
15 | import org.eclipse.emf.common.notify.NotificationChain; |
---|
16 | |
---|
17 | import org.eclipse.emf.common.util.EList; |
---|
18 | |
---|
19 | import org.eclipse.emf.ecore.EClass; |
---|
20 | import org.eclipse.emf.ecore.InternalEObject; |
---|
21 | |
---|
22 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
---|
23 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
---|
24 | |
---|
25 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
---|
26 | import org.eclipse.emf.ecore.util.InternalEList; |
---|
27 | |
---|
28 | /** |
---|
29 | * <!-- begin-user-doc --> |
---|
30 | * An implementation of the model object '<em><b>Etsi Bnf</b></em>'. |
---|
31 | * <!-- end-user-doc --> |
---|
32 | * <p> |
---|
33 | * The following features are implemented: |
---|
34 | * <ul> |
---|
35 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getName <em>Name</em>}</li> |
---|
36 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getType <em>Type</em>}</li> |
---|
37 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getImportSection <em>Import Section</em>}</li> |
---|
38 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getBnfEntry <em>Bnf Entry</em>}</li> |
---|
39 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getDeltaEntry <em>Delta Entry</em>}</li> |
---|
40 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getMergeEntry <em>Merge Entry</em>}</li> |
---|
41 | * </ul> |
---|
42 | * </p> |
---|
43 | * |
---|
44 | * @generated |
---|
45 | */ |
---|
46 | public class EtsiBnfImpl extends MinimalEObjectImpl.Container implements EtsiBnf |
---|
47 | { |
---|
48 | /** |
---|
49 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
---|
50 | * <!-- begin-user-doc --> |
---|
51 | * <!-- end-user-doc --> |
---|
52 | * @see #getName() |
---|
53 | * @generated |
---|
54 | * @ordered |
---|
55 | */ |
---|
56 | protected static final String NAME_EDEFAULT = null; |
---|
57 | |
---|
58 | /** |
---|
59 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
---|
60 | * <!-- begin-user-doc --> |
---|
61 | * <!-- end-user-doc --> |
---|
62 | * @see #getName() |
---|
63 | * @generated |
---|
64 | * @ordered |
---|
65 | */ |
---|
66 | protected String name = NAME_EDEFAULT; |
---|
67 | |
---|
68 | /** |
---|
69 | * The default value of the '{@link #getType() <em>Type</em>}' attribute. |
---|
70 | * <!-- begin-user-doc --> |
---|
71 | * <!-- end-user-doc --> |
---|
72 | * @see #getType() |
---|
73 | * @generated |
---|
74 | * @ordered |
---|
75 | */ |
---|
76 | protected static final String TYPE_EDEFAULT = null; |
---|
77 | |
---|
78 | /** |
---|
79 | * The cached value of the '{@link #getType() <em>Type</em>}' attribute. |
---|
80 | * <!-- begin-user-doc --> |
---|
81 | * <!-- end-user-doc --> |
---|
82 | * @see #getType() |
---|
83 | * @generated |
---|
84 | * @ordered |
---|
85 | */ |
---|
86 | protected String type = TYPE_EDEFAULT; |
---|
87 | |
---|
88 | /** |
---|
89 | * The cached value of the '{@link #getImportSection() <em>Import Section</em>}' containment reference. |
---|
90 | * <!-- begin-user-doc --> |
---|
91 | * <!-- end-user-doc --> |
---|
92 | * @see #getImportSection() |
---|
93 | * @generated |
---|
94 | * @ordered |
---|
95 | */ |
---|
96 | protected ImportSection importSection; |
---|
97 | |
---|
98 | /** |
---|
99 | * The cached value of the '{@link #getBnfEntry() <em>Bnf Entry</em>}' containment reference list. |
---|
100 | * <!-- begin-user-doc --> |
---|
101 | * <!-- end-user-doc --> |
---|
102 | * @see #getBnfEntry() |
---|
103 | * @generated |
---|
104 | * @ordered |
---|
105 | */ |
---|
106 | protected EList<BnfEntry> bnfEntry; |
---|
107 | |
---|
108 | /** |
---|
109 | * The cached value of the '{@link #getDeltaEntry() <em>Delta Entry</em>}' containment reference list. |
---|
110 | * <!-- begin-user-doc --> |
---|
111 | * <!-- end-user-doc --> |
---|
112 | * @see #getDeltaEntry() |
---|
113 | * @generated |
---|
114 | * @ordered |
---|
115 | */ |
---|
116 | protected EList<DeltaEntry> deltaEntry; |
---|
117 | |
---|
118 | /** |
---|
119 | * The cached value of the '{@link #getMergeEntry() <em>Merge Entry</em>}' containment reference list. |
---|
120 | * <!-- begin-user-doc --> |
---|
121 | * <!-- end-user-doc --> |
---|
122 | * @see #getMergeEntry() |
---|
123 | * @generated |
---|
124 | * @ordered |
---|
125 | */ |
---|
126 | protected EList<MergeEntry> mergeEntry; |
---|
127 | |
---|
128 | /** |
---|
129 | * <!-- begin-user-doc --> |
---|
130 | * <!-- end-user-doc --> |
---|
131 | * @generated |
---|
132 | */ |
---|
133 | protected EtsiBnfImpl() |
---|
134 | { |
---|
135 | super(); |
---|
136 | } |
---|
137 | |
---|
138 | /** |
---|
139 | * <!-- begin-user-doc --> |
---|
140 | * <!-- end-user-doc --> |
---|
141 | * @generated |
---|
142 | */ |
---|
143 | @Override |
---|
144 | protected EClass eStaticClass() |
---|
145 | { |
---|
146 | return EbnfPackage.Literals.ETSI_BNF; |
---|
147 | } |
---|
148 | |
---|
149 | /** |
---|
150 | * <!-- begin-user-doc --> |
---|
151 | * <!-- end-user-doc --> |
---|
152 | * @generated |
---|
153 | */ |
---|
154 | public String getName() |
---|
155 | { |
---|
156 | return name; |
---|
157 | } |
---|
158 | |
---|
159 | /** |
---|
160 | * <!-- begin-user-doc --> |
---|
161 | * <!-- end-user-doc --> |
---|
162 | * @generated |
---|
163 | */ |
---|
164 | public void setName(String newName) |
---|
165 | { |
---|
166 | String oldName = name; |
---|
167 | name = newName; |
---|
168 | if (eNotificationRequired()) |
---|
169 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.ETSI_BNF__NAME, oldName, name)); |
---|
170 | } |
---|
171 | |
---|
172 | /** |
---|
173 | * <!-- begin-user-doc --> |
---|
174 | * <!-- end-user-doc --> |
---|
175 | * @generated |
---|
176 | */ |
---|
177 | public String getType() |
---|
178 | { |
---|
179 | return type; |
---|
180 | } |
---|
181 | |
---|
182 | /** |
---|
183 | * <!-- begin-user-doc --> |
---|
184 | * <!-- end-user-doc --> |
---|
185 | * @generated |
---|
186 | */ |
---|
187 | public void setType(String newType) |
---|
188 | { |
---|
189 | String oldType = type; |
---|
190 | type = newType; |
---|
191 | if (eNotificationRequired()) |
---|
192 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.ETSI_BNF__TYPE, oldType, type)); |
---|
193 | } |
---|
194 | |
---|
195 | /** |
---|
196 | * <!-- begin-user-doc --> |
---|
197 | * <!-- end-user-doc --> |
---|
198 | * @generated |
---|
199 | */ |
---|
200 | public ImportSection getImportSection() |
---|
201 | { |
---|
202 | return importSection; |
---|
203 | } |
---|
204 | |
---|
205 | /** |
---|
206 | * <!-- begin-user-doc --> |
---|
207 | * <!-- end-user-doc --> |
---|
208 | * @generated |
---|
209 | */ |
---|
210 | public NotificationChain basicSetImportSection(ImportSection newImportSection, NotificationChain msgs) |
---|
211 | { |
---|
212 | ImportSection oldImportSection = importSection; |
---|
213 | importSection = newImportSection; |
---|
214 | if (eNotificationRequired()) |
---|
215 | { |
---|
216 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EbnfPackage.ETSI_BNF__IMPORT_SECTION, oldImportSection, newImportSection); |
---|
217 | if (msgs == null) msgs = notification; else msgs.add(notification); |
---|
218 | } |
---|
219 | return msgs; |
---|
220 | } |
---|
221 | |
---|
222 | /** |
---|
223 | * <!-- begin-user-doc --> |
---|
224 | * <!-- end-user-doc --> |
---|
225 | * @generated |
---|
226 | */ |
---|
227 | public void setImportSection(ImportSection newImportSection) |
---|
228 | { |
---|
229 | if (newImportSection != importSection) |
---|
230 | { |
---|
231 | NotificationChain msgs = null; |
---|
232 | if (importSection != null) |
---|
233 | msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.ETSI_BNF__IMPORT_SECTION, null, msgs); |
---|
234 | if (newImportSection != null) |
---|
235 | msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.ETSI_BNF__IMPORT_SECTION, null, msgs); |
---|
236 | msgs = basicSetImportSection(newImportSection, msgs); |
---|
237 | if (msgs != null) msgs.dispatch(); |
---|
238 | } |
---|
239 | else if (eNotificationRequired()) |
---|
240 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.ETSI_BNF__IMPORT_SECTION, newImportSection, newImportSection)); |
---|
241 | } |
---|
242 | |
---|
243 | /** |
---|
244 | * <!-- begin-user-doc --> |
---|
245 | * <!-- end-user-doc --> |
---|
246 | * @generated |
---|
247 | */ |
---|
248 | public EList<BnfEntry> getBnfEntry() |
---|
249 | { |
---|
250 | if (bnfEntry == null) |
---|
251 | { |
---|
252 | bnfEntry = new EObjectContainmentEList<BnfEntry>(BnfEntry.class, this, EbnfPackage.ETSI_BNF__BNF_ENTRY); |
---|
253 | } |
---|
254 | return bnfEntry; |
---|
255 | } |
---|
256 | |
---|
257 | /** |
---|
258 | * <!-- begin-user-doc --> |
---|
259 | * <!-- end-user-doc --> |
---|
260 | * @generated |
---|
261 | */ |
---|
262 | public EList<DeltaEntry> getDeltaEntry() |
---|
263 | { |
---|
264 | if (deltaEntry == null) |
---|
265 | { |
---|
266 | deltaEntry = new EObjectContainmentEList<DeltaEntry>(DeltaEntry.class, this, EbnfPackage.ETSI_BNF__DELTA_ENTRY); |
---|
267 | } |
---|
268 | return deltaEntry; |
---|
269 | } |
---|
270 | |
---|
271 | /** |
---|
272 | * <!-- begin-user-doc --> |
---|
273 | * <!-- end-user-doc --> |
---|
274 | * @generated |
---|
275 | */ |
---|
276 | public EList<MergeEntry> getMergeEntry() |
---|
277 | { |
---|
278 | if (mergeEntry == null) |
---|
279 | { |
---|
280 | mergeEntry = new EObjectContainmentEList<MergeEntry>(MergeEntry.class, this, EbnfPackage.ETSI_BNF__MERGE_ENTRY); |
---|
281 | } |
---|
282 | return mergeEntry; |
---|
283 | } |
---|
284 | |
---|
285 | /** |
---|
286 | * <!-- begin-user-doc --> |
---|
287 | * <!-- end-user-doc --> |
---|
288 | * @generated |
---|
289 | */ |
---|
290 | @Override |
---|
291 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
---|
292 | { |
---|
293 | switch (featureID) |
---|
294 | { |
---|
295 | case EbnfPackage.ETSI_BNF__IMPORT_SECTION: |
---|
296 | return basicSetImportSection(null, msgs); |
---|
297 | case EbnfPackage.ETSI_BNF__BNF_ENTRY: |
---|
298 | return ((InternalEList<?>)getBnfEntry()).basicRemove(otherEnd, msgs); |
---|
299 | case EbnfPackage.ETSI_BNF__DELTA_ENTRY: |
---|
300 | return ((InternalEList<?>)getDeltaEntry()).basicRemove(otherEnd, msgs); |
---|
301 | case EbnfPackage.ETSI_BNF__MERGE_ENTRY: |
---|
302 | return ((InternalEList<?>)getMergeEntry()).basicRemove(otherEnd, msgs); |
---|
303 | } |
---|
304 | return super.eInverseRemove(otherEnd, featureID, msgs); |
---|
305 | } |
---|
306 | |
---|
307 | /** |
---|
308 | * <!-- begin-user-doc --> |
---|
309 | * <!-- end-user-doc --> |
---|
310 | * @generated |
---|
311 | */ |
---|
312 | @Override |
---|
313 | public Object eGet(int featureID, boolean resolve, boolean coreType) |
---|
314 | { |
---|
315 | switch (featureID) |
---|
316 | { |
---|
317 | case EbnfPackage.ETSI_BNF__NAME: |
---|
318 | return getName(); |
---|
319 | case EbnfPackage.ETSI_BNF__TYPE: |
---|
320 | return getType(); |
---|
321 | case EbnfPackage.ETSI_BNF__IMPORT_SECTION: |
---|
322 | return getImportSection(); |
---|
323 | case EbnfPackage.ETSI_BNF__BNF_ENTRY: |
---|
324 | return getBnfEntry(); |
---|
325 | case EbnfPackage.ETSI_BNF__DELTA_ENTRY: |
---|
326 | return getDeltaEntry(); |
---|
327 | case EbnfPackage.ETSI_BNF__MERGE_ENTRY: |
---|
328 | return getMergeEntry(); |
---|
329 | } |
---|
330 | return super.eGet(featureID, resolve, coreType); |
---|
331 | } |
---|
332 | |
---|
333 | /** |
---|
334 | * <!-- begin-user-doc --> |
---|
335 | * <!-- end-user-doc --> |
---|
336 | * @generated |
---|
337 | */ |
---|
338 | @SuppressWarnings("unchecked") |
---|
339 | @Override |
---|
340 | public void eSet(int featureID, Object newValue) |
---|
341 | { |
---|
342 | switch (featureID) |
---|
343 | { |
---|
344 | case EbnfPackage.ETSI_BNF__NAME: |
---|
345 | setName((String)newValue); |
---|
346 | return; |
---|
347 | case EbnfPackage.ETSI_BNF__TYPE: |
---|
348 | setType((String)newValue); |
---|
349 | return; |
---|
350 | case EbnfPackage.ETSI_BNF__IMPORT_SECTION: |
---|
351 | setImportSection((ImportSection)newValue); |
---|
352 | return; |
---|
353 | case EbnfPackage.ETSI_BNF__BNF_ENTRY: |
---|
354 | getBnfEntry().clear(); |
---|
355 | getBnfEntry().addAll((Collection<? extends BnfEntry>)newValue); |
---|
356 | return; |
---|
357 | case EbnfPackage.ETSI_BNF__DELTA_ENTRY: |
---|
358 | getDeltaEntry().clear(); |
---|
359 | getDeltaEntry().addAll((Collection<? extends DeltaEntry>)newValue); |
---|
360 | return; |
---|
361 | case EbnfPackage.ETSI_BNF__MERGE_ENTRY: |
---|
362 | getMergeEntry().clear(); |
---|
363 | getMergeEntry().addAll((Collection<? extends MergeEntry>)newValue); |
---|
364 | return; |
---|
365 | } |
---|
366 | super.eSet(featureID, newValue); |
---|
367 | } |
---|
368 | |
---|
369 | /** |
---|
370 | * <!-- begin-user-doc --> |
---|
371 | * <!-- end-user-doc --> |
---|
372 | * @generated |
---|
373 | */ |
---|
374 | @Override |
---|
375 | public void eUnset(int featureID) |
---|
376 | { |
---|
377 | switch (featureID) |
---|
378 | { |
---|
379 | case EbnfPackage.ETSI_BNF__NAME: |
---|
380 | setName(NAME_EDEFAULT); |
---|
381 | return; |
---|
382 | case EbnfPackage.ETSI_BNF__TYPE: |
---|
383 | setType(TYPE_EDEFAULT); |
---|
384 | return; |
---|
385 | case EbnfPackage.ETSI_BNF__IMPORT_SECTION: |
---|
386 | setImportSection((ImportSection)null); |
---|
387 | return; |
---|
388 | case EbnfPackage.ETSI_BNF__BNF_ENTRY: |
---|
389 | getBnfEntry().clear(); |
---|
390 | return; |
---|
391 | case EbnfPackage.ETSI_BNF__DELTA_ENTRY: |
---|
392 | getDeltaEntry().clear(); |
---|
393 | return; |
---|
394 | case EbnfPackage.ETSI_BNF__MERGE_ENTRY: |
---|
395 | getMergeEntry().clear(); |
---|
396 | return; |
---|
397 | } |
---|
398 | super.eUnset(featureID); |
---|
399 | } |
---|
400 | |
---|
401 | /** |
---|
402 | * <!-- begin-user-doc --> |
---|
403 | * <!-- end-user-doc --> |
---|
404 | * @generated |
---|
405 | */ |
---|
406 | @Override |
---|
407 | public boolean eIsSet(int featureID) |
---|
408 | { |
---|
409 | switch (featureID) |
---|
410 | { |
---|
411 | case EbnfPackage.ETSI_BNF__NAME: |
---|
412 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
---|
413 | case EbnfPackage.ETSI_BNF__TYPE: |
---|
414 | return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); |
---|
415 | case EbnfPackage.ETSI_BNF__IMPORT_SECTION: |
---|
416 | return importSection != null; |
---|
417 | case EbnfPackage.ETSI_BNF__BNF_ENTRY: |
---|
418 | return bnfEntry != null && !bnfEntry.isEmpty(); |
---|
419 | case EbnfPackage.ETSI_BNF__DELTA_ENTRY: |
---|
420 | return deltaEntry != null && !deltaEntry.isEmpty(); |
---|
421 | case EbnfPackage.ETSI_BNF__MERGE_ENTRY: |
---|
422 | return mergeEntry != null && !mergeEntry.isEmpty(); |
---|
423 | } |
---|
424 | return super.eIsSet(featureID); |
---|
425 | } |
---|
426 | |
---|
427 | /** |
---|
428 | * <!-- begin-user-doc --> |
---|
429 | * <!-- end-user-doc --> |
---|
430 | * @generated |
---|
431 | */ |
---|
432 | @Override |
---|
433 | public String toString() |
---|
434 | { |
---|
435 | if (eIsProxy()) return super.toString(); |
---|
436 | |
---|
437 | StringBuffer result = new StringBuffer(super.toString()); |
---|
438 | result.append(" (name: "); |
---|
439 | result.append(name); |
---|
440 | result.append(", type: "); |
---|
441 | result.append(type); |
---|
442 | result.append(')'); |
---|
443 | return result.toString(); |
---|
444 | } |
---|
445 | |
---|
446 | } //EtsiBnfImpl |
---|