1
2
3
4
5
6 package org.mod4j.crossx.mm.crossx.impl;
7
8 import java.util.Collection;
9
10 import org.eclipse.emf.common.notify.Notification;
11 import org.eclipse.emf.common.notify.NotificationChain;
12
13 import org.eclipse.emf.common.util.EList;
14
15 import org.eclipse.emf.ecore.EClass;
16 import org.eclipse.emf.ecore.InternalEObject;
17
18 import org.eclipse.emf.ecore.impl.ENotificationImpl;
19 import org.eclipse.emf.ecore.impl.EObjectImpl;
20
21 import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
22 import org.eclipse.emf.ecore.util.EObjectContainmentEList;
23 import org.eclipse.emf.ecore.util.InternalEList;
24
25 import org.mod4j.crossx.mm.crossx.CrossxPackage;
26 import org.mod4j.crossx.mm.crossx.ModelInfo;
27 import org.mod4j.crossx.mm.crossx.Symbol;
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 public class ModelInfoImpl extends EObjectImpl implements ModelInfo {
47
48
49
50
51
52
53
54
55 protected EList<Symbol> symbols;
56
57
58
59
60
61
62
63
64
65 protected static final String LAST_CHANGED_EDEFAULT = "";
66
67
68
69
70
71
72
73
74
75 protected String lastChanged = LAST_CHANGED_EDEFAULT;
76
77
78
79
80
81
82
83
84
85 protected static final String MODELNAME_EDEFAULT = null;
86
87
88
89
90
91
92
93
94
95 protected String modelname = MODELNAME_EDEFAULT;
96
97
98
99
100
101
102
103
104
105 protected static final String RESOURCE_EDEFAULT = "[unknown]";
106
107
108
109
110
111
112
113
114
115 protected String resource = RESOURCE_EDEFAULT;
116
117
118
119
120
121
122
123
124
125 protected static final String DSLNAME_EDEFAULT = null;
126
127
128
129
130
131
132
133
134
135 protected String dslname = DSLNAME_EDEFAULT;
136
137
138
139
140
141
142 protected ModelInfoImpl() {
143 super();
144 }
145
146
147
148
149
150
151 @Override
152 protected EClass eStaticClass() {
153 return CrossxPackage.Literals.MODEL_INFO;
154 }
155
156
157
158
159
160
161 public EList<Symbol> getSymbols() {
162 if (symbols == null) {
163 symbols = new EObjectContainmentWithInverseEList<Symbol>(Symbol.class, this, CrossxPackage.MODEL_INFO__SYMBOLS, CrossxPackage.SYMBOL__OWNER);
164 }
165 return symbols;
166 }
167
168
169
170
171
172
173 public String getLastChanged() {
174 return lastChanged;
175 }
176
177
178
179
180
181
182 public void setLastChanged(String newLastChanged) {
183 String oldLastChanged = lastChanged;
184 lastChanged = newLastChanged;
185 if (eNotificationRequired())
186 eNotify(new ENotificationImpl(this, Notification.SET, CrossxPackage.MODEL_INFO__LAST_CHANGED, oldLastChanged, lastChanged));
187 }
188
189
190
191
192
193
194 public String getModelname() {
195 return modelname;
196 }
197
198
199
200
201
202
203 public void setModelname(String newModelname) {
204 String oldModelname = modelname;
205 modelname = newModelname;
206 if (eNotificationRequired())
207 eNotify(new ENotificationImpl(this, Notification.SET, CrossxPackage.MODEL_INFO__MODELNAME, oldModelname, modelname));
208 }
209
210
211
212
213
214
215 public String getResource() {
216 return resource;
217 }
218
219
220
221
222
223
224 public void setResource(String newResource) {
225 String oldResource = resource;
226 resource = newResource;
227 if (eNotificationRequired())
228 eNotify(new ENotificationImpl(this, Notification.SET, CrossxPackage.MODEL_INFO__RESOURCE, oldResource, resource));
229 }
230
231
232
233
234
235
236 public String getDslname() {
237 return dslname;
238 }
239
240
241
242
243
244
245 public void setDslname(String newDslname) {
246 String oldDslname = dslname;
247 dslname = newDslname;
248 if (eNotificationRequired())
249 eNotify(new ENotificationImpl(this, Notification.SET, CrossxPackage.MODEL_INFO__DSLNAME, oldDslname, dslname));
250 }
251
252
253
254
255
256
257 @SuppressWarnings("unchecked")
258 @Override
259 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
260 switch (featureID) {
261 case CrossxPackage.MODEL_INFO__SYMBOLS:
262 return ((InternalEList<InternalEObject>)(InternalEList<?>)getSymbols()).basicAdd(otherEnd, msgs);
263 }
264 return super.eInverseAdd(otherEnd, featureID, msgs);
265 }
266
267
268
269
270
271
272 @Override
273 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
274 switch (featureID) {
275 case CrossxPackage.MODEL_INFO__SYMBOLS:
276 return ((InternalEList<?>)getSymbols()).basicRemove(otherEnd, msgs);
277 }
278 return super.eInverseRemove(otherEnd, featureID, msgs);
279 }
280
281
282
283
284
285
286 @Override
287 public Object eGet(int featureID, boolean resolve, boolean coreType) {
288 switch (featureID) {
289 case CrossxPackage.MODEL_INFO__SYMBOLS:
290 return getSymbols();
291 case CrossxPackage.MODEL_INFO__LAST_CHANGED:
292 return getLastChanged();
293 case CrossxPackage.MODEL_INFO__MODELNAME:
294 return getModelname();
295 case CrossxPackage.MODEL_INFO__RESOURCE:
296 return getResource();
297 case CrossxPackage.MODEL_INFO__DSLNAME:
298 return getDslname();
299 }
300 return super.eGet(featureID, resolve, coreType);
301 }
302
303
304
305
306
307
308 @SuppressWarnings("unchecked")
309 @Override
310 public void eSet(int featureID, Object newValue) {
311 switch (featureID) {
312 case CrossxPackage.MODEL_INFO__SYMBOLS:
313 getSymbols().clear();
314 getSymbols().addAll((Collection<? extends Symbol>)newValue);
315 return;
316 case CrossxPackage.MODEL_INFO__LAST_CHANGED:
317 setLastChanged((String)newValue);
318 return;
319 case CrossxPackage.MODEL_INFO__MODELNAME:
320 setModelname((String)newValue);
321 return;
322 case CrossxPackage.MODEL_INFO__RESOURCE:
323 setResource((String)newValue);
324 return;
325 case CrossxPackage.MODEL_INFO__DSLNAME:
326 setDslname((String)newValue);
327 return;
328 }
329 super.eSet(featureID, newValue);
330 }
331
332
333
334
335
336
337 @Override
338 public void eUnset(int featureID) {
339 switch (featureID) {
340 case CrossxPackage.MODEL_INFO__SYMBOLS:
341 getSymbols().clear();
342 return;
343 case CrossxPackage.MODEL_INFO__LAST_CHANGED:
344 setLastChanged(LAST_CHANGED_EDEFAULT);
345 return;
346 case CrossxPackage.MODEL_INFO__MODELNAME:
347 setModelname(MODELNAME_EDEFAULT);
348 return;
349 case CrossxPackage.MODEL_INFO__RESOURCE:
350 setResource(RESOURCE_EDEFAULT);
351 return;
352 case CrossxPackage.MODEL_INFO__DSLNAME:
353 setDslname(DSLNAME_EDEFAULT);
354 return;
355 }
356 super.eUnset(featureID);
357 }
358
359
360
361
362
363
364 @Override
365 public boolean eIsSet(int featureID) {
366 switch (featureID) {
367 case CrossxPackage.MODEL_INFO__SYMBOLS:
368 return symbols != null && !symbols.isEmpty();
369 case CrossxPackage.MODEL_INFO__LAST_CHANGED:
370 return LAST_CHANGED_EDEFAULT == null ? lastChanged != null : !LAST_CHANGED_EDEFAULT.equals(lastChanged);
371 case CrossxPackage.MODEL_INFO__MODELNAME:
372 return MODELNAME_EDEFAULT == null ? modelname != null : !MODELNAME_EDEFAULT.equals(modelname);
373 case CrossxPackage.MODEL_INFO__RESOURCE:
374 return RESOURCE_EDEFAULT == null ? resource != null : !RESOURCE_EDEFAULT.equals(resource);
375 case CrossxPackage.MODEL_INFO__DSLNAME:
376 return DSLNAME_EDEFAULT == null ? dslname != null : !DSLNAME_EDEFAULT.equals(dslname);
377 }
378 return super.eIsSet(featureID);
379 }
380
381
382
383
384
385
386 @Override
387 public String toString() {
388 if (eIsProxy()) return super.toString();
389
390 StringBuffer result = new StringBuffer(super.toString());
391 result.append(" (lastChanged: ");
392 result.append(lastChanged);
393 result.append(", modelname: ");
394 result.append(modelname);
395 result.append(", resource: ");
396 result.append(resource);
397 result.append(", dslname: ");
398 result.append(dslname);
399 result.append(')');
400 return result.toString();
401 }
402
403 }