1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.core.entity.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.EntityPackage; |
16 | import de.uka.ipd.sdq.pcm.core.entity.ResourceInterfaceProvidingEntity; |
17 | import de.uka.ipd.sdq.pcm.core.entity.ResourceProvidedRole; |
18 | import de.uka.ipd.sdq.pcm.repository.impl.RoleImpl; |
19 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceInterface; |
20 | |
21 | /** |
22 | * <!-- begin-user-doc --> |
23 | * An implementation of the model object '<em><b>Resource Provided Role</b></em>'. |
24 | * <!-- end-user-doc --> |
25 | * <p> |
26 | * The following features are implemented: |
27 | * <ul> |
28 | * <li>{@link de.uka.ipd.sdq.pcm.core.entity.impl.ResourceProvidedRoleImpl#getResourceInterfaceProvidingEntity__ResourceProvidedRole <em>Resource Interface Providing Entity Resource Provided Role</em>}</li> |
29 | * <li>{@link de.uka.ipd.sdq.pcm.core.entity.impl.ResourceProvidedRoleImpl#getProvidedResourceInterface__ResourceProvidedRole <em>Provided Resource Interface Resource Provided Role</em>}</li> |
30 | * </ul> |
31 | * </p> |
32 | * |
33 | * @generated |
34 | */ |
35 | public class ResourceProvidedRoleImpl extends RoleImpl implements ResourceProvidedRole { |
36 | /** |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
42 | |
43 | /** |
44 | * The cached value of the '{@link #getProvidedResourceInterface__ResourceProvidedRole() <em>Provided Resource Interface Resource Provided Role</em>}' reference. |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @see #getProvidedResourceInterface__ResourceProvidedRole() |
48 | * @generated |
49 | * @ordered |
50 | */ |
51 | protected ResourceInterface providedResourceInterface__ResourceProvidedRole; |
52 | |
53 | /** |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | protected ResourceProvidedRoleImpl() { |
59 | super(); |
60 | } |
61 | |
62 | /** |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | @Override |
68 | protected EClass eStaticClass() { |
69 | return EntityPackage.Literals.RESOURCE_PROVIDED_ROLE; |
70 | } |
71 | |
72 | /** |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | public ResourceInterfaceProvidingEntity getResourceInterfaceProvidingEntity__ResourceProvidedRole() { |
78 | if (eContainerFeatureID() != EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE) return null; |
79 | return (ResourceInterfaceProvidingEntity)eContainer(); |
80 | } |
81 | |
82 | /** |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | public NotificationChain basicSetResourceInterfaceProvidingEntity__ResourceProvidedRole(ResourceInterfaceProvidingEntity newResourceInterfaceProvidingEntity__ResourceProvidedRole, NotificationChain msgs) { |
88 | msgs = eBasicSetContainer((InternalEObject)newResourceInterfaceProvidingEntity__ResourceProvidedRole, EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE, msgs); |
89 | return msgs; |
90 | } |
91 | |
92 | /** |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | public void setResourceInterfaceProvidingEntity__ResourceProvidedRole(ResourceInterfaceProvidingEntity newResourceInterfaceProvidingEntity__ResourceProvidedRole) { |
98 | if (newResourceInterfaceProvidingEntity__ResourceProvidedRole != eInternalContainer() || (eContainerFeatureID() != EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE && newResourceInterfaceProvidingEntity__ResourceProvidedRole != null)) { |
99 | if (EcoreUtil.isAncestor(this, newResourceInterfaceProvidingEntity__ResourceProvidedRole)) |
100 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
101 | NotificationChain msgs = null; |
102 | if (eInternalContainer() != null) |
103 | msgs = eBasicRemoveFromContainer(msgs); |
104 | if (newResourceInterfaceProvidingEntity__ResourceProvidedRole != null) |
105 | msgs = ((InternalEObject)newResourceInterfaceProvidingEntity__ResourceProvidedRole).eInverseAdd(this, EntityPackage.RESOURCE_INTERFACE_PROVIDING_ENTITY__RESOURCE_PROVIDED_ROLES_RESOURCE_INTERFACE_PROVIDING_ENTITY, ResourceInterfaceProvidingEntity.class, msgs); |
106 | msgs = basicSetResourceInterfaceProvidingEntity__ResourceProvidedRole(newResourceInterfaceProvidingEntity__ResourceProvidedRole, msgs); |
107 | if (msgs != null) msgs.dispatch(); |
108 | } |
109 | else if (eNotificationRequired()) |
110 | eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE, newResourceInterfaceProvidingEntity__ResourceProvidedRole, newResourceInterfaceProvidingEntity__ResourceProvidedRole)); |
111 | } |
112 | |
113 | /** |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | public ResourceInterface getProvidedResourceInterface__ResourceProvidedRole() { |
119 | if (providedResourceInterface__ResourceProvidedRole != null && providedResourceInterface__ResourceProvidedRole.eIsProxy()) { |
120 | InternalEObject oldProvidedResourceInterface__ResourceProvidedRole = (InternalEObject)providedResourceInterface__ResourceProvidedRole; |
121 | providedResourceInterface__ResourceProvidedRole = (ResourceInterface)eResolveProxy(oldProvidedResourceInterface__ResourceProvidedRole); |
122 | if (providedResourceInterface__ResourceProvidedRole != oldProvidedResourceInterface__ResourceProvidedRole) { |
123 | if (eNotificationRequired()) |
124 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, EntityPackage.RESOURCE_PROVIDED_ROLE__PROVIDED_RESOURCE_INTERFACE_RESOURCE_PROVIDED_ROLE, oldProvidedResourceInterface__ResourceProvidedRole, providedResourceInterface__ResourceProvidedRole)); |
125 | } |
126 | } |
127 | return providedResourceInterface__ResourceProvidedRole; |
128 | } |
129 | |
130 | /** |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | public ResourceInterface basicGetProvidedResourceInterface__ResourceProvidedRole() { |
136 | return providedResourceInterface__ResourceProvidedRole; |
137 | } |
138 | |
139 | /** |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | public void setProvidedResourceInterface__ResourceProvidedRole(ResourceInterface newProvidedResourceInterface__ResourceProvidedRole) { |
145 | ResourceInterface oldProvidedResourceInterface__ResourceProvidedRole = providedResourceInterface__ResourceProvidedRole; |
146 | providedResourceInterface__ResourceProvidedRole = newProvidedResourceInterface__ResourceProvidedRole; |
147 | if (eNotificationRequired()) |
148 | eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.RESOURCE_PROVIDED_ROLE__PROVIDED_RESOURCE_INTERFACE_RESOURCE_PROVIDED_ROLE, oldProvidedResourceInterface__ResourceProvidedRole, providedResourceInterface__ResourceProvidedRole)); |
149 | } |
150 | |
151 | /** |
152 | * <!-- begin-user-doc --> |
153 | * <!-- end-user-doc --> |
154 | * @generated |
155 | */ |
156 | @Override |
157 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
158 | switch (featureID) { |
159 | case EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE: |
160 | if (eInternalContainer() != null) |
161 | msgs = eBasicRemoveFromContainer(msgs); |
162 | return basicSetResourceInterfaceProvidingEntity__ResourceProvidedRole((ResourceInterfaceProvidingEntity)otherEnd, msgs); |
163 | } |
164 | return super.eInverseAdd(otherEnd, featureID, msgs); |
165 | } |
166 | |
167 | /** |
168 | * <!-- begin-user-doc --> |
169 | * <!-- end-user-doc --> |
170 | * @generated |
171 | */ |
172 | @Override |
173 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
174 | switch (featureID) { |
175 | case EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE: |
176 | return basicSetResourceInterfaceProvidingEntity__ResourceProvidedRole(null, msgs); |
177 | } |
178 | return super.eInverseRemove(otherEnd, featureID, msgs); |
179 | } |
180 | |
181 | /** |
182 | * <!-- begin-user-doc --> |
183 | * <!-- end-user-doc --> |
184 | * @generated |
185 | */ |
186 | @Override |
187 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
188 | switch (eContainerFeatureID()) { |
189 | case EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE: |
190 | return eInternalContainer().eInverseRemove(this, EntityPackage.RESOURCE_INTERFACE_PROVIDING_ENTITY__RESOURCE_PROVIDED_ROLES_RESOURCE_INTERFACE_PROVIDING_ENTITY, ResourceInterfaceProvidingEntity.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 EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE: |
204 | return getResourceInterfaceProvidingEntity__ResourceProvidedRole(); |
205 | case EntityPackage.RESOURCE_PROVIDED_ROLE__PROVIDED_RESOURCE_INTERFACE_RESOURCE_PROVIDED_ROLE: |
206 | if (resolve) return getProvidedResourceInterface__ResourceProvidedRole(); |
207 | return basicGetProvidedResourceInterface__ResourceProvidedRole(); |
208 | } |
209 | return super.eGet(featureID, resolve, coreType); |
210 | } |
211 | |
212 | /** |
213 | * <!-- begin-user-doc --> |
214 | * <!-- end-user-doc --> |
215 | * @generated |
216 | */ |
217 | @Override |
218 | public void eSet(int featureID, Object newValue) { |
219 | switch (featureID) { |
220 | case EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE: |
221 | setResourceInterfaceProvidingEntity__ResourceProvidedRole((ResourceInterfaceProvidingEntity)newValue); |
222 | return; |
223 | case EntityPackage.RESOURCE_PROVIDED_ROLE__PROVIDED_RESOURCE_INTERFACE_RESOURCE_PROVIDED_ROLE: |
224 | setProvidedResourceInterface__ResourceProvidedRole((ResourceInterface)newValue); |
225 | return; |
226 | } |
227 | super.eSet(featureID, newValue); |
228 | } |
229 | |
230 | /** |
231 | * <!-- begin-user-doc --> |
232 | * <!-- end-user-doc --> |
233 | * @generated |
234 | */ |
235 | @Override |
236 | public void eUnset(int featureID) { |
237 | switch (featureID) { |
238 | case EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE: |
239 | setResourceInterfaceProvidingEntity__ResourceProvidedRole((ResourceInterfaceProvidingEntity)null); |
240 | return; |
241 | case EntityPackage.RESOURCE_PROVIDED_ROLE__PROVIDED_RESOURCE_INTERFACE_RESOURCE_PROVIDED_ROLE: |
242 | setProvidedResourceInterface__ResourceProvidedRole((ResourceInterface)null); |
243 | return; |
244 | } |
245 | super.eUnset(featureID); |
246 | } |
247 | |
248 | /** |
249 | * <!-- begin-user-doc --> |
250 | * <!-- end-user-doc --> |
251 | * @generated |
252 | */ |
253 | @Override |
254 | public boolean eIsSet(int featureID) { |
255 | switch (featureID) { |
256 | case EntityPackage.RESOURCE_PROVIDED_ROLE__RESOURCE_INTERFACE_PROVIDING_ENTITY_RESOURCE_PROVIDED_ROLE: |
257 | return getResourceInterfaceProvidingEntity__ResourceProvidedRole() != null; |
258 | case EntityPackage.RESOURCE_PROVIDED_ROLE__PROVIDED_RESOURCE_INTERFACE_RESOURCE_PROVIDED_ROLE: |
259 | return providedResourceInterface__ResourceProvidedRole != null; |
260 | } |
261 | return super.eIsSet(featureID); |
262 | } |
263 | |
264 | } //ResourceProvidedRoleImpl |