View Javadoc

1   /**
2    * (c) Mod4j and contributors
3    *
4    * $Id$
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   * <!-- begin-user-doc -->
31   * An implementation of the model object '<em><b>Model Info</b></em>'.
32   * <!-- end-user-doc -->
33   * <p>
34   * The following features are implemented:
35   * <ul>
36   *   <li>{@link org.mod4j.crossx.mm.crossx.impl.ModelInfoImpl#getSymbols <em>Symbols</em>}</li>
37   *   <li>{@link org.mod4j.crossx.mm.crossx.impl.ModelInfoImpl#getLastChanged <em>Last Changed</em>}</li>
38   *   <li>{@link org.mod4j.crossx.mm.crossx.impl.ModelInfoImpl#getModelname <em>Modelname</em>}</li>
39   *   <li>{@link org.mod4j.crossx.mm.crossx.impl.ModelInfoImpl#getResource <em>Resource</em>}</li>
40   *   <li>{@link org.mod4j.crossx.mm.crossx.impl.ModelInfoImpl#getDslname <em>Dslname</em>}</li>
41   * </ul>
42   * </p>
43   *
44   * @generated
45   */
46  public class ModelInfoImpl extends EObjectImpl implements ModelInfo {
47      /**
48       * The cached value of the '{@link #getSymbols() <em>Symbols</em>}' containment reference list.
49       * <!-- begin-user-doc -->
50       * <!-- end-user-doc -->
51       * @see #getSymbols()
52       * @generated
53       * @ordered
54       */
55      protected EList<Symbol> symbols;
56  
57      /**
58       * The default value of the '{@link #getLastChanged() <em>Last Changed</em>}' attribute.
59       * <!-- begin-user-doc -->
60       * <!-- end-user-doc -->
61       * @see #getLastChanged()
62       * @generated
63       * @ordered
64       */
65      protected static final String LAST_CHANGED_EDEFAULT = "";
66  
67      /**
68       * The cached value of the '{@link #getLastChanged() <em>Last Changed</em>}' attribute.
69       * <!-- begin-user-doc -->
70       * <!-- end-user-doc -->
71       * @see #getLastChanged()
72       * @generated
73       * @ordered
74       */
75      protected String lastChanged = LAST_CHANGED_EDEFAULT;
76  
77      /**
78       * The default value of the '{@link #getModelname() <em>Modelname</em>}' attribute.
79       * <!-- begin-user-doc -->
80       * <!-- end-user-doc -->
81       * @see #getModelname()
82       * @generated
83       * @ordered
84       */
85      protected static final String MODELNAME_EDEFAULT = null;
86  
87      /**
88       * The cached value of the '{@link #getModelname() <em>Modelname</em>}' attribute.
89       * <!-- begin-user-doc -->
90       * <!-- end-user-doc -->
91       * @see #getModelname()
92       * @generated
93       * @ordered
94       */
95      protected String modelname = MODELNAME_EDEFAULT;
96  
97      /**
98       * The default value of the '{@link #getResource() <em>Resource</em>}' attribute.
99       * <!-- begin-user-doc -->
100      * <!-- end-user-doc -->
101      * @see #getResource()
102      * @generated
103      * @ordered
104      */
105     protected static final String RESOURCE_EDEFAULT = "[unknown]";
106 
107     /**
108      * The cached value of the '{@link #getResource() <em>Resource</em>}' attribute.
109      * <!-- begin-user-doc -->
110      * <!-- end-user-doc -->
111      * @see #getResource()
112      * @generated
113      * @ordered
114      */
115     protected String resource = RESOURCE_EDEFAULT;
116 
117     /**
118      * The default value of the '{@link #getDslname() <em>Dslname</em>}' attribute.
119      * <!-- begin-user-doc -->
120      * <!-- end-user-doc -->
121      * @see #getDslname()
122      * @generated
123      * @ordered
124      */
125     protected static final String DSLNAME_EDEFAULT = null;
126 
127     /**
128      * The cached value of the '{@link #getDslname() <em>Dslname</em>}' attribute.
129      * <!-- begin-user-doc -->
130      * <!-- end-user-doc -->
131      * @see #getDslname()
132      * @generated
133      * @ordered
134      */
135     protected String dslname = DSLNAME_EDEFAULT;
136 
137     /**
138      * <!-- begin-user-doc -->
139      * <!-- end-user-doc -->
140      * @generated
141      */
142     protected ModelInfoImpl() {
143         super();
144     }
145 
146     /**
147      * <!-- begin-user-doc -->
148      * <!-- end-user-doc -->
149      * @generated
150      */
151     @Override
152     protected EClass eStaticClass() {
153         return CrossxPackage.Literals.MODEL_INFO;
154     }
155 
156     /**
157      * <!-- begin-user-doc -->
158      * <!-- end-user-doc -->
159      * @generated
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      * <!-- begin-user-doc -->
170      * <!-- end-user-doc -->
171      * @generated
172      */
173     public String getLastChanged() {
174         return lastChanged;
175     }
176 
177     /**
178      * <!-- begin-user-doc -->
179      * <!-- end-user-doc -->
180      * @generated
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      * <!-- begin-user-doc -->
191      * <!-- end-user-doc -->
192      * @generated
193      */
194     public String getModelname() {
195         return modelname;
196     }
197 
198     /**
199      * <!-- begin-user-doc -->
200      * <!-- end-user-doc -->
201      * @generated
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      * <!-- begin-user-doc -->
212      * <!-- end-user-doc -->
213      * @generated
214      */
215     public String getResource() {
216         return resource;
217     }
218 
219     /**
220      * <!-- begin-user-doc -->
221      * <!-- end-user-doc -->
222      * @generated
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      * <!-- begin-user-doc -->
233      * <!-- end-user-doc -->
234      * @generated
235      */
236     public String getDslname() {
237         return dslname;
238     }
239 
240     /**
241      * <!-- begin-user-doc -->
242      * <!-- end-user-doc -->
243      * @generated
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      * <!-- begin-user-doc -->
254      * <!-- end-user-doc -->
255      * @generated
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      * <!-- begin-user-doc -->
269      * <!-- end-user-doc -->
270      * @generated
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      * <!-- begin-user-doc -->
283      * <!-- end-user-doc -->
284      * @generated
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      * <!-- begin-user-doc -->
305      * <!-- end-user-doc -->
306      * @generated
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      * <!-- begin-user-doc -->
334      * <!-- end-user-doc -->
335      * @generated
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      * <!-- begin-user-doc -->
361      * <!-- end-user-doc -->
362      * @generated
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      * <!-- begin-user-doc -->
383      * <!-- end-user-doc -->
384      * @generated
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 } //ModelInfoImpl