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 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
---|
16 | |
---|
17 | import org.modelica.xtext.modelicaBase.ClassModification; |
---|
18 | import org.modelica.xtext.modelicaBase.Comment; |
---|
19 | import org.modelica.xtext.modelicaBase.ConstrainingClause; |
---|
20 | import org.modelica.xtext.modelicaBase.ModelicaBasePackage; |
---|
21 | |
---|
22 | /** |
---|
23 | * <!-- begin-user-doc --> |
---|
24 | * An implementation of the model object '<em><b>Constraining Clause</b></em>'. |
---|
25 | * <!-- end-user-doc --> |
---|
26 | * <p> |
---|
27 | * The following features are implemented: |
---|
28 | * <ul> |
---|
29 | * <li>{@link org.modelica.xtext.modelicaBase.impl.ConstrainingClauseImpl#getName <em>Name</em>}</li> |
---|
30 | * <li>{@link org.modelica.xtext.modelicaBase.impl.ConstrainingClauseImpl#getModification <em>Modification</em>}</li> |
---|
31 | * <li>{@link org.modelica.xtext.modelicaBase.impl.ConstrainingClauseImpl#getComment <em>Comment</em>}</li> |
---|
32 | * </ul> |
---|
33 | * </p> |
---|
34 | * |
---|
35 | * @generated |
---|
36 | */ |
---|
37 | public class ConstrainingClauseImpl extends MinimalEObjectImpl.Container implements ConstrainingClause |
---|
38 | { |
---|
39 | /** |
---|
40 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
---|
41 | * <!-- begin-user-doc --> |
---|
42 | * <!-- end-user-doc --> |
---|
43 | * @see #getName() |
---|
44 | * @generated |
---|
45 | * @ordered |
---|
46 | */ |
---|
47 | protected static final String NAME_EDEFAULT = null; |
---|
48 | |
---|
49 | /** |
---|
50 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
---|
51 | * <!-- begin-user-doc --> |
---|
52 | * <!-- end-user-doc --> |
---|
53 | * @see #getName() |
---|
54 | * @generated |
---|
55 | * @ordered |
---|
56 | */ |
---|
57 | protected String name = NAME_EDEFAULT; |
---|
58 | |
---|
59 | /** |
---|
60 | * The cached value of the '{@link #getModification() <em>Modification</em>}' containment reference. |
---|
61 | * <!-- begin-user-doc --> |
---|
62 | * <!-- end-user-doc --> |
---|
63 | * @see #getModification() |
---|
64 | * @generated |
---|
65 | * @ordered |
---|
66 | */ |
---|
67 | protected ClassModification modification; |
---|
68 | |
---|
69 | /** |
---|
70 | * The cached value of the '{@link #getComment() <em>Comment</em>}' containment reference. |
---|
71 | * <!-- begin-user-doc --> |
---|
72 | * <!-- end-user-doc --> |
---|
73 | * @see #getComment() |
---|
74 | * @generated |
---|
75 | * @ordered |
---|
76 | */ |
---|
77 | protected Comment comment; |
---|
78 | |
---|
79 | /** |
---|
80 | * <!-- begin-user-doc --> |
---|
81 | * <!-- end-user-doc --> |
---|
82 | * @generated |
---|
83 | */ |
---|
84 | protected ConstrainingClauseImpl() |
---|
85 | { |
---|
86 | super(); |
---|
87 | } |
---|
88 | |
---|
89 | /** |
---|
90 | * <!-- begin-user-doc --> |
---|
91 | * <!-- end-user-doc --> |
---|
92 | * @generated |
---|
93 | */ |
---|
94 | @Override |
---|
95 | protected EClass eStaticClass() |
---|
96 | { |
---|
97 | return ModelicaBasePackage.Literals.CONSTRAINING_CLAUSE; |
---|
98 | } |
---|
99 | |
---|
100 | /** |
---|
101 | * <!-- begin-user-doc --> |
---|
102 | * <!-- end-user-doc --> |
---|
103 | * @generated |
---|
104 | */ |
---|
105 | public String getName() |
---|
106 | { |
---|
107 | return name; |
---|
108 | } |
---|
109 | |
---|
110 | /** |
---|
111 | * <!-- begin-user-doc --> |
---|
112 | * <!-- end-user-doc --> |
---|
113 | * @generated |
---|
114 | */ |
---|
115 | public void setName(String newName) |
---|
116 | { |
---|
117 | String oldName = name; |
---|
118 | name = newName; |
---|
119 | if (eNotificationRequired()) |
---|
120 | eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CONSTRAINING_CLAUSE__NAME, oldName, name)); |
---|
121 | } |
---|
122 | |
---|
123 | /** |
---|
124 | * <!-- begin-user-doc --> |
---|
125 | * <!-- end-user-doc --> |
---|
126 | * @generated |
---|
127 | */ |
---|
128 | public ClassModification getModification() |
---|
129 | { |
---|
130 | return modification; |
---|
131 | } |
---|
132 | |
---|
133 | /** |
---|
134 | * <!-- begin-user-doc --> |
---|
135 | * <!-- end-user-doc --> |
---|
136 | * @generated |
---|
137 | */ |
---|
138 | public NotificationChain basicSetModification(ClassModification newModification, NotificationChain msgs) |
---|
139 | { |
---|
140 | ClassModification oldModification = modification; |
---|
141 | modification = newModification; |
---|
142 | if (eNotificationRequired()) |
---|
143 | { |
---|
144 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CONSTRAINING_CLAUSE__MODIFICATION, oldModification, newModification); |
---|
145 | if (msgs == null) msgs = notification; else msgs.add(notification); |
---|
146 | } |
---|
147 | return msgs; |
---|
148 | } |
---|
149 | |
---|
150 | /** |
---|
151 | * <!-- begin-user-doc --> |
---|
152 | * <!-- end-user-doc --> |
---|
153 | * @generated |
---|
154 | */ |
---|
155 | public void setModification(ClassModification newModification) |
---|
156 | { |
---|
157 | if (newModification != modification) |
---|
158 | { |
---|
159 | NotificationChain msgs = null; |
---|
160 | if (modification != null) |
---|
161 | msgs = ((InternalEObject)modification).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.CONSTRAINING_CLAUSE__MODIFICATION, null, msgs); |
---|
162 | if (newModification != null) |
---|
163 | msgs = ((InternalEObject)newModification).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.CONSTRAINING_CLAUSE__MODIFICATION, null, msgs); |
---|
164 | msgs = basicSetModification(newModification, msgs); |
---|
165 | if (msgs != null) msgs.dispatch(); |
---|
166 | } |
---|
167 | else if (eNotificationRequired()) |
---|
168 | eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CONSTRAINING_CLAUSE__MODIFICATION, newModification, newModification)); |
---|
169 | } |
---|
170 | |
---|
171 | /** |
---|
172 | * <!-- begin-user-doc --> |
---|
173 | * <!-- end-user-doc --> |
---|
174 | * @generated |
---|
175 | */ |
---|
176 | public Comment getComment() |
---|
177 | { |
---|
178 | return comment; |
---|
179 | } |
---|
180 | |
---|
181 | /** |
---|
182 | * <!-- begin-user-doc --> |
---|
183 | * <!-- end-user-doc --> |
---|
184 | * @generated |
---|
185 | */ |
---|
186 | public NotificationChain basicSetComment(Comment newComment, NotificationChain msgs) |
---|
187 | { |
---|
188 | Comment oldComment = comment; |
---|
189 | comment = newComment; |
---|
190 | if (eNotificationRequired()) |
---|
191 | { |
---|
192 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CONSTRAINING_CLAUSE__COMMENT, oldComment, newComment); |
---|
193 | if (msgs == null) msgs = notification; else msgs.add(notification); |
---|
194 | } |
---|
195 | return msgs; |
---|
196 | } |
---|
197 | |
---|
198 | /** |
---|
199 | * <!-- begin-user-doc --> |
---|
200 | * <!-- end-user-doc --> |
---|
201 | * @generated |
---|
202 | */ |
---|
203 | public void setComment(Comment newComment) |
---|
204 | { |
---|
205 | if (newComment != comment) |
---|
206 | { |
---|
207 | NotificationChain msgs = null; |
---|
208 | if (comment != null) |
---|
209 | msgs = ((InternalEObject)comment).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.CONSTRAINING_CLAUSE__COMMENT, null, msgs); |
---|
210 | if (newComment != null) |
---|
211 | msgs = ((InternalEObject)newComment).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelicaBasePackage.CONSTRAINING_CLAUSE__COMMENT, null, msgs); |
---|
212 | msgs = basicSetComment(newComment, msgs); |
---|
213 | if (msgs != null) msgs.dispatch(); |
---|
214 | } |
---|
215 | else if (eNotificationRequired()) |
---|
216 | eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.CONSTRAINING_CLAUSE__COMMENT, newComment, newComment)); |
---|
217 | } |
---|
218 | |
---|
219 | /** |
---|
220 | * <!-- begin-user-doc --> |
---|
221 | * <!-- end-user-doc --> |
---|
222 | * @generated |
---|
223 | */ |
---|
224 | @Override |
---|
225 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
---|
226 | { |
---|
227 | switch (featureID) |
---|
228 | { |
---|
229 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__MODIFICATION: |
---|
230 | return basicSetModification(null, msgs); |
---|
231 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__COMMENT: |
---|
232 | return basicSetComment(null, msgs); |
---|
233 | } |
---|
234 | return super.eInverseRemove(otherEnd, featureID, msgs); |
---|
235 | } |
---|
236 | |
---|
237 | /** |
---|
238 | * <!-- begin-user-doc --> |
---|
239 | * <!-- end-user-doc --> |
---|
240 | * @generated |
---|
241 | */ |
---|
242 | @Override |
---|
243 | public Object eGet(int featureID, boolean resolve, boolean coreType) |
---|
244 | { |
---|
245 | switch (featureID) |
---|
246 | { |
---|
247 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__NAME: |
---|
248 | return getName(); |
---|
249 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__MODIFICATION: |
---|
250 | return getModification(); |
---|
251 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__COMMENT: |
---|
252 | return getComment(); |
---|
253 | } |
---|
254 | return super.eGet(featureID, resolve, coreType); |
---|
255 | } |
---|
256 | |
---|
257 | /** |
---|
258 | * <!-- begin-user-doc --> |
---|
259 | * <!-- end-user-doc --> |
---|
260 | * @generated |
---|
261 | */ |
---|
262 | @Override |
---|
263 | public void eSet(int featureID, Object newValue) |
---|
264 | { |
---|
265 | switch (featureID) |
---|
266 | { |
---|
267 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__NAME: |
---|
268 | setName((String)newValue); |
---|
269 | return; |
---|
270 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__MODIFICATION: |
---|
271 | setModification((ClassModification)newValue); |
---|
272 | return; |
---|
273 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__COMMENT: |
---|
274 | setComment((Comment)newValue); |
---|
275 | return; |
---|
276 | } |
---|
277 | super.eSet(featureID, newValue); |
---|
278 | } |
---|
279 | |
---|
280 | /** |
---|
281 | * <!-- begin-user-doc --> |
---|
282 | * <!-- end-user-doc --> |
---|
283 | * @generated |
---|
284 | */ |
---|
285 | @Override |
---|
286 | public void eUnset(int featureID) |
---|
287 | { |
---|
288 | switch (featureID) |
---|
289 | { |
---|
290 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__NAME: |
---|
291 | setName(NAME_EDEFAULT); |
---|
292 | return; |
---|
293 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__MODIFICATION: |
---|
294 | setModification((ClassModification)null); |
---|
295 | return; |
---|
296 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__COMMENT: |
---|
297 | setComment((Comment)null); |
---|
298 | return; |
---|
299 | } |
---|
300 | super.eUnset(featureID); |
---|
301 | } |
---|
302 | |
---|
303 | /** |
---|
304 | * <!-- begin-user-doc --> |
---|
305 | * <!-- end-user-doc --> |
---|
306 | * @generated |
---|
307 | */ |
---|
308 | @Override |
---|
309 | public boolean eIsSet(int featureID) |
---|
310 | { |
---|
311 | switch (featureID) |
---|
312 | { |
---|
313 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__NAME: |
---|
314 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
---|
315 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__MODIFICATION: |
---|
316 | return modification != null; |
---|
317 | case ModelicaBasePackage.CONSTRAINING_CLAUSE__COMMENT: |
---|
318 | return comment != null; |
---|
319 | } |
---|
320 | return super.eIsSet(featureID); |
---|
321 | } |
---|
322 | |
---|
323 | /** |
---|
324 | * <!-- begin-user-doc --> |
---|
325 | * <!-- end-user-doc --> |
---|
326 | * @generated |
---|
327 | */ |
---|
328 | @Override |
---|
329 | public String toString() |
---|
330 | { |
---|
331 | if (eIsProxy()) return super.toString(); |
---|
332 | |
---|
333 | StringBuffer result = new StringBuffer(super.toString()); |
---|
334 | result.append(" (name: "); |
---|
335 | result.append(name); |
---|
336 | result.append(')'); |
---|
337 | return result.toString(); |
---|
338 | } |
---|
339 | |
---|
340 | } //ConstrainingClauseImpl |
---|