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 | |
14 | import de.uka.ipd.sdq.pcm.core.CorePackage; |
15 | import de.uka.ipd.sdq.pcm.core.PCMRandomVariable; |
16 | import de.uka.ipd.sdq.pcm.usagemodel.Loop; |
17 | import de.uka.ipd.sdq.pcm.usagemodel.ScenarioBehaviour; |
18 | import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage; |
19 | |
20 | /** |
21 | * <!-- begin-user-doc --> |
22 | * An implementation of the model object '<em><b>Loop</b></em>'. |
23 | * <!-- end-user-doc --> |
24 | * <p> |
25 | * The following features are implemented: |
26 | * <ul> |
27 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.LoopImpl#getLoopIteration_Loop <em>Loop Iteration Loop</em>}</li> |
28 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.LoopImpl#getBodyBehaviour_Loop <em>Body Behaviour Loop</em>}</li> |
29 | * </ul> |
30 | * </p> |
31 | * |
32 | * @generated |
33 | */ |
34 | public class LoopImpl extends AbstractUserActionImpl implements Loop { |
35 | /** |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
41 | |
42 | /** |
43 | * The cached value of the '{@link #getLoopIteration_Loop() <em>Loop Iteration Loop</em>}' containment reference. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @see #getLoopIteration_Loop() |
47 | * @generated |
48 | * @ordered |
49 | */ |
50 | protected PCMRandomVariable loopIteration_Loop; |
51 | |
52 | /** |
53 | * The cached value of the '{@link #getBodyBehaviour_Loop() <em>Body Behaviour Loop</em>}' containment reference. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @see #getBodyBehaviour_Loop() |
57 | * @generated |
58 | * @ordered |
59 | */ |
60 | protected ScenarioBehaviour bodyBehaviour_Loop; |
61 | |
62 | /** |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | protected LoopImpl() { |
68 | super(); |
69 | } |
70 | |
71 | /** |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | @Override |
77 | protected EClass eStaticClass() { |
78 | return UsagemodelPackage.Literals.LOOP; |
79 | } |
80 | |
81 | /** |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | public PCMRandomVariable getLoopIteration_Loop() { |
87 | return loopIteration_Loop; |
88 | } |
89 | |
90 | /** |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @generated |
94 | */ |
95 | public NotificationChain basicSetLoopIteration_Loop(PCMRandomVariable newLoopIteration_Loop, NotificationChain msgs) { |
96 | PCMRandomVariable oldLoopIteration_Loop = loopIteration_Loop; |
97 | loopIteration_Loop = newLoopIteration_Loop; |
98 | if (eNotificationRequired()) { |
99 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UsagemodelPackage.LOOP__LOOP_ITERATION_LOOP, oldLoopIteration_Loop, newLoopIteration_Loop); |
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 setLoopIteration_Loop(PCMRandomVariable newLoopIteration_Loop) { |
111 | if (newLoopIteration_Loop != loopIteration_Loop) { |
112 | NotificationChain msgs = null; |
113 | if (loopIteration_Loop != null) |
114 | msgs = ((InternalEObject)loopIteration_Loop).eInverseRemove(this, CorePackage.PCM_RANDOM_VARIABLE__LOOP_LOOP_ITERATION, PCMRandomVariable.class, msgs); |
115 | if (newLoopIteration_Loop != null) |
116 | msgs = ((InternalEObject)newLoopIteration_Loop).eInverseAdd(this, CorePackage.PCM_RANDOM_VARIABLE__LOOP_LOOP_ITERATION, PCMRandomVariable.class, msgs); |
117 | msgs = basicSetLoopIteration_Loop(newLoopIteration_Loop, msgs); |
118 | if (msgs != null) msgs.dispatch(); |
119 | } |
120 | else if (eNotificationRequired()) |
121 | eNotify(new ENotificationImpl(this, Notification.SET, UsagemodelPackage.LOOP__LOOP_ITERATION_LOOP, newLoopIteration_Loop, newLoopIteration_Loop)); |
122 | } |
123 | |
124 | /** |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | public ScenarioBehaviour getBodyBehaviour_Loop() { |
130 | return bodyBehaviour_Loop; |
131 | } |
132 | |
133 | /** |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | public NotificationChain basicSetBodyBehaviour_Loop(ScenarioBehaviour newBodyBehaviour_Loop, NotificationChain msgs) { |
139 | ScenarioBehaviour oldBodyBehaviour_Loop = bodyBehaviour_Loop; |
140 | bodyBehaviour_Loop = newBodyBehaviour_Loop; |
141 | if (eNotificationRequired()) { |
142 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UsagemodelPackage.LOOP__BODY_BEHAVIOUR_LOOP, oldBodyBehaviour_Loop, newBodyBehaviour_Loop); |
143 | if (msgs == null) msgs = notification; else msgs.add(notification); |
144 | } |
145 | return msgs; |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | public void setBodyBehaviour_Loop(ScenarioBehaviour newBodyBehaviour_Loop) { |
154 | if (newBodyBehaviour_Loop != bodyBehaviour_Loop) { |
155 | NotificationChain msgs = null; |
156 | if (bodyBehaviour_Loop != null) |
157 | msgs = ((InternalEObject)bodyBehaviour_Loop).eInverseRemove(this, UsagemodelPackage.SCENARIO_BEHAVIOUR__LOOP_SCENARIO_BEHAVIOUR, ScenarioBehaviour.class, msgs); |
158 | if (newBodyBehaviour_Loop != null) |
159 | msgs = ((InternalEObject)newBodyBehaviour_Loop).eInverseAdd(this, UsagemodelPackage.SCENARIO_BEHAVIOUR__LOOP_SCENARIO_BEHAVIOUR, ScenarioBehaviour.class, msgs); |
160 | msgs = basicSetBodyBehaviour_Loop(newBodyBehaviour_Loop, msgs); |
161 | if (msgs != null) msgs.dispatch(); |
162 | } |
163 | else if (eNotificationRequired()) |
164 | eNotify(new ENotificationImpl(this, Notification.SET, UsagemodelPackage.LOOP__BODY_BEHAVIOUR_LOOP, newBodyBehaviour_Loop, newBodyBehaviour_Loop)); |
165 | } |
166 | |
167 | /** |
168 | * <!-- begin-user-doc --> |
169 | * <!-- end-user-doc --> |
170 | * @generated |
171 | */ |
172 | @Override |
173 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
174 | switch (featureID) { |
175 | case UsagemodelPackage.LOOP__LOOP_ITERATION_LOOP: |
176 | if (loopIteration_Loop != null) |
177 | msgs = ((InternalEObject)loopIteration_Loop).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UsagemodelPackage.LOOP__LOOP_ITERATION_LOOP, null, msgs); |
178 | return basicSetLoopIteration_Loop((PCMRandomVariable)otherEnd, msgs); |
179 | case UsagemodelPackage.LOOP__BODY_BEHAVIOUR_LOOP: |
180 | if (bodyBehaviour_Loop != null) |
181 | msgs = ((InternalEObject)bodyBehaviour_Loop).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UsagemodelPackage.LOOP__BODY_BEHAVIOUR_LOOP, null, msgs); |
182 | return basicSetBodyBehaviour_Loop((ScenarioBehaviour)otherEnd, msgs); |
183 | } |
184 | return super.eInverseAdd(otherEnd, featureID, msgs); |
185 | } |
186 | |
187 | /** |
188 | * <!-- begin-user-doc --> |
189 | * <!-- end-user-doc --> |
190 | * @generated |
191 | */ |
192 | @Override |
193 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
194 | switch (featureID) { |
195 | case UsagemodelPackage.LOOP__LOOP_ITERATION_LOOP: |
196 | return basicSetLoopIteration_Loop(null, msgs); |
197 | case UsagemodelPackage.LOOP__BODY_BEHAVIOUR_LOOP: |
198 | return basicSetBodyBehaviour_Loop(null, msgs); |
199 | } |
200 | return super.eInverseRemove(otherEnd, featureID, msgs); |
201 | } |
202 | |
203 | /** |
204 | * <!-- begin-user-doc --> |
205 | * <!-- end-user-doc --> |
206 | * @generated |
207 | */ |
208 | @Override |
209 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
210 | switch (featureID) { |
211 | case UsagemodelPackage.LOOP__LOOP_ITERATION_LOOP: |
212 | return getLoopIteration_Loop(); |
213 | case UsagemodelPackage.LOOP__BODY_BEHAVIOUR_LOOP: |
214 | return getBodyBehaviour_Loop(); |
215 | } |
216 | return super.eGet(featureID, resolve, coreType); |
217 | } |
218 | |
219 | /** |
220 | * <!-- begin-user-doc --> |
221 | * <!-- end-user-doc --> |
222 | * @generated |
223 | */ |
224 | @Override |
225 | public void eSet(int featureID, Object newValue) { |
226 | switch (featureID) { |
227 | case UsagemodelPackage.LOOP__LOOP_ITERATION_LOOP: |
228 | setLoopIteration_Loop((PCMRandomVariable)newValue); |
229 | return; |
230 | case UsagemodelPackage.LOOP__BODY_BEHAVIOUR_LOOP: |
231 | setBodyBehaviour_Loop((ScenarioBehaviour)newValue); |
232 | return; |
233 | } |
234 | super.eSet(featureID, newValue); |
235 | } |
236 | |
237 | /** |
238 | * <!-- begin-user-doc --> |
239 | * <!-- end-user-doc --> |
240 | * @generated |
241 | */ |
242 | @Override |
243 | public void eUnset(int featureID) { |
244 | switch (featureID) { |
245 | case UsagemodelPackage.LOOP__LOOP_ITERATION_LOOP: |
246 | setLoopIteration_Loop((PCMRandomVariable)null); |
247 | return; |
248 | case UsagemodelPackage.LOOP__BODY_BEHAVIOUR_LOOP: |
249 | setBodyBehaviour_Loop((ScenarioBehaviour)null); |
250 | return; |
251 | } |
252 | super.eUnset(featureID); |
253 | } |
254 | |
255 | /** |
256 | * <!-- begin-user-doc --> |
257 | * <!-- end-user-doc --> |
258 | * @generated |
259 | */ |
260 | @Override |
261 | public boolean eIsSet(int featureID) { |
262 | switch (featureID) { |
263 | case UsagemodelPackage.LOOP__LOOP_ITERATION_LOOP: |
264 | return loopIteration_Loop != null; |
265 | case UsagemodelPackage.LOOP__BODY_BEHAVIOUR_LOOP: |
266 | return bodyBehaviour_Loop != null; |
267 | } |
268 | return super.eIsSet(featureID); |
269 | } |
270 | |
271 | } //LoopImpl |