1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.seff.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.seff.ForkAction; |
16 | import de.uka.ipd.sdq.pcm.seff.ForkedBehaviour; |
17 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
18 | import de.uka.ipd.sdq.pcm.seff.SynchronisationPoint; |
19 | |
20 | /** |
21 | * <!-- begin-user-doc --> |
22 | * An implementation of the model object '<em><b>Forked Behaviour</b></em>'. |
23 | * <!-- end-user-doc --> |
24 | * <p> |
25 | * The following features are implemented: |
26 | * <ul> |
27 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.ForkedBehaviourImpl#getSynchronisationPoint_ForkedBehaviour <em>Synchronisation Point Forked Behaviour</em>}</li> |
28 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.ForkedBehaviourImpl#getForkAction_ForkedBehaivour <em>Fork Action Forked Behaivour</em>}</li> |
29 | * </ul> |
30 | * </p> |
31 | * |
32 | * @generated |
33 | */ |
34 | public class ForkedBehaviourImpl extends ResourceDemandingBehaviourImpl implements ForkedBehaviour { |
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 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @generated |
46 | */ |
47 | protected ForkedBehaviourImpl() { |
48 | super(); |
49 | } |
50 | |
51 | /** |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @generated |
55 | */ |
56 | @Override |
57 | protected EClass eStaticClass() { |
58 | return SeffPackage.Literals.FORKED_BEHAVIOUR; |
59 | } |
60 | |
61 | /** |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @generated |
65 | */ |
66 | public SynchronisationPoint getSynchronisationPoint_ForkedBehaviour() { |
67 | if (eContainerFeatureID() != SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR) return null; |
68 | return (SynchronisationPoint)eContainer(); |
69 | } |
70 | |
71 | /** |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | public NotificationChain basicSetSynchronisationPoint_ForkedBehaviour(SynchronisationPoint newSynchronisationPoint_ForkedBehaviour, NotificationChain msgs) { |
77 | msgs = eBasicSetContainer((InternalEObject)newSynchronisationPoint_ForkedBehaviour, SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR, msgs); |
78 | return msgs; |
79 | } |
80 | |
81 | /** |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | public void setSynchronisationPoint_ForkedBehaviour(SynchronisationPoint newSynchronisationPoint_ForkedBehaviour) { |
87 | if (newSynchronisationPoint_ForkedBehaviour != eInternalContainer() || (eContainerFeatureID() != SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR && newSynchronisationPoint_ForkedBehaviour != null)) { |
88 | if (EcoreUtil.isAncestor(this, newSynchronisationPoint_ForkedBehaviour)) |
89 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
90 | NotificationChain msgs = null; |
91 | if (eInternalContainer() != null) |
92 | msgs = eBasicRemoveFromContainer(msgs); |
93 | if (newSynchronisationPoint_ForkedBehaviour != null) |
94 | msgs = ((InternalEObject)newSynchronisationPoint_ForkedBehaviour).eInverseAdd(this, SeffPackage.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT, SynchronisationPoint.class, msgs); |
95 | msgs = basicSetSynchronisationPoint_ForkedBehaviour(newSynchronisationPoint_ForkedBehaviour, msgs); |
96 | if (msgs != null) msgs.dispatch(); |
97 | } |
98 | else if (eNotificationRequired()) |
99 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR, newSynchronisationPoint_ForkedBehaviour, newSynchronisationPoint_ForkedBehaviour)); |
100 | } |
101 | |
102 | /** |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | public ForkAction getForkAction_ForkedBehaivour() { |
108 | if (eContainerFeatureID() != SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR) return null; |
109 | return (ForkAction)eContainer(); |
110 | } |
111 | |
112 | /** |
113 | * <!-- begin-user-doc --> |
114 | * <!-- end-user-doc --> |
115 | * @generated |
116 | */ |
117 | public NotificationChain basicSetForkAction_ForkedBehaivour(ForkAction newForkAction_ForkedBehaivour, NotificationChain msgs) { |
118 | msgs = eBasicSetContainer((InternalEObject)newForkAction_ForkedBehaivour, SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR, msgs); |
119 | return msgs; |
120 | } |
121 | |
122 | /** |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | public void setForkAction_ForkedBehaivour(ForkAction newForkAction_ForkedBehaivour) { |
128 | if (newForkAction_ForkedBehaivour != eInternalContainer() || (eContainerFeatureID() != SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR && newForkAction_ForkedBehaivour != null)) { |
129 | if (EcoreUtil.isAncestor(this, newForkAction_ForkedBehaivour)) |
130 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
131 | NotificationChain msgs = null; |
132 | if (eInternalContainer() != null) |
133 | msgs = eBasicRemoveFromContainer(msgs); |
134 | if (newForkAction_ForkedBehaivour != null) |
135 | msgs = ((InternalEObject)newForkAction_ForkedBehaivour).eInverseAdd(this, SeffPackage.FORK_ACTION__ASYNCHRONOUS_FORKED_BEHAVIOURS_FORK_ACTION, ForkAction.class, msgs); |
136 | msgs = basicSetForkAction_ForkedBehaivour(newForkAction_ForkedBehaivour, msgs); |
137 | if (msgs != null) msgs.dispatch(); |
138 | } |
139 | else if (eNotificationRequired()) |
140 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR, newForkAction_ForkedBehaivour, newForkAction_ForkedBehaivour)); |
141 | } |
142 | |
143 | /** |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | @Override |
149 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
150 | switch (featureID) { |
151 | case SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR: |
152 | if (eInternalContainer() != null) |
153 | msgs = eBasicRemoveFromContainer(msgs); |
154 | return basicSetSynchronisationPoint_ForkedBehaviour((SynchronisationPoint)otherEnd, msgs); |
155 | case SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR: |
156 | if (eInternalContainer() != null) |
157 | msgs = eBasicRemoveFromContainer(msgs); |
158 | return basicSetForkAction_ForkedBehaivour((ForkAction)otherEnd, msgs); |
159 | } |
160 | return super.eInverseAdd(otherEnd, featureID, msgs); |
161 | } |
162 | |
163 | /** |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @generated |
167 | */ |
168 | @Override |
169 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
170 | switch (featureID) { |
171 | case SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR: |
172 | return basicSetSynchronisationPoint_ForkedBehaviour(null, msgs); |
173 | case SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR: |
174 | return basicSetForkAction_ForkedBehaivour(null, msgs); |
175 | } |
176 | return super.eInverseRemove(otherEnd, featureID, msgs); |
177 | } |
178 | |
179 | /** |
180 | * <!-- begin-user-doc --> |
181 | * <!-- end-user-doc --> |
182 | * @generated |
183 | */ |
184 | @Override |
185 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
186 | switch (eContainerFeatureID()) { |
187 | case SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR: |
188 | return eInternalContainer().eInverseRemove(this, SeffPackage.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT, SynchronisationPoint.class, msgs); |
189 | case SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR: |
190 | return eInternalContainer().eInverseRemove(this, SeffPackage.FORK_ACTION__ASYNCHRONOUS_FORKED_BEHAVIOURS_FORK_ACTION, ForkAction.class, msgs); |
191 | } |
192 | return super.eBasicRemoveFromContainerFeature(msgs); |
193 | } |
194 | |
195 | /** |
196 | * <!-- begin-user-doc --> |
197 | * <!-- end-user-doc --> |
198 | * @generated |
199 | */ |
200 | @Override |
201 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
202 | switch (featureID) { |
203 | case SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR: |
204 | return getSynchronisationPoint_ForkedBehaviour(); |
205 | case SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR: |
206 | return getForkAction_ForkedBehaivour(); |
207 | } |
208 | return super.eGet(featureID, resolve, coreType); |
209 | } |
210 | |
211 | /** |
212 | * <!-- begin-user-doc --> |
213 | * <!-- end-user-doc --> |
214 | * @generated |
215 | */ |
216 | @Override |
217 | public void eSet(int featureID, Object newValue) { |
218 | switch (featureID) { |
219 | case SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR: |
220 | setSynchronisationPoint_ForkedBehaviour((SynchronisationPoint)newValue); |
221 | return; |
222 | case SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR: |
223 | setForkAction_ForkedBehaivour((ForkAction)newValue); |
224 | return; |
225 | } |
226 | super.eSet(featureID, newValue); |
227 | } |
228 | |
229 | /** |
230 | * <!-- begin-user-doc --> |
231 | * <!-- end-user-doc --> |
232 | * @generated |
233 | */ |
234 | @Override |
235 | public void eUnset(int featureID) { |
236 | switch (featureID) { |
237 | case SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR: |
238 | setSynchronisationPoint_ForkedBehaviour((SynchronisationPoint)null); |
239 | return; |
240 | case SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR: |
241 | setForkAction_ForkedBehaivour((ForkAction)null); |
242 | return; |
243 | } |
244 | super.eUnset(featureID); |
245 | } |
246 | |
247 | /** |
248 | * <!-- begin-user-doc --> |
249 | * <!-- end-user-doc --> |
250 | * @generated |
251 | */ |
252 | @Override |
253 | public boolean eIsSet(int featureID) { |
254 | switch (featureID) { |
255 | case SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR: |
256 | return getSynchronisationPoint_ForkedBehaviour() != null; |
257 | case SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR: |
258 | return getForkAction_ForkedBehaivour() != null; |
259 | } |
260 | return super.eIsSet(featureID); |
261 | } |
262 | |
263 | } //ForkedBehaviourImpl |