source: branches/xtext-MDT/org.modelica.xtext/src-gen/org/modelica/xtext/modelicaBase/impl/else_when_aImpl.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: 6.1 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;
19import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
20
21import org.eclipse.emf.ecore.util.EObjectContainmentEList;
22import org.eclipse.emf.ecore.util.InternalEList;
23
24import org.modelica.xtext.modelicaBase.ModelicaBasePackage;
25import org.modelica.xtext.modelicaBase.else_when_a;
26import org.modelica.xtext.modelicaBase.equation_rule;
27
28/**
29 * <!-- begin-user-doc -->
30 * An implementation of the model object '<em><b>else when a</b></em>'.
31 * <!-- end-user-doc -->
32 * <p>
33 * The following features are implemented:
34 * <ul>
35 *   <li>{@link org.modelica.xtext.modelicaBase.impl.else_when_aImpl#getCondition <em>Condition</em>}</li>
36 *   <li>{@link org.modelica.xtext.modelicaBase.impl.else_when_aImpl#getThenAlgorithmClauses <em>Then Algorithm Clauses</em>}</li>
37 * </ul>
38 * </p>
39 *
40 * @generated
41 */
42public class else_when_aImpl extends MinimalEObjectImpl.Container implements else_when_a
43{
44  /**
45   * The default value of the '{@link #getCondition() <em>Condition</em>}' attribute.
46   * <!-- begin-user-doc -->
47   * <!-- end-user-doc -->
48   * @see #getCondition()
49   * @generated
50   * @ordered
51   */
52  protected static final String CONDITION_EDEFAULT = null;
53
54  /**
55   * The cached value of the '{@link #getCondition() <em>Condition</em>}' attribute.
56   * <!-- begin-user-doc -->
57   * <!-- end-user-doc -->
58   * @see #getCondition()
59   * @generated
60   * @ordered
61   */
62  protected String condition = CONDITION_EDEFAULT;
63
64  /**
65   * The cached value of the '{@link #getThenAlgorithmClauses() <em>Then Algorithm Clauses</em>}' containment reference list.
66   * <!-- begin-user-doc -->
67   * <!-- end-user-doc -->
68   * @see #getThenAlgorithmClauses()
69   * @generated
70   * @ordered
71   */
72  protected EList<equation_rule> thenAlgorithmClauses;
73
74  /**
75   * <!-- begin-user-doc -->
76   * <!-- end-user-doc -->
77   * @generated
78   */
79  protected else_when_aImpl()
80  {
81    super();
82  }
83
84  /**
85   * <!-- begin-user-doc -->
86   * <!-- end-user-doc -->
87   * @generated
88   */
89  @Override
90  protected EClass eStaticClass()
91  {
92    return ModelicaBasePackage.Literals.ELSE_WHEN_A;
93  }
94
95  /**
96   * <!-- begin-user-doc -->
97   * <!-- end-user-doc -->
98   * @generated
99   */
100  public String getCondition()
101  {
102    return condition;
103  }
104
105  /**
106   * <!-- begin-user-doc -->
107   * <!-- end-user-doc -->
108   * @generated
109   */
110  public void setCondition(String newCondition)
111  {
112    String oldCondition = condition;
113    condition = newCondition;
114    if (eNotificationRequired())
115      eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.ELSE_WHEN_A__CONDITION, oldCondition, condition));
116  }
117
118  /**
119   * <!-- begin-user-doc -->
120   * <!-- end-user-doc -->
121   * @generated
122   */
123  public EList<equation_rule> getThenAlgorithmClauses()
124  {
125    if (thenAlgorithmClauses == null)
126    {
127      thenAlgorithmClauses = new EObjectContainmentEList<equation_rule>(equation_rule.class, this, ModelicaBasePackage.ELSE_WHEN_A__THEN_ALGORITHM_CLAUSES);
128    }
129    return thenAlgorithmClauses;
130  }
131
132  /**
133   * <!-- begin-user-doc -->
134   * <!-- end-user-doc -->
135   * @generated
136   */
137  @Override
138  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
139  {
140    switch (featureID)
141    {
142      case ModelicaBasePackage.ELSE_WHEN_A__THEN_ALGORITHM_CLAUSES:
143        return ((InternalEList<?>)getThenAlgorithmClauses()).basicRemove(otherEnd, msgs);
144    }
145    return super.eInverseRemove(otherEnd, featureID, msgs);
146  }
147
148  /**
149   * <!-- begin-user-doc -->
150   * <!-- end-user-doc -->
151   * @generated
152   */
153  @Override
154  public Object eGet(int featureID, boolean resolve, boolean coreType)
155  {
156    switch (featureID)
157    {
158      case ModelicaBasePackage.ELSE_WHEN_A__CONDITION:
159        return getCondition();
160      case ModelicaBasePackage.ELSE_WHEN_A__THEN_ALGORITHM_CLAUSES:
161        return getThenAlgorithmClauses();
162    }
163    return super.eGet(featureID, resolve, coreType);
164  }
165
166  /**
167   * <!-- begin-user-doc -->
168   * <!-- end-user-doc -->
169   * @generated
170   */
171  @SuppressWarnings("unchecked")
172  @Override
173  public void eSet(int featureID, Object newValue)
174  {
175    switch (featureID)
176    {
177      case ModelicaBasePackage.ELSE_WHEN_A__CONDITION:
178        setCondition((String)newValue);
179        return;
180      case ModelicaBasePackage.ELSE_WHEN_A__THEN_ALGORITHM_CLAUSES:
181        getThenAlgorithmClauses().clear();
182        getThenAlgorithmClauses().addAll((Collection<? extends equation_rule>)newValue);
183        return;
184    }
185    super.eSet(featureID, newValue);
186  }
187
188  /**
189   * <!-- begin-user-doc -->
190   * <!-- end-user-doc -->
191   * @generated
192   */
193  @Override
194  public void eUnset(int featureID)
195  {
196    switch (featureID)
197    {
198      case ModelicaBasePackage.ELSE_WHEN_A__CONDITION:
199        setCondition(CONDITION_EDEFAULT);
200        return;
201      case ModelicaBasePackage.ELSE_WHEN_A__THEN_ALGORITHM_CLAUSES:
202        getThenAlgorithmClauses().clear();
203        return;
204    }
205    super.eUnset(featureID);
206  }
207
208  /**
209   * <!-- begin-user-doc -->
210   * <!-- end-user-doc -->
211   * @generated
212   */
213  @Override
214  public boolean eIsSet(int featureID)
215  {
216    switch (featureID)
217    {
218      case ModelicaBasePackage.ELSE_WHEN_A__CONDITION:
219        return CONDITION_EDEFAULT == null ? condition != null : !CONDITION_EDEFAULT.equals(condition);
220      case ModelicaBasePackage.ELSE_WHEN_A__THEN_ALGORITHM_CLAUSES:
221        return thenAlgorithmClauses != null && !thenAlgorithmClauses.isEmpty();
222    }
223    return super.eIsSet(featureID);
224  }
225
226  /**
227   * <!-- begin-user-doc -->
228   * <!-- end-user-doc -->
229   * @generated
230   */
231  @Override
232  public String toString()
233  {
234    if (eIsProxy()) return super.toString();
235
236    StringBuffer result = new StringBuffer(super.toString());
237    result.append(" (condition: ");
238    result.append(condition);
239    result.append(')');
240    return result.toString();
241  }
242
243} //else_when_aImpl
Note: See TracBrowser for help on using the repository browser.