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