1 | /** |
---|
2 | * <copyright> |
---|
3 | * </copyright> |
---|
4 | * |
---|
5 | */ |
---|
6 | package org.modelica.xtext.modelicaBase.impl; |
---|
7 | |
---|
8 | import org.eclipse.emf.common.notify.Notification; |
---|
9 | import org.eclipse.emf.common.notify.NotificationChain; |
---|
10 | |
---|
11 | import org.eclipse.emf.ecore.EClass; |
---|
12 | import org.eclipse.emf.ecore.InternalEObject; |
---|
13 | |
---|
14 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
---|
15 | |
---|
16 | import org.modelica.xtext.modelicaBase.ClassElement; |
---|
17 | import org.modelica.xtext.modelicaBase.ConstrainingClause; |
---|
18 | import org.modelica.xtext.modelicaBase.ModelicaBasePackage; |
---|
19 | import org.modelica.xtext.modelicaBase.ReplaceableElementClause; |
---|
20 | |
---|
21 | /** |
---|
22 | * <!-- begin-user-doc --> |
---|
23 | * An implementation of the model object '<em><b>Replaceable Element Clause</b></em>'. |
---|
24 | * <!-- end-user-doc --> |
---|
25 | * <p> |
---|
26 | * The following features are implemented: |
---|
27 | * <ul> |
---|
28 | * <li>{@link org.modelica.xtext.modelicaBase.impl.ReplaceableElementClauseImpl#getEntity <em>Entity</em>}</li> |
---|
29 | * <li>{@link org.modelica.xtext.modelicaBase.impl.ReplaceableElementClauseImpl#getConstrain <em>Constrain</em>}</li> |
---|
30 | * </ul> |
---|
31 | * </p> |
---|
32 | * |
---|
33 | * @generated |
---|
34 | */ |
---|
35 | public class ReplaceableElementClauseImpl extends ClassElementImpl implements ReplaceableElementClause |
---|
36 | { |
---|
37 | /** |
---|
38 | * The cached value of the '{@link #getEntity() <em>Entity</em>}' containment reference. |
---|
39 | * <!-- begin-user-doc --> |
---|
40 | * <!-- end-user-doc --> |
---|
41 | * @see #getEntity() |
---|
42 | * @generated |
---|
43 | * @ordered |
---|
44 | */ |
---|
45 | protected ClassElement entity; |
---|
46 | |
---|
47 | /** |
---|
48 | * The cached value of the '{@link #getConstrain() <em>Constrain</em>}' containment reference. |
---|
49 | * <!-- begin-user-doc --> |
---|
50 | * <!-- end-user-doc --> |
---|
51 | * @see #getConstrain() |
---|
52 | * @generated |
---|
53 | * @ordered |
---|
54 | */ |
---|
55 | protected ConstrainingClause constrain; |
---|
56 | |
---|
57 | /** |
---|
58 | * <!-- begin-user-doc --> |
---|
59 | * <!-- end-user-doc --> |
---|
60 | * @generated |
---|
61 | */ |
---|
62 | protected ReplaceableElementClauseImpl() |
---|
63 | { |
---|
64 | super(); |
---|
65 | } |
---|
66 | |
---|
67 | /** |
---|
68 | * <!-- begin-user-doc --> |
---|
69 | * <!-- end-user-doc --> |
---|
70 | * @generated |
---|
71 | */ |
---|
72 | @Override |
---|
73 | protected EClass eStaticClass() |
---|
74 | { |
---|
75 | return ModelicaBasePackage.Literals.REPLACEABLE_ELEMENT_CLAUSE; |
---|
76 | } |
---|
77 | |
---|
78 | /** |
---|
79 | * <!-- begin-user-doc --> |
---|
80 | * <!-- end-user-doc --> |
---|
81 | * @generated |
---|
82 | */ |
---|
83 | public ClassElement getEntity() |
---|
84 | { |
---|
85 | return entity; |
---|
86 | } |
---|
87 | |
---|
88 | /** |
---|
89 | * <!-- begin-user-doc --> |
---|
90 | * <!-- end-user-doc --> |
---|
91 | * @generated |
---|
92 | */ |
---|
93 | public NotificationChain basicSetEntity(ClassElement newEntity, NotificationChain msgs) |
---|
94 | { |
---|
95 | ClassElement oldEntity = entity; |
---|
96 | entity = newEntity; |
---|
97 | if (eNotificationRequired()) |
---|
98 | { |
---|
99 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__ENTITY, oldEntity, newEntity); |
---|
100 | if (msgs == null) msgs = notification; else msgs.add(notification); |
---|
101 | } |
---|
102 | return msgs; |
---|
103 | } |
---|
104 | |
---|
105 | /** |
---|
106 | * <!-- begin-user-doc --> |
---|
107 | * <!-- end-user-doc --> |
---|
108 | * @generated |
---|
109 | */ |
---|
110 | public void setEntity(ClassElement newEntity) |
---|
111 | { |
---|
112 | if (newEntity != entity) |
---|
113 | { |
---|
114 | NotificationChain msgs = null; |
---|
115 | if (entity != null) |
---|
116 | msgs = ((InternalEObject)entity).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__ENTITY, null, msgs); |
---|
117 | if (newEntity != null) |
---|
118 | msgs = ((InternalEObject)newEntity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__ENTITY, null, msgs); |
---|
119 | msgs = basicSetEntity(newEntity, msgs); |
---|
120 | if (msgs != null) msgs.dispatch(); |
---|
121 | } |
---|
122 | else if (eNotificationRequired()) |
---|
123 | eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__ENTITY, newEntity, newEntity)); |
---|
124 | } |
---|
125 | |
---|
126 | /** |
---|
127 | * <!-- begin-user-doc --> |
---|
128 | * <!-- end-user-doc --> |
---|
129 | * @generated |
---|
130 | */ |
---|
131 | public ConstrainingClause getConstrain() |
---|
132 | { |
---|
133 | return constrain; |
---|
134 | } |
---|
135 | |
---|
136 | /** |
---|
137 | * <!-- begin-user-doc --> |
---|
138 | * <!-- end-user-doc --> |
---|
139 | * @generated |
---|
140 | */ |
---|
141 | public NotificationChain basicSetConstrain(ConstrainingClause newConstrain, NotificationChain msgs) |
---|
142 | { |
---|
143 | ConstrainingClause oldConstrain = constrain; |
---|
144 | constrain = newConstrain; |
---|
145 | if (eNotificationRequired()) |
---|
146 | { |
---|
147 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__CONSTRAIN, oldConstrain, newConstrain); |
---|
148 | if (msgs == null) msgs = notification; else msgs.add(notification); |
---|
149 | } |
---|
150 | return msgs; |
---|
151 | } |
---|
152 | |
---|
153 | /** |
---|
154 | * <!-- begin-user-doc --> |
---|
155 | * <!-- end-user-doc --> |
---|
156 | * @generated |
---|
157 | */ |
---|
158 | public void setConstrain(ConstrainingClause newConstrain) |
---|
159 | { |
---|
160 | if (newConstrain != constrain) |
---|
161 | { |
---|
162 | NotificationChain msgs = null; |
---|
163 | if (constrain != null) |
---|
164 | msgs = ((InternalEObject)constrain).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__CONSTRAIN, null, msgs); |
---|
165 | if (newConstrain != null) |
---|
166 | msgs = ((InternalEObject)newConstrain).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__CONSTRAIN, null, msgs); |
---|
167 | msgs = basicSetConstrain(newConstrain, msgs); |
---|
168 | if (msgs != null) msgs.dispatch(); |
---|
169 | } |
---|
170 | else if (eNotificationRequired()) |
---|
171 | eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__CONSTRAIN, newConstrain, newConstrain)); |
---|
172 | } |
---|
173 | |
---|
174 | /** |
---|
175 | * <!-- begin-user-doc --> |
---|
176 | * <!-- end-user-doc --> |
---|
177 | * @generated |
---|
178 | */ |
---|
179 | @Override |
---|
180 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
---|
181 | { |
---|
182 | switch (featureID) |
---|
183 | { |
---|
184 | case ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__ENTITY: |
---|
185 | return basicSetEntity(null, msgs); |
---|
186 | case ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__CONSTRAIN: |
---|
187 | return basicSetConstrain(null, msgs); |
---|
188 | } |
---|
189 | return super.eInverseRemove(otherEnd, featureID, msgs); |
---|
190 | } |
---|
191 | |
---|
192 | /** |
---|
193 | * <!-- begin-user-doc --> |
---|
194 | * <!-- end-user-doc --> |
---|
195 | * @generated |
---|
196 | */ |
---|
197 | @Override |
---|
198 | public Object eGet(int featureID, boolean resolve, boolean coreType) |
---|
199 | { |
---|
200 | switch (featureID) |
---|
201 | { |
---|
202 | case ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__ENTITY: |
---|
203 | return getEntity(); |
---|
204 | case ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__CONSTRAIN: |
---|
205 | return getConstrain(); |
---|
206 | } |
---|
207 | return super.eGet(featureID, resolve, coreType); |
---|
208 | } |
---|
209 | |
---|
210 | /** |
---|
211 | * <!-- begin-user-doc --> |
---|
212 | * <!-- end-user-doc --> |
---|
213 | * @generated |
---|
214 | */ |
---|
215 | @Override |
---|
216 | public void eSet(int featureID, Object newValue) |
---|
217 | { |
---|
218 | switch (featureID) |
---|
219 | { |
---|
220 | case ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__ENTITY: |
---|
221 | setEntity((ClassElement)newValue); |
---|
222 | return; |
---|
223 | case ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__CONSTRAIN: |
---|
224 | setConstrain((ConstrainingClause)newValue); |
---|
225 | return; |
---|
226 | } |
---|
227 | super.eSet(featureID, newValue); |
---|
228 | } |
---|
229 | |
---|
230 | /** |
---|
231 | * <!-- begin-user-doc --> |
---|
232 | * <!-- end-user-doc --> |
---|
233 | * @generated |
---|
234 | */ |
---|
235 | @Override |
---|
236 | public void eUnset(int featureID) |
---|
237 | { |
---|
238 | switch (featureID) |
---|
239 | { |
---|
240 | case ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__ENTITY: |
---|
241 | setEntity((ClassElement)null); |
---|
242 | return; |
---|
243 | case ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__CONSTRAIN: |
---|
244 | setConstrain((ConstrainingClause)null); |
---|
245 | return; |
---|
246 | } |
---|
247 | super.eUnset(featureID); |
---|
248 | } |
---|
249 | |
---|
250 | /** |
---|
251 | * <!-- begin-user-doc --> |
---|
252 | * <!-- end-user-doc --> |
---|
253 | * @generated |
---|
254 | */ |
---|
255 | @Override |
---|
256 | public boolean eIsSet(int featureID) |
---|
257 | { |
---|
258 | switch (featureID) |
---|
259 | { |
---|
260 | case ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__ENTITY: |
---|
261 | return entity != null; |
---|
262 | case ModelicaBasePackage.REPLACEABLE_ELEMENT_CLAUSE__CONSTRAIN: |
---|
263 | return constrain != null; |
---|
264 | } |
---|
265 | return super.eIsSet(featureID); |
---|
266 | } |
---|
267 | |
---|
268 | } //ReplaceableElementClauseImpl |
---|