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