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 java.util.Collection; |
9 | |
10 | import org.eclipse.emf.common.notify.Notification; |
11 | import org.eclipse.emf.common.notify.NotificationChain; |
12 | import org.eclipse.emf.common.util.EList; |
13 | import org.eclipse.emf.ecore.EClass; |
14 | import org.eclipse.emf.ecore.InternalEObject; |
15 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
16 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
17 | import org.eclipse.emf.ecore.util.EcoreUtil; |
18 | import org.eclipse.emf.ecore.util.InternalEList; |
19 | |
20 | import de.uka.ipd.sdq.pcm.core.entity.impl.EntityImpl; |
21 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceInterface; |
22 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceRepository; |
23 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceSignature; |
24 | import de.uka.ipd.sdq.pcm.resourcetype.ResourcetypePackage; |
25 | |
26 | /** |
27 | * <!-- begin-user-doc --> |
28 | * An implementation of the model object '<em><b>Resource Interface</b></em>'. |
29 | * <!-- end-user-doc --> |
30 | * <p> |
31 | * The following features are implemented: |
32 | * <ul> |
33 | * <li>{@link de.uka.ipd.sdq.pcm.resourcetype.impl.ResourceInterfaceImpl#getResourceRepository__ResourceInterface <em>Resource Repository Resource Interface</em>}</li> |
34 | * <li>{@link de.uka.ipd.sdq.pcm.resourcetype.impl.ResourceInterfaceImpl#getResourceSignatures__ResourceInterface <em>Resource Signatures Resource Interface</em>}</li> |
35 | * </ul> |
36 | * </p> |
37 | * |
38 | * @generated |
39 | */ |
40 | public class ResourceInterfaceImpl extends EntityImpl implements ResourceInterface { |
41 | /** |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @generated |
45 | */ |
46 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
47 | |
48 | /** |
49 | * The cached value of the '{@link #getResourceSignatures__ResourceInterface() <em>Resource Signatures Resource Interface</em>}' containment reference list. |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @see #getResourceSignatures__ResourceInterface() |
53 | * @generated |
54 | * @ordered |
55 | */ |
56 | protected EList<ResourceSignature> resourceSignatures__ResourceInterface; |
57 | |
58 | /** |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @generated |
62 | */ |
63 | protected ResourceInterfaceImpl() { |
64 | super(); |
65 | } |
66 | |
67 | /** |
68 | * <!-- begin-user-doc --> |
69 | * <!-- end-user-doc --> |
70 | * @generated |
71 | */ |
72 | @Override |
73 | protected EClass eStaticClass() { |
74 | return ResourcetypePackage.Literals.RESOURCE_INTERFACE; |
75 | } |
76 | |
77 | /** |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | public ResourceRepository getResourceRepository__ResourceInterface() { |
83 | if (eContainerFeatureID() != ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE) return null; |
84 | return (ResourceRepository)eContainer(); |
85 | } |
86 | |
87 | /** |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | public NotificationChain basicSetResourceRepository__ResourceInterface(ResourceRepository newResourceRepository__ResourceInterface, NotificationChain msgs) { |
93 | msgs = eBasicSetContainer((InternalEObject)newResourceRepository__ResourceInterface, ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE, msgs); |
94 | return msgs; |
95 | } |
96 | |
97 | /** |
98 | * <!-- begin-user-doc --> |
99 | * <!-- end-user-doc --> |
100 | * @generated |
101 | */ |
102 | public void setResourceRepository__ResourceInterface(ResourceRepository newResourceRepository__ResourceInterface) { |
103 | if (newResourceRepository__ResourceInterface != eInternalContainer() || (eContainerFeatureID() != ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE && newResourceRepository__ResourceInterface != null)) { |
104 | if (EcoreUtil.isAncestor(this, newResourceRepository__ResourceInterface)) |
105 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
106 | NotificationChain msgs = null; |
107 | if (eInternalContainer() != null) |
108 | msgs = eBasicRemoveFromContainer(msgs); |
109 | if (newResourceRepository__ResourceInterface != null) |
110 | msgs = ((InternalEObject)newResourceRepository__ResourceInterface).eInverseAdd(this, ResourcetypePackage.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY, ResourceRepository.class, msgs); |
111 | msgs = basicSetResourceRepository__ResourceInterface(newResourceRepository__ResourceInterface, msgs); |
112 | if (msgs != null) msgs.dispatch(); |
113 | } |
114 | else if (eNotificationRequired()) |
115 | eNotify(new ENotificationImpl(this, Notification.SET, ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE, newResourceRepository__ResourceInterface, newResourceRepository__ResourceInterface)); |
116 | } |
117 | |
118 | /** |
119 | * <!-- begin-user-doc --> |
120 | * <!-- end-user-doc --> |
121 | * @generated |
122 | */ |
123 | public EList<ResourceSignature> getResourceSignatures__ResourceInterface() { |
124 | if (resourceSignatures__ResourceInterface == null) { |
125 | resourceSignatures__ResourceInterface = new EObjectContainmentWithInverseEList<ResourceSignature>(ResourceSignature.class, this, ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_SIGNATURES_RESOURCE_INTERFACE, ResourcetypePackage.RESOURCE_SIGNATURE__RESOURCE_INTERFACE_RESOURCE_SIGNATURE); |
126 | } |
127 | return resourceSignatures__ResourceInterface; |
128 | } |
129 | |
130 | /** |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | @SuppressWarnings("unchecked") |
136 | @Override |
137 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
138 | switch (featureID) { |
139 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE: |
140 | if (eInternalContainer() != null) |
141 | msgs = eBasicRemoveFromContainer(msgs); |
142 | return basicSetResourceRepository__ResourceInterface((ResourceRepository)otherEnd, msgs); |
143 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_SIGNATURES_RESOURCE_INTERFACE: |
144 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getResourceSignatures__ResourceInterface()).basicAdd(otherEnd, msgs); |
145 | } |
146 | return super.eInverseAdd(otherEnd, featureID, msgs); |
147 | } |
148 | |
149 | /** |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
156 | switch (featureID) { |
157 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE: |
158 | return basicSetResourceRepository__ResourceInterface(null, msgs); |
159 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_SIGNATURES_RESOURCE_INTERFACE: |
160 | return ((InternalEList<?>)getResourceSignatures__ResourceInterface()).basicRemove(otherEnd, msgs); |
161 | } |
162 | return super.eInverseRemove(otherEnd, featureID, msgs); |
163 | } |
164 | |
165 | /** |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | @Override |
171 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
172 | switch (eContainerFeatureID()) { |
173 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE: |
174 | return eInternalContainer().eInverseRemove(this, ResourcetypePackage.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY, ResourceRepository.class, msgs); |
175 | } |
176 | return super.eBasicRemoveFromContainerFeature(msgs); |
177 | } |
178 | |
179 | /** |
180 | * <!-- begin-user-doc --> |
181 | * <!-- end-user-doc --> |
182 | * @generated |
183 | */ |
184 | @Override |
185 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
186 | switch (featureID) { |
187 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE: |
188 | return getResourceRepository__ResourceInterface(); |
189 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_SIGNATURES_RESOURCE_INTERFACE: |
190 | return getResourceSignatures__ResourceInterface(); |
191 | } |
192 | return super.eGet(featureID, resolve, coreType); |
193 | } |
194 | |
195 | /** |
196 | * <!-- begin-user-doc --> |
197 | * <!-- end-user-doc --> |
198 | * @generated |
199 | */ |
200 | @SuppressWarnings("unchecked") |
201 | @Override |
202 | public void eSet(int featureID, Object newValue) { |
203 | switch (featureID) { |
204 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE: |
205 | setResourceRepository__ResourceInterface((ResourceRepository)newValue); |
206 | return; |
207 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_SIGNATURES_RESOURCE_INTERFACE: |
208 | getResourceSignatures__ResourceInterface().clear(); |
209 | getResourceSignatures__ResourceInterface().addAll((Collection<? extends ResourceSignature>)newValue); |
210 | return; |
211 | } |
212 | super.eSet(featureID, newValue); |
213 | } |
214 | |
215 | /** |
216 | * <!-- begin-user-doc --> |
217 | * <!-- end-user-doc --> |
218 | * @generated |
219 | */ |
220 | @Override |
221 | public void eUnset(int featureID) { |
222 | switch (featureID) { |
223 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE: |
224 | setResourceRepository__ResourceInterface((ResourceRepository)null); |
225 | return; |
226 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_SIGNATURES_RESOURCE_INTERFACE: |
227 | getResourceSignatures__ResourceInterface().clear(); |
228 | return; |
229 | } |
230 | super.eUnset(featureID); |
231 | } |
232 | |
233 | /** |
234 | * <!-- begin-user-doc --> |
235 | * <!-- end-user-doc --> |
236 | * @generated |
237 | */ |
238 | @Override |
239 | public boolean eIsSet(int featureID) { |
240 | switch (featureID) { |
241 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE: |
242 | return getResourceRepository__ResourceInterface() != null; |
243 | case ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_SIGNATURES_RESOURCE_INTERFACE: |
244 | return resourceSignatures__ResourceInterface != null && !resourceSignatures__ResourceInterface.isEmpty(); |
245 | } |
246 | return super.eIsSet(featureID); |
247 | } |
248 | |
249 | } //ResourceInterfaceImpl |