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.ResourceInterfaceRequiringEntity; |
17 | import de.uka.ipd.sdq.pcm.core.entity.ResourceRequiredRole; |
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 Required 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.ResourceRequiredRoleImpl#getRequiredResourceInterface__ResourceRequiredRole <em>Required Resource Interface Resource Required Role</em>}</li> |
29 | * <li>{@link de.uka.ipd.sdq.pcm.core.entity.impl.ResourceRequiredRoleImpl#getResourceInterfaceRequiringEntity__ResourceRequiredRole <em>Resource Interface Requiring Entity Resource Required Role</em>}</li> |
30 | * </ul> |
31 | * </p> |
32 | * |
33 | * @generated |
34 | */ |
35 | public class ResourceRequiredRoleImpl extends RoleImpl implements ResourceRequiredRole { |
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 #getRequiredResourceInterface__ResourceRequiredRole() <em>Required Resource Interface Resource Required Role</em>}' reference. |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @see #getRequiredResourceInterface__ResourceRequiredRole() |
48 | * @generated |
49 | * @ordered |
50 | */ |
51 | protected ResourceInterface requiredResourceInterface__ResourceRequiredRole; |
52 | |
53 | /** |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | protected ResourceRequiredRoleImpl() { |
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_REQUIRED_ROLE; |
70 | } |
71 | |
72 | /** |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | public ResourceInterface getRequiredResourceInterface__ResourceRequiredRole() { |
78 | if (requiredResourceInterface__ResourceRequiredRole != null && requiredResourceInterface__ResourceRequiredRole.eIsProxy()) { |
79 | InternalEObject oldRequiredResourceInterface__ResourceRequiredRole = (InternalEObject)requiredResourceInterface__ResourceRequiredRole; |
80 | requiredResourceInterface__ResourceRequiredRole = (ResourceInterface)eResolveProxy(oldRequiredResourceInterface__ResourceRequiredRole); |
81 | if (requiredResourceInterface__ResourceRequiredRole != oldRequiredResourceInterface__ResourceRequiredRole) { |
82 | if (eNotificationRequired()) |
83 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, EntityPackage.RESOURCE_REQUIRED_ROLE__REQUIRED_RESOURCE_INTERFACE_RESOURCE_REQUIRED_ROLE, oldRequiredResourceInterface__ResourceRequiredRole, requiredResourceInterface__ResourceRequiredRole)); |
84 | } |
85 | } |
86 | return requiredResourceInterface__ResourceRequiredRole; |
87 | } |
88 | |
89 | /** |
90 | * <!-- begin-user-doc --> |
91 | * <!-- end-user-doc --> |
92 | * @generated |
93 | */ |
94 | public ResourceInterface basicGetRequiredResourceInterface__ResourceRequiredRole() { |
95 | return requiredResourceInterface__ResourceRequiredRole; |
96 | } |
97 | |
98 | /** |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | public void setRequiredResourceInterface__ResourceRequiredRole(ResourceInterface newRequiredResourceInterface__ResourceRequiredRole) { |
104 | ResourceInterface oldRequiredResourceInterface__ResourceRequiredRole = requiredResourceInterface__ResourceRequiredRole; |
105 | requiredResourceInterface__ResourceRequiredRole = newRequiredResourceInterface__ResourceRequiredRole; |
106 | if (eNotificationRequired()) |
107 | eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.RESOURCE_REQUIRED_ROLE__REQUIRED_RESOURCE_INTERFACE_RESOURCE_REQUIRED_ROLE, oldRequiredResourceInterface__ResourceRequiredRole, requiredResourceInterface__ResourceRequiredRole)); |
108 | } |
109 | |
110 | /** |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | public ResourceInterfaceRequiringEntity getResourceInterfaceRequiringEntity__ResourceRequiredRole() { |
116 | if (eContainerFeatureID() != EntityPackage.RESOURCE_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE) return null; |
117 | return (ResourceInterfaceRequiringEntity)eContainer(); |
118 | } |
119 | |
120 | /** |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | public NotificationChain basicSetResourceInterfaceRequiringEntity__ResourceRequiredRole(ResourceInterfaceRequiringEntity newResourceInterfaceRequiringEntity__ResourceRequiredRole, NotificationChain msgs) { |
126 | msgs = eBasicSetContainer((InternalEObject)newResourceInterfaceRequiringEntity__ResourceRequiredRole, EntityPackage.RESOURCE_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE, msgs); |
127 | return msgs; |
128 | } |
129 | |
130 | /** |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | public void setResourceInterfaceRequiringEntity__ResourceRequiredRole(ResourceInterfaceRequiringEntity newResourceInterfaceRequiringEntity__ResourceRequiredRole) { |
136 | if (newResourceInterfaceRequiringEntity__ResourceRequiredRole != eInternalContainer() || (eContainerFeatureID() != EntityPackage.RESOURCE_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE && newResourceInterfaceRequiringEntity__ResourceRequiredRole != null)) { |
137 | if (EcoreUtil.isAncestor(this, newResourceInterfaceRequiringEntity__ResourceRequiredRole)) |
138 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
139 | NotificationChain msgs = null; |
140 | if (eInternalContainer() != null) |
141 | msgs = eBasicRemoveFromContainer(msgs); |
142 | if (newResourceInterfaceRequiringEntity__ResourceRequiredRole != null) |
143 | msgs = ((InternalEObject)newResourceInterfaceRequiringEntity__ResourceRequiredRole).eInverseAdd(this, EntityPackage.RESOURCE_INTERFACE_REQUIRING_ENTITY__RESOURCE_REQUIRED_ROLES_RESOURCE_INTERFACE_REQUIRING_ENTITY, ResourceInterfaceRequiringEntity.class, msgs); |
144 | msgs = basicSetResourceInterfaceRequiringEntity__ResourceRequiredRole(newResourceInterfaceRequiringEntity__ResourceRequiredRole, msgs); |
145 | if (msgs != null) msgs.dispatch(); |
146 | } |
147 | else if (eNotificationRequired()) |
148 | eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.RESOURCE_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE, newResourceInterfaceRequiringEntity__ResourceRequiredRole, newResourceInterfaceRequiringEntity__ResourceRequiredRole)); |
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_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE: |
160 | if (eInternalContainer() != null) |
161 | msgs = eBasicRemoveFromContainer(msgs); |
162 | return basicSetResourceInterfaceRequiringEntity__ResourceRequiredRole((ResourceInterfaceRequiringEntity)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_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE: |
176 | return basicSetResourceInterfaceRequiringEntity__ResourceRequiredRole(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_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE: |
190 | return eInternalContainer().eInverseRemove(this, EntityPackage.RESOURCE_INTERFACE_REQUIRING_ENTITY__RESOURCE_REQUIRED_ROLES_RESOURCE_INTERFACE_REQUIRING_ENTITY, ResourceInterfaceRequiringEntity.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_REQUIRED_ROLE__REQUIRED_RESOURCE_INTERFACE_RESOURCE_REQUIRED_ROLE: |
204 | if (resolve) return getRequiredResourceInterface__ResourceRequiredRole(); |
205 | return basicGetRequiredResourceInterface__ResourceRequiredRole(); |
206 | case EntityPackage.RESOURCE_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE: |
207 | return getResourceInterfaceRequiringEntity__ResourceRequiredRole(); |
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_REQUIRED_ROLE__REQUIRED_RESOURCE_INTERFACE_RESOURCE_REQUIRED_ROLE: |
221 | setRequiredResourceInterface__ResourceRequiredRole((ResourceInterface)newValue); |
222 | return; |
223 | case EntityPackage.RESOURCE_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE: |
224 | setResourceInterfaceRequiringEntity__ResourceRequiredRole((ResourceInterfaceRequiringEntity)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_REQUIRED_ROLE__REQUIRED_RESOURCE_INTERFACE_RESOURCE_REQUIRED_ROLE: |
239 | setRequiredResourceInterface__ResourceRequiredRole((ResourceInterface)null); |
240 | return; |
241 | case EntityPackage.RESOURCE_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE: |
242 | setResourceInterfaceRequiringEntity__ResourceRequiredRole((ResourceInterfaceRequiringEntity)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_REQUIRED_ROLE__REQUIRED_RESOURCE_INTERFACE_RESOURCE_REQUIRED_ROLE: |
257 | return requiredResourceInterface__ResourceRequiredRole != null; |
258 | case EntityPackage.RESOURCE_REQUIRED_ROLE__RESOURCE_INTERFACE_REQUIRING_ENTITY_RESOURCE_REQUIRED_ROLE: |
259 | return getResourceInterfaceRequiringEntity__ResourceRequiredRole() != null; |
260 | } |
261 | return super.eIsSet(featureID); |
262 | } |
263 | |
264 | } //ResourceRequiredRoleImpl |