source: branches/xtext-MDT/org.modelica.xtext/src-gen/org/modelica/xtext/modelicaBase/impl/ClassModificationImpl.java @ 540

Last change on this file since 540 was 540, checked in by nasko, 15 years ago

Added subfolders/files of org.modelica.xtext

File size: 16.6 KB
Line 
1/**
2 * <copyright>
3 * </copyright>
4 *
5 */
6package org.modelica.xtext.modelicaBase.impl;
7
8import java.util.Collection;
9
10import org.eclipse.emf.common.notify.Notification;
11import org.eclipse.emf.common.notify.NotificationChain;
12
13import org.eclipse.emf.common.util.EList;
14
15import org.eclipse.emf.ecore.EClass;
16import org.eclipse.emf.ecore.InternalEObject;
17
18import org.eclipse.emf.ecore.impl.ENotificationImpl;
19
20import org.eclipse.emf.ecore.util.EObjectContainmentEList;
21import org.eclipse.emf.ecore.util.InternalEList;
22
23import org.modelica.xtext.modelicaBase.Annotation;
24import org.modelica.xtext.modelicaBase.ClassModification;
25import org.modelica.xtext.modelicaBase.ClassType;
26import org.modelica.xtext.modelicaBase.Comment;
27import org.modelica.xtext.modelicaBase.ModelicaBasePackage;
28import org.modelica.xtext.modelicaBase.Modification;
29import org.modelica.xtext.modelicaBase.TypeSpecifier;
30import org.modelica.xtext.modelicaBase.argument;
31
32/**
33 * <!-- begin-user-doc -->
34 * An implementation of the model object '<em><b>Class Modification</b></em>'.
35 * <!-- end-user-doc -->
36 * <p>
37 * The following features are implemented:
38 * <ul>
39 *   <li>{@link org.modelica.xtext.modelicaBase.impl.ClassModificationImpl#getExpression <em>Expression</em>}</li>
40 *   <li>{@link org.modelica.xtext.modelicaBase.impl.ClassModificationImpl#getClassType <em>Class Type</em>}</li>
41 *   <li>{@link org.modelica.xtext.modelicaBase.impl.ClassModificationImpl#getTypeSpecifier <em>Type Specifier</em>}</li>
42 *   <li>{@link org.modelica.xtext.modelicaBase.impl.ClassModificationImpl#getModification <em>Modification</em>}</li>
43 *   <li>{@link org.modelica.xtext.modelicaBase.impl.ClassModificationImpl#getComment <em>Comment</em>}</li>
44 *   <li>{@link org.modelica.xtext.modelicaBase.impl.ClassModificationImpl#getArguments <em>Arguments</em>}</li>
45 * </ul>
46 * </p>
47 *
48 * @generated
49 */
50public class ClassModificationImpl extends EntityDefinitionImpl implements ClassModification
51{
52  /**
53   * The default value of the '{@link #getExpression() <em>Expression</em>}' attribute.
54   * <!-- begin-user-doc -->
55   * <!-- end-user-doc -->
56   * @see #getExpression()
57   * @generated
58   * @ordered
59   */
60  protected static final String EXPRESSION_EDEFAULT = null;
61
62  /**
63   * The cached value of the '{@link #getExpression() <em>Expression</em>}' attribute.
64   * <!-- begin-user-doc -->
65   * <!-- end-user-doc -->
66   * @see #getExpression()
67   * @generated
68   * @ordered
69   */
70  protected String expression = EXPRESSION_EDEFAULT;
71
72  /**
73   * The default value of the '{@link #getClassType() <em>Class Type</em>}' attribute.
74   * <!-- begin-user-doc -->
75   * <!-- end-user-doc -->
76   * @see #getClassType()
77   * @generated
78   * @ordered
79   */
80  protected static final ClassType CLASS_TYPE_EDEFAULT = ClassType.CLASS;
81
82  /**
83   * The cached value of the '{@link #getClassType() <em>Class Type</em>}' attribute.
84   * <!-- begin-user-doc -->
85   * <!-- end-user-doc -->
86   * @see #getClassType()
87   * @generated
88   * @ordered
89   */
90  protected ClassType classType = CLASS_TYPE_EDEFAULT;
91
92  /**
93   * The cached value of the '{@link #getTypeSpecifier() <em>Type Specifier</em>}' containment reference.
94   * <!-- begin-user-doc -->
95   * <!-- end-user-doc -->
96   * @see #getTypeSpecifier()
97   * @generated
98   * @ordered
99   */
100  protected TypeSpecifier typeSpecifier;
101
102  /**
103   * The cached value of the '{@link #getModification() <em>Modification</em>}' containment reference.
104   * <!-- begin-user-doc -->
105   * <!-- end-user-doc -->
106   * @see #getModification()
107   * @generated
108   * @ordered
109   */
110  protected ClassModification modification;
111
112  /**
113   * The cached value of the '{@link #getComment() <em>Comment</em>}' containment reference.
114   * <!-- begin-user-doc -->
115   * <!-- end-user-doc -->
116   * @see #getComment()
117   * @generated
118   * @ordered
119   */
120  protected Comment comment;
121
122  /**
123   * The cached value of the '{@link #getArguments() <em>Arguments</em>}' containment reference list.
124   * <!-- begin-user-doc -->
125   * <!-- end-user-doc -->
126   * @see #getArguments()
127   * @generated
128   * @ordered
129   */
130  protected EList<argument> arguments;
131
132  /**
133   * <!-- begin-user-doc -->
134   * <!-- end-user-doc -->
135   * @generated
136   */
137  protected ClassModificationImpl()
138  {
139    super();
140  }
141
142  /**
143   * <!-- begin-user-doc -->
144   * <!-- end-user-doc -->
145   * @generated
146   */
147  @Override
148  protected EClass eStaticClass()
149  {
150    return ModelicaBasePackage.Literals.CLASS_MODIFICATION;
151  }
152
153  /**
154   * <!-- begin-user-doc -->
155   * <!-- end-user-doc -->
156   * @generated
157   */
158  public String getExpression()
159  {
160    return expression;
161  }
162
163  /**
164   * <!-- begin-user-doc -->
165   * <!-- end-user-doc -->
166   * @generated
167   */
168  public void setExpression(String newExpression)
169  {
170    String oldExpression = expression;
171    expression = newExpression;
172    if (eNotificationRequired())
173      eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CLASS_MODIFICATION__EXPRESSION, oldExpression, expression));
174  }
175
176  /**
177   * <!-- begin-user-doc -->
178   * <!-- end-user-doc -->
179   * @generated
180   */
181  public ClassType getClassType()
182  {
183    return classType;
184  }
185
186  /**
187   * <!-- begin-user-doc -->
188   * <!-- end-user-doc -->
189   * @generated
190   */
191  public void setClassType(ClassType newClassType)
192  {
193    ClassType oldClassType = classType;
194    classType = newClassType == null ? CLASS_TYPE_EDEFAULT : newClassType;
195    if (eNotificationRequired())
196      eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CLASS_MODIFICATION__CLASS_TYPE, oldClassType, classType));
197  }
198
199  /**
200   * <!-- begin-user-doc -->
201   * <!-- end-user-doc -->
202   * @generated
203   */
204  public TypeSpecifier getTypeSpecifier()
205  {
206    return typeSpecifier;
207  }
208
209  /**
210   * <!-- begin-user-doc -->
211   * <!-- end-user-doc -->
212   * @generated
213   */
214  public NotificationChain basicSetTypeSpecifier(TypeSpecifier newTypeSpecifier, NotificationChain msgs)
215  {
216    TypeSpecifier oldTypeSpecifier = typeSpecifier;
217    typeSpecifier = newTypeSpecifier;
218    if (eNotificationRequired())
219    {
220      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CLASS_MODIFICATION__TYPE_SPECIFIER, oldTypeSpecifier, newTypeSpecifier);
221      if (msgs == null) msgs = notification; else msgs.add(notification);
222    }
223    return msgs;
224  }
225
226  /**
227   * <!-- begin-user-doc -->
228   * <!-- end-user-doc -->
229   * @generated
230   */
231  public void setTypeSpecifier(TypeSpecifier newTypeSpecifier)
232  {
233    if (newTypeSpecifier != typeSpecifier)
234    {
235      NotificationChain msgs = null;
236      if (typeSpecifier != null)
237        msgs = ((InternalEObject)typeSpecifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.CLASS_MODIFICATION__TYPE_SPECIFIER, null, msgs);
238      if (newTypeSpecifier != null)
239        msgs = ((InternalEObject)newTypeSpecifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.CLASS_MODIFICATION__TYPE_SPECIFIER, null, msgs);
240      msgs = basicSetTypeSpecifier(newTypeSpecifier, msgs);
241      if (msgs != null) msgs.dispatch();
242    }
243    else if (eNotificationRequired())
244      eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CLASS_MODIFICATION__TYPE_SPECIFIER, newTypeSpecifier, newTypeSpecifier));
245  }
246
247  /**
248   * <!-- begin-user-doc -->
249   * <!-- end-user-doc -->
250   * @generated
251   */
252  public ClassModification getModification()
253  {
254    return modification;
255  }
256
257  /**
258   * <!-- begin-user-doc -->
259   * <!-- end-user-doc -->
260   * @generated
261   */
262  public NotificationChain basicSetModification(ClassModification newModification, NotificationChain msgs)
263  {
264    ClassModification oldModification = modification;
265    modification = newModification;
266    if (eNotificationRequired())
267    {
268      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CLASS_MODIFICATION__MODIFICATION, oldModification, newModification);
269      if (msgs == null) msgs = notification; else msgs.add(notification);
270    }
271    return msgs;
272  }
273
274  /**
275   * <!-- begin-user-doc -->
276   * <!-- end-user-doc -->
277   * @generated
278   */
279  public void setModification(ClassModification newModification)
280  {
281    if (newModification != modification)
282    {
283      NotificationChain msgs = null;
284      if (modification != null)
285        msgs = ((InternalEObject)modification).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.CLASS_MODIFICATION__MODIFICATION, null, msgs);
286      if (newModification != null)
287        msgs = ((InternalEObject)newModification).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.CLASS_MODIFICATION__MODIFICATION, null, msgs);
288      msgs = basicSetModification(newModification, msgs);
289      if (msgs != null) msgs.dispatch();
290    }
291    else if (eNotificationRequired())
292      eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CLASS_MODIFICATION__MODIFICATION, newModification, newModification));
293  }
294
295  /**
296   * <!-- begin-user-doc -->
297   * <!-- end-user-doc -->
298   * @generated
299   */
300  public Comment getComment()
301  {
302    return comment;
303  }
304
305  /**
306   * <!-- begin-user-doc -->
307   * <!-- end-user-doc -->
308   * @generated
309   */
310  public NotificationChain basicSetComment(Comment newComment, NotificationChain msgs)
311  {
312    Comment oldComment = comment;
313    comment = newComment;
314    if (eNotificationRequired())
315    {
316      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CLASS_MODIFICATION__COMMENT, oldComment, newComment);
317      if (msgs == null) msgs = notification; else msgs.add(notification);
318    }
319    return msgs;
320  }
321
322  /**
323   * <!-- begin-user-doc -->
324   * <!-- end-user-doc -->
325   * @generated
326   */
327  public void setComment(Comment newComment)
328  {
329    if (newComment != comment)
330    {
331      NotificationChain msgs = null;
332      if (comment != null)
333        msgs = ((InternalEObject)comment).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.CLASS_MODIFICATION__COMMENT, null, msgs);
334      if (newComment != null)
335        msgs = ((InternalEObject)newComment).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.CLASS_MODIFICATION__COMMENT, null, msgs);
336      msgs = basicSetComment(newComment, msgs);
337      if (msgs != null) msgs.dispatch();
338    }
339    else if (eNotificationRequired())
340      eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CLASS_MODIFICATION__COMMENT, newComment, newComment));
341  }
342
343  /**
344   * <!-- begin-user-doc -->
345   * <!-- end-user-doc -->
346   * @generated
347   */
348  public EList<argument> getArguments()
349  {
350    if (arguments == null)
351    {
352      arguments = new EObjectContainmentEList<argument>(argument.class, this, ModelicaBasePackage.CLASS_MODIFICATION__ARGUMENTS);
353    }
354    return arguments;
355  }
356
357  /**
358   * <!-- begin-user-doc -->
359   * <!-- end-user-doc -->
360   * @generated
361   */
362  @Override
363  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
364  {
365    switch (featureID)
366    {
367      case ModelicaBasePackage.CLASS_MODIFICATION__TYPE_SPECIFIER:
368        return basicSetTypeSpecifier(null, msgs);
369      case ModelicaBasePackage.CLASS_MODIFICATION__MODIFICATION:
370        return basicSetModification(null, msgs);
371      case ModelicaBasePackage.CLASS_MODIFICATION__COMMENT:
372        return basicSetComment(null, msgs);
373      case ModelicaBasePackage.CLASS_MODIFICATION__ARGUMENTS:
374        return ((InternalEList<?>)getArguments()).basicRemove(otherEnd, msgs);
375    }
376    return super.eInverseRemove(otherEnd, featureID, msgs);
377  }
378
379  /**
380   * <!-- begin-user-doc -->
381   * <!-- end-user-doc -->
382   * @generated
383   */
384  @Override
385  public Object eGet(int featureID, boolean resolve, boolean coreType)
386  {
387    switch (featureID)
388    {
389      case ModelicaBasePackage.CLASS_MODIFICATION__EXPRESSION:
390        return getExpression();
391      case ModelicaBasePackage.CLASS_MODIFICATION__CLASS_TYPE:
392        return getClassType();
393      case ModelicaBasePackage.CLASS_MODIFICATION__TYPE_SPECIFIER:
394        return getTypeSpecifier();
395      case ModelicaBasePackage.CLASS_MODIFICATION__MODIFICATION:
396        return getModification();
397      case ModelicaBasePackage.CLASS_MODIFICATION__COMMENT:
398        return getComment();
399      case ModelicaBasePackage.CLASS_MODIFICATION__ARGUMENTS:
400        return getArguments();
401    }
402    return super.eGet(featureID, resolve, coreType);
403  }
404
405  /**
406   * <!-- begin-user-doc -->
407   * <!-- end-user-doc -->
408   * @generated
409   */
410  @SuppressWarnings("unchecked")
411  @Override
412  public void eSet(int featureID, Object newValue)
413  {
414    switch (featureID)
415    {
416      case ModelicaBasePackage.CLASS_MODIFICATION__EXPRESSION:
417        setExpression((String)newValue);
418        return;
419      case ModelicaBasePackage.CLASS_MODIFICATION__CLASS_TYPE:
420        setClassType((ClassType)newValue);
421        return;
422      case ModelicaBasePackage.CLASS_MODIFICATION__TYPE_SPECIFIER:
423        setTypeSpecifier((TypeSpecifier)newValue);
424        return;
425      case ModelicaBasePackage.CLASS_MODIFICATION__MODIFICATION:
426        setModification((ClassModification)newValue);
427        return;
428      case ModelicaBasePackage.CLASS_MODIFICATION__COMMENT:
429        setComment((Comment)newValue);
430        return;
431      case ModelicaBasePackage.CLASS_MODIFICATION__ARGUMENTS:
432        getArguments().clear();
433        getArguments().addAll((Collection<? extends argument>)newValue);
434        return;
435    }
436    super.eSet(featureID, newValue);
437  }
438
439  /**
440   * <!-- begin-user-doc -->
441   * <!-- end-user-doc -->
442   * @generated
443   */
444  @Override
445  public void eUnset(int featureID)
446  {
447    switch (featureID)
448    {
449      case ModelicaBasePackage.CLASS_MODIFICATION__EXPRESSION:
450        setExpression(EXPRESSION_EDEFAULT);
451        return;
452      case ModelicaBasePackage.CLASS_MODIFICATION__CLASS_TYPE:
453        setClassType(CLASS_TYPE_EDEFAULT);
454        return;
455      case ModelicaBasePackage.CLASS_MODIFICATION__TYPE_SPECIFIER:
456        setTypeSpecifier((TypeSpecifier)null);
457        return;
458      case ModelicaBasePackage.CLASS_MODIFICATION__MODIFICATION:
459        setModification((ClassModification)null);
460        return;
461      case ModelicaBasePackage.CLASS_MODIFICATION__COMMENT:
462        setComment((Comment)null);
463        return;
464      case ModelicaBasePackage.CLASS_MODIFICATION__ARGUMENTS:
465        getArguments().clear();
466        return;
467    }
468    super.eUnset(featureID);
469  }
470
471  /**
472   * <!-- begin-user-doc -->
473   * <!-- end-user-doc -->
474   * @generated
475   */
476  @Override
477  public boolean eIsSet(int featureID)
478  {
479    switch (featureID)
480    {
481      case ModelicaBasePackage.CLASS_MODIFICATION__EXPRESSION:
482        return EXPRESSION_EDEFAULT == null ? expression != null : !EXPRESSION_EDEFAULT.equals(expression);
483      case ModelicaBasePackage.CLASS_MODIFICATION__CLASS_TYPE:
484        return classType != CLASS_TYPE_EDEFAULT;
485      case ModelicaBasePackage.CLASS_MODIFICATION__TYPE_SPECIFIER:
486        return typeSpecifier != null;
487      case ModelicaBasePackage.CLASS_MODIFICATION__MODIFICATION:
488        return modification != null;
489      case ModelicaBasePackage.CLASS_MODIFICATION__COMMENT:
490        return comment != null;
491      case ModelicaBasePackage.CLASS_MODIFICATION__ARGUMENTS:
492        return arguments != null && !arguments.isEmpty();
493    }
494    return super.eIsSet(featureID);
495  }
496
497  /**
498   * <!-- begin-user-doc -->
499   * <!-- end-user-doc -->
500   * @generated
501   */
502  @Override
503  public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
504  {
505    if (baseClass == Modification.class)
506    {
507      switch (derivedFeatureID)
508      {
509        case ModelicaBasePackage.CLASS_MODIFICATION__EXPRESSION: return ModelicaBasePackage.MODIFICATION__EXPRESSION;
510        default: return -1;
511      }
512    }
513    if (baseClass == Annotation.class)
514    {
515      switch (derivedFeatureID)
516      {
517        default: return -1;
518      }
519    }
520    return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
521  }
522
523  /**
524   * <!-- begin-user-doc -->
525   * <!-- end-user-doc -->
526   * @generated
527   */
528  @Override
529  public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass)
530  {
531    if (baseClass == Modification.class)
532    {
533      switch (baseFeatureID)
534      {
535        case ModelicaBasePackage.MODIFICATION__EXPRESSION: return ModelicaBasePackage.CLASS_MODIFICATION__EXPRESSION;
536        default: return -1;
537      }
538    }
539    if (baseClass == Annotation.class)
540    {
541      switch (baseFeatureID)
542      {
543        default: return -1;
544      }
545    }
546    return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
547  }
548
549  /**
550   * <!-- begin-user-doc -->
551   * <!-- end-user-doc -->
552   * @generated
553   */
554  @Override
555  public String toString()
556  {
557    if (eIsProxy()) return super.toString();
558
559    StringBuffer result = new StringBuffer(super.toString());
560    result.append(" (expression: ");
561    result.append(expression);
562    result.append(", classType: ");
563    result.append(classType);
564    result.append(')');
565    return result.toString();
566  }
567
568} //ClassModificationImpl
Note: See TracBrowser for help on using the repository browser.