1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.usagemodel.impl; |
7 | |
8 | import org.eclipse.emf.common.notify.Notification; |
9 | import org.eclipse.emf.common.notify.NotificationChain; |
10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.InternalEObject; |
12 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
13 | import org.eclipse.emf.ecore.util.EcoreUtil; |
14 | |
15 | import de.uka.ipd.sdq.pcm.core.entity.impl.EntityImpl; |
16 | import de.uka.ipd.sdq.pcm.usagemodel.ScenarioBehaviour; |
17 | import de.uka.ipd.sdq.pcm.usagemodel.UsageModel; |
18 | import de.uka.ipd.sdq.pcm.usagemodel.UsageScenario; |
19 | import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage; |
20 | import de.uka.ipd.sdq.pcm.usagemodel.Workload; |
21 | |
22 | /** |
23 | * <!-- begin-user-doc --> |
24 | * An implementation of the model object '<em><b>Usage Scenario</b></em>'. |
25 | * <!-- end-user-doc --> |
26 | * <p> |
27 | * The following features are implemented: |
28 | * <ul> |
29 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.UsageScenarioImpl#getUsageModel_UsageScenario <em>Usage Model Usage Scenario</em>}</li> |
30 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.UsageScenarioImpl#getScenarioBehaviour_UsageScenario <em>Scenario Behaviour Usage Scenario</em>}</li> |
31 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.UsageScenarioImpl#getWorkload_UsageScenario <em>Workload Usage Scenario</em>}</li> |
32 | * </ul> |
33 | * </p> |
34 | * |
35 | * @generated |
36 | */ |
37 | public class UsageScenarioImpl extends EntityImpl implements UsageScenario { |
38 | /** |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @generated |
42 | */ |
43 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
44 | |
45 | /** |
46 | * The cached value of the '{@link #getScenarioBehaviour_UsageScenario() <em>Scenario Behaviour Usage Scenario</em>}' containment reference. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @see #getScenarioBehaviour_UsageScenario() |
50 | * @generated |
51 | * @ordered |
52 | */ |
53 | protected ScenarioBehaviour scenarioBehaviour_UsageScenario; |
54 | |
55 | /** |
56 | * The cached value of the '{@link #getWorkload_UsageScenario() <em>Workload Usage Scenario</em>}' containment reference. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @see #getWorkload_UsageScenario() |
60 | * @generated |
61 | * @ordered |
62 | */ |
63 | protected Workload workload_UsageScenario; |
64 | |
65 | /** |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | protected UsageScenarioImpl() { |
71 | super(); |
72 | } |
73 | |
74 | /** |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @generated |
78 | */ |
79 | @Override |
80 | protected EClass eStaticClass() { |
81 | return UsagemodelPackage.Literals.USAGE_SCENARIO; |
82 | } |
83 | |
84 | /** |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | public ScenarioBehaviour getScenarioBehaviour_UsageScenario() { |
90 | return scenarioBehaviour_UsageScenario; |
91 | } |
92 | |
93 | /** |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | public NotificationChain basicSetScenarioBehaviour_UsageScenario(ScenarioBehaviour newScenarioBehaviour_UsageScenario, NotificationChain msgs) { |
99 | ScenarioBehaviour oldScenarioBehaviour_UsageScenario = scenarioBehaviour_UsageScenario; |
100 | scenarioBehaviour_UsageScenario = newScenarioBehaviour_UsageScenario; |
101 | if (eNotificationRequired()) { |
102 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UsagemodelPackage.USAGE_SCENARIO__SCENARIO_BEHAVIOUR_USAGE_SCENARIO, oldScenarioBehaviour_UsageScenario, newScenarioBehaviour_UsageScenario); |
103 | if (msgs == null) msgs = notification; else msgs.add(notification); |
104 | } |
105 | return msgs; |
106 | } |
107 | |
108 | /** |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | public void setScenarioBehaviour_UsageScenario(ScenarioBehaviour newScenarioBehaviour_UsageScenario) { |
114 | if (newScenarioBehaviour_UsageScenario != scenarioBehaviour_UsageScenario) { |
115 | NotificationChain msgs = null; |
116 | if (scenarioBehaviour_UsageScenario != null) |
117 | msgs = ((InternalEObject)scenarioBehaviour_UsageScenario).eInverseRemove(this, UsagemodelPackage.SCENARIO_BEHAVIOUR__USAGE_SCENARIO_SENARIO_BEHAVIOUR, ScenarioBehaviour.class, msgs); |
118 | if (newScenarioBehaviour_UsageScenario != null) |
119 | msgs = ((InternalEObject)newScenarioBehaviour_UsageScenario).eInverseAdd(this, UsagemodelPackage.SCENARIO_BEHAVIOUR__USAGE_SCENARIO_SENARIO_BEHAVIOUR, ScenarioBehaviour.class, msgs); |
120 | msgs = basicSetScenarioBehaviour_UsageScenario(newScenarioBehaviour_UsageScenario, msgs); |
121 | if (msgs != null) msgs.dispatch(); |
122 | } |
123 | else if (eNotificationRequired()) |
124 | eNotify(new ENotificationImpl(this, Notification.SET, UsagemodelPackage.USAGE_SCENARIO__SCENARIO_BEHAVIOUR_USAGE_SCENARIO, newScenarioBehaviour_UsageScenario, newScenarioBehaviour_UsageScenario)); |
125 | } |
126 | |
127 | /** |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | public UsageModel getUsageModel_UsageScenario() { |
133 | if (eContainerFeatureID() != UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO) return null; |
134 | return (UsageModel)eContainer(); |
135 | } |
136 | |
137 | /** |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | public NotificationChain basicSetUsageModel_UsageScenario(UsageModel newUsageModel_UsageScenario, NotificationChain msgs) { |
143 | msgs = eBasicSetContainer((InternalEObject)newUsageModel_UsageScenario, UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO, msgs); |
144 | return msgs; |
145 | } |
146 | |
147 | /** |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | public void setUsageModel_UsageScenario(UsageModel newUsageModel_UsageScenario) { |
153 | if (newUsageModel_UsageScenario != eInternalContainer() || (eContainerFeatureID() != UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO && newUsageModel_UsageScenario != null)) { |
154 | if (EcoreUtil.isAncestor(this, newUsageModel_UsageScenario)) |
155 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
156 | NotificationChain msgs = null; |
157 | if (eInternalContainer() != null) |
158 | msgs = eBasicRemoveFromContainer(msgs); |
159 | if (newUsageModel_UsageScenario != null) |
160 | msgs = ((InternalEObject)newUsageModel_UsageScenario).eInverseAdd(this, UsagemodelPackage.USAGE_MODEL__USAGE_SCENARIO_USAGE_MODEL, UsageModel.class, msgs); |
161 | msgs = basicSetUsageModel_UsageScenario(newUsageModel_UsageScenario, msgs); |
162 | if (msgs != null) msgs.dispatch(); |
163 | } |
164 | else if (eNotificationRequired()) |
165 | eNotify(new ENotificationImpl(this, Notification.SET, UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO, newUsageModel_UsageScenario, newUsageModel_UsageScenario)); |
166 | } |
167 | |
168 | /** |
169 | * <!-- begin-user-doc --> |
170 | * <!-- end-user-doc --> |
171 | * @generated |
172 | */ |
173 | public Workload getWorkload_UsageScenario() { |
174 | return workload_UsageScenario; |
175 | } |
176 | |
177 | /** |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | public NotificationChain basicSetWorkload_UsageScenario(Workload newWorkload_UsageScenario, NotificationChain msgs) { |
183 | Workload oldWorkload_UsageScenario = workload_UsageScenario; |
184 | workload_UsageScenario = newWorkload_UsageScenario; |
185 | if (eNotificationRequired()) { |
186 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UsagemodelPackage.USAGE_SCENARIO__WORKLOAD_USAGE_SCENARIO, oldWorkload_UsageScenario, newWorkload_UsageScenario); |
187 | if (msgs == null) msgs = notification; else msgs.add(notification); |
188 | } |
189 | return msgs; |
190 | } |
191 | |
192 | /** |
193 | * <!-- begin-user-doc --> |
194 | * <!-- end-user-doc --> |
195 | * @generated |
196 | */ |
197 | public void setWorkload_UsageScenario(Workload newWorkload_UsageScenario) { |
198 | if (newWorkload_UsageScenario != workload_UsageScenario) { |
199 | NotificationChain msgs = null; |
200 | if (workload_UsageScenario != null) |
201 | msgs = ((InternalEObject)workload_UsageScenario).eInverseRemove(this, UsagemodelPackage.WORKLOAD__USAGE_SCENARIO_WORKLOAD, Workload.class, msgs); |
202 | if (newWorkload_UsageScenario != null) |
203 | msgs = ((InternalEObject)newWorkload_UsageScenario).eInverseAdd(this, UsagemodelPackage.WORKLOAD__USAGE_SCENARIO_WORKLOAD, Workload.class, msgs); |
204 | msgs = basicSetWorkload_UsageScenario(newWorkload_UsageScenario, msgs); |
205 | if (msgs != null) msgs.dispatch(); |
206 | } |
207 | else if (eNotificationRequired()) |
208 | eNotify(new ENotificationImpl(this, Notification.SET, UsagemodelPackage.USAGE_SCENARIO__WORKLOAD_USAGE_SCENARIO, newWorkload_UsageScenario, newWorkload_UsageScenario)); |
209 | } |
210 | |
211 | /** |
212 | * <!-- begin-user-doc --> |
213 | * <!-- end-user-doc --> |
214 | * @generated |
215 | */ |
216 | @Override |
217 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
218 | switch (featureID) { |
219 | case UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO: |
220 | if (eInternalContainer() != null) |
221 | msgs = eBasicRemoveFromContainer(msgs); |
222 | return basicSetUsageModel_UsageScenario((UsageModel)otherEnd, msgs); |
223 | case UsagemodelPackage.USAGE_SCENARIO__SCENARIO_BEHAVIOUR_USAGE_SCENARIO: |
224 | if (scenarioBehaviour_UsageScenario != null) |
225 | msgs = ((InternalEObject)scenarioBehaviour_UsageScenario).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UsagemodelPackage.USAGE_SCENARIO__SCENARIO_BEHAVIOUR_USAGE_SCENARIO, null, msgs); |
226 | return basicSetScenarioBehaviour_UsageScenario((ScenarioBehaviour)otherEnd, msgs); |
227 | case UsagemodelPackage.USAGE_SCENARIO__WORKLOAD_USAGE_SCENARIO: |
228 | if (workload_UsageScenario != null) |
229 | msgs = ((InternalEObject)workload_UsageScenario).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UsagemodelPackage.USAGE_SCENARIO__WORKLOAD_USAGE_SCENARIO, null, msgs); |
230 | return basicSetWorkload_UsageScenario((Workload)otherEnd, msgs); |
231 | } |
232 | return super.eInverseAdd(otherEnd, featureID, msgs); |
233 | } |
234 | |
235 | /** |
236 | * <!-- begin-user-doc --> |
237 | * <!-- end-user-doc --> |
238 | * @generated |
239 | */ |
240 | @Override |
241 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
242 | switch (featureID) { |
243 | case UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO: |
244 | return basicSetUsageModel_UsageScenario(null, msgs); |
245 | case UsagemodelPackage.USAGE_SCENARIO__SCENARIO_BEHAVIOUR_USAGE_SCENARIO: |
246 | return basicSetScenarioBehaviour_UsageScenario(null, msgs); |
247 | case UsagemodelPackage.USAGE_SCENARIO__WORKLOAD_USAGE_SCENARIO: |
248 | return basicSetWorkload_UsageScenario(null, msgs); |
249 | } |
250 | return super.eInverseRemove(otherEnd, featureID, msgs); |
251 | } |
252 | |
253 | /** |
254 | * <!-- begin-user-doc --> |
255 | * <!-- end-user-doc --> |
256 | * @generated |
257 | */ |
258 | @Override |
259 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
260 | switch (eContainerFeatureID()) { |
261 | case UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO: |
262 | return eInternalContainer().eInverseRemove(this, UsagemodelPackage.USAGE_MODEL__USAGE_SCENARIO_USAGE_MODEL, UsageModel.class, msgs); |
263 | } |
264 | return super.eBasicRemoveFromContainerFeature(msgs); |
265 | } |
266 | |
267 | /** |
268 | * <!-- begin-user-doc --> |
269 | * <!-- end-user-doc --> |
270 | * @generated |
271 | */ |
272 | @Override |
273 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
274 | switch (featureID) { |
275 | case UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO: |
276 | return getUsageModel_UsageScenario(); |
277 | case UsagemodelPackage.USAGE_SCENARIO__SCENARIO_BEHAVIOUR_USAGE_SCENARIO: |
278 | return getScenarioBehaviour_UsageScenario(); |
279 | case UsagemodelPackage.USAGE_SCENARIO__WORKLOAD_USAGE_SCENARIO: |
280 | return getWorkload_UsageScenario(); |
281 | } |
282 | return super.eGet(featureID, resolve, coreType); |
283 | } |
284 | |
285 | /** |
286 | * <!-- begin-user-doc --> |
287 | * <!-- end-user-doc --> |
288 | * @generated |
289 | */ |
290 | @Override |
291 | public void eSet(int featureID, Object newValue) { |
292 | switch (featureID) { |
293 | case UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO: |
294 | setUsageModel_UsageScenario((UsageModel)newValue); |
295 | return; |
296 | case UsagemodelPackage.USAGE_SCENARIO__SCENARIO_BEHAVIOUR_USAGE_SCENARIO: |
297 | setScenarioBehaviour_UsageScenario((ScenarioBehaviour)newValue); |
298 | return; |
299 | case UsagemodelPackage.USAGE_SCENARIO__WORKLOAD_USAGE_SCENARIO: |
300 | setWorkload_UsageScenario((Workload)newValue); |
301 | return; |
302 | } |
303 | super.eSet(featureID, newValue); |
304 | } |
305 | |
306 | /** |
307 | * <!-- begin-user-doc --> |
308 | * <!-- end-user-doc --> |
309 | * @generated |
310 | */ |
311 | @Override |
312 | public void eUnset(int featureID) { |
313 | switch (featureID) { |
314 | case UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO: |
315 | setUsageModel_UsageScenario((UsageModel)null); |
316 | return; |
317 | case UsagemodelPackage.USAGE_SCENARIO__SCENARIO_BEHAVIOUR_USAGE_SCENARIO: |
318 | setScenarioBehaviour_UsageScenario((ScenarioBehaviour)null); |
319 | return; |
320 | case UsagemodelPackage.USAGE_SCENARIO__WORKLOAD_USAGE_SCENARIO: |
321 | setWorkload_UsageScenario((Workload)null); |
322 | return; |
323 | } |
324 | super.eUnset(featureID); |
325 | } |
326 | |
327 | /** |
328 | * <!-- begin-user-doc --> |
329 | * <!-- end-user-doc --> |
330 | * @generated |
331 | */ |
332 | @Override |
333 | public boolean eIsSet(int featureID) { |
334 | switch (featureID) { |
335 | case UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO: |
336 | return getUsageModel_UsageScenario() != null; |
337 | case UsagemodelPackage.USAGE_SCENARIO__SCENARIO_BEHAVIOUR_USAGE_SCENARIO: |
338 | return scenarioBehaviour_UsageScenario != null; |
339 | case UsagemodelPackage.USAGE_SCENARIO__WORKLOAD_USAGE_SCENARIO: |
340 | return workload_UsageScenario != null; |
341 | } |
342 | return super.eIsSet(featureID); |
343 | } |
344 | |
345 | } //UsageScenarioImpl |