1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.repository.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.CollectionDataType; |
17 | import de.uka.ipd.sdq.pcm.repository.DataType; |
18 | import de.uka.ipd.sdq.pcm.repository.Repository; |
19 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
20 | |
21 | /** |
22 | * <!-- begin-user-doc --> |
23 | * An implementation of the model object '<em><b>Collection Data Type</b></em>'. |
24 | * <!-- end-user-doc --> |
25 | * <p> |
26 | * The following features are implemented: |
27 | * <ul> |
28 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.CollectionDataTypeImpl#getRepository__DataType <em>Repository Data Type</em>}</li> |
29 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.CollectionDataTypeImpl#getInnerType_CollectionDataType <em>Inner Type Collection Data Type</em>}</li> |
30 | * </ul> |
31 | * </p> |
32 | * |
33 | * @generated |
34 | */ |
35 | public class CollectionDataTypeImpl extends EntityImpl implements CollectionDataType { |
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 #getInnerType_CollectionDataType() <em>Inner Type Collection Data Type</em>}' reference. |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @see #getInnerType_CollectionDataType() |
48 | * @generated |
49 | * @ordered |
50 | */ |
51 | protected DataType innerType_CollectionDataType; |
52 | |
53 | /** |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | protected CollectionDataTypeImpl() { |
59 | super(); |
60 | } |
61 | |
62 | /** |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | @Override |
68 | protected EClass eStaticClass() { |
69 | return RepositoryPackage.Literals.COLLECTION_DATA_TYPE; |
70 | } |
71 | |
72 | /** |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | public Repository getRepository__DataType() { |
78 | if (eContainerFeatureID() != RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE) return null; |
79 | return (Repository)eContainer(); |
80 | } |
81 | |
82 | /** |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | public NotificationChain basicSetRepository__DataType(Repository newRepository__DataType, NotificationChain msgs) { |
88 | msgs = eBasicSetContainer((InternalEObject)newRepository__DataType, RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE, msgs); |
89 | return msgs; |
90 | } |
91 | |
92 | /** |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | public void setRepository__DataType(Repository newRepository__DataType) { |
98 | if (newRepository__DataType != eInternalContainer() || (eContainerFeatureID() != RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE && newRepository__DataType != null)) { |
99 | if (EcoreUtil.isAncestor(this, newRepository__DataType)) |
100 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
101 | NotificationChain msgs = null; |
102 | if (eInternalContainer() != null) |
103 | msgs = eBasicRemoveFromContainer(msgs); |
104 | if (newRepository__DataType != null) |
105 | msgs = ((InternalEObject)newRepository__DataType).eInverseAdd(this, RepositoryPackage.REPOSITORY__DATA_TYPES_REPOSITORY, Repository.class, msgs); |
106 | msgs = basicSetRepository__DataType(newRepository__DataType, msgs); |
107 | if (msgs != null) msgs.dispatch(); |
108 | } |
109 | else if (eNotificationRequired()) |
110 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE, newRepository__DataType, newRepository__DataType)); |
111 | } |
112 | |
113 | /** |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | public DataType getInnerType_CollectionDataType() { |
119 | if (innerType_CollectionDataType != null && innerType_CollectionDataType.eIsProxy()) { |
120 | InternalEObject oldInnerType_CollectionDataType = (InternalEObject)innerType_CollectionDataType; |
121 | innerType_CollectionDataType = (DataType)eResolveProxy(oldInnerType_CollectionDataType); |
122 | if (innerType_CollectionDataType != oldInnerType_CollectionDataType) { |
123 | if (eNotificationRequired()) |
124 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, RepositoryPackage.COLLECTION_DATA_TYPE__INNER_TYPE_COLLECTION_DATA_TYPE, oldInnerType_CollectionDataType, innerType_CollectionDataType)); |
125 | } |
126 | } |
127 | return innerType_CollectionDataType; |
128 | } |
129 | |
130 | /** |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | public DataType basicGetInnerType_CollectionDataType() { |
136 | return innerType_CollectionDataType; |
137 | } |
138 | |
139 | /** |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | public void setInnerType_CollectionDataType(DataType newInnerType_CollectionDataType) { |
145 | DataType oldInnerType_CollectionDataType = innerType_CollectionDataType; |
146 | innerType_CollectionDataType = newInnerType_CollectionDataType; |
147 | if (eNotificationRequired()) |
148 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.COLLECTION_DATA_TYPE__INNER_TYPE_COLLECTION_DATA_TYPE, oldInnerType_CollectionDataType, innerType_CollectionDataType)); |
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 RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE: |
160 | if (eInternalContainer() != null) |
161 | msgs = eBasicRemoveFromContainer(msgs); |
162 | return basicSetRepository__DataType((Repository)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 RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE: |
176 | return basicSetRepository__DataType(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 RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE: |
190 | return eInternalContainer().eInverseRemove(this, RepositoryPackage.REPOSITORY__DATA_TYPES_REPOSITORY, Repository.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 RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE: |
204 | return getRepository__DataType(); |
205 | case RepositoryPackage.COLLECTION_DATA_TYPE__INNER_TYPE_COLLECTION_DATA_TYPE: |
206 | if (resolve) return getInnerType_CollectionDataType(); |
207 | return basicGetInnerType_CollectionDataType(); |
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 RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE: |
221 | setRepository__DataType((Repository)newValue); |
222 | return; |
223 | case RepositoryPackage.COLLECTION_DATA_TYPE__INNER_TYPE_COLLECTION_DATA_TYPE: |
224 | setInnerType_CollectionDataType((DataType)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 RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE: |
239 | setRepository__DataType((Repository)null); |
240 | return; |
241 | case RepositoryPackage.COLLECTION_DATA_TYPE__INNER_TYPE_COLLECTION_DATA_TYPE: |
242 | setInnerType_CollectionDataType((DataType)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 RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE: |
257 | return getRepository__DataType() != null; |
258 | case RepositoryPackage.COLLECTION_DATA_TYPE__INNER_TYPE_COLLECTION_DATA_TYPE: |
259 | return innerType_CollectionDataType != null; |
260 | } |
261 | return super.eIsSet(featureID); |
262 | } |
263 | |
264 | /** |
265 | * <!-- begin-user-doc --> |
266 | * <!-- end-user-doc --> |
267 | * @generated |
268 | */ |
269 | @Override |
270 | public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
271 | if (baseClass == DataType.class) { |
272 | switch (derivedFeatureID) { |
273 | case RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE: return RepositoryPackage.DATA_TYPE__REPOSITORY_DATA_TYPE; |
274 | default: return -1; |
275 | } |
276 | } |
277 | return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
278 | } |
279 | |
280 | /** |
281 | * <!-- begin-user-doc --> |
282 | * <!-- end-user-doc --> |
283 | * @generated |
284 | */ |
285 | @Override |
286 | public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
287 | if (baseClass == DataType.class) { |
288 | switch (baseFeatureID) { |
289 | case RepositoryPackage.DATA_TYPE__REPOSITORY_DATA_TYPE: return RepositoryPackage.COLLECTION_DATA_TYPE__REPOSITORY_DATA_TYPE; |
290 | default: return -1; |
291 | } |
292 | } |
293 | return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
294 | } |
295 | |
296 | } //CollectionDataTypeImpl |