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.NamedElementImpl; |
16 | import de.uka.ipd.sdq.pcm.repository.CompositeDataType; |
17 | import de.uka.ipd.sdq.pcm.repository.DataType; |
18 | import de.uka.ipd.sdq.pcm.repository.InnerDeclaration; |
19 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
20 | |
21 | /** |
22 | * <!-- begin-user-doc --> |
23 | * An implementation of the model object '<em><b>Inner Declaration</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.InnerDeclarationImpl#getDatatype_InnerDeclaration <em>Datatype Inner Declaration</em>}</li> |
29 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.InnerDeclarationImpl#getCompositeDataType_InnerDeclaration <em>Composite Data Type Inner Declaration</em>}</li> |
30 | * </ul> |
31 | * </p> |
32 | * |
33 | * @generated |
34 | */ |
35 | public class InnerDeclarationImpl extends NamedElementImpl implements InnerDeclaration { |
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 #getDatatype_InnerDeclaration() <em>Datatype Inner Declaration</em>}' reference. |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @see #getDatatype_InnerDeclaration() |
48 | * @generated |
49 | * @ordered |
50 | */ |
51 | protected DataType datatype_InnerDeclaration; |
52 | |
53 | /** |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | protected InnerDeclarationImpl() { |
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.INNER_DECLARATION; |
70 | } |
71 | |
72 | /** |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | public DataType getDatatype_InnerDeclaration() { |
78 | if (datatype_InnerDeclaration != null && datatype_InnerDeclaration.eIsProxy()) { |
79 | InternalEObject oldDatatype_InnerDeclaration = (InternalEObject)datatype_InnerDeclaration; |
80 | datatype_InnerDeclaration = (DataType)eResolveProxy(oldDatatype_InnerDeclaration); |
81 | if (datatype_InnerDeclaration != oldDatatype_InnerDeclaration) { |
82 | if (eNotificationRequired()) |
83 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, RepositoryPackage.INNER_DECLARATION__DATATYPE_INNER_DECLARATION, oldDatatype_InnerDeclaration, datatype_InnerDeclaration)); |
84 | } |
85 | } |
86 | return datatype_InnerDeclaration; |
87 | } |
88 | |
89 | /** |
90 | * <!-- begin-user-doc --> |
91 | * <!-- end-user-doc --> |
92 | * @generated |
93 | */ |
94 | public DataType basicGetDatatype_InnerDeclaration() { |
95 | return datatype_InnerDeclaration; |
96 | } |
97 | |
98 | /** |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | public void setDatatype_InnerDeclaration(DataType newDatatype_InnerDeclaration) { |
104 | DataType oldDatatype_InnerDeclaration = datatype_InnerDeclaration; |
105 | datatype_InnerDeclaration = newDatatype_InnerDeclaration; |
106 | if (eNotificationRequired()) |
107 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.INNER_DECLARATION__DATATYPE_INNER_DECLARATION, oldDatatype_InnerDeclaration, datatype_InnerDeclaration)); |
108 | } |
109 | |
110 | /** |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | public CompositeDataType getCompositeDataType_InnerDeclaration() { |
116 | if (eContainerFeatureID() != RepositoryPackage.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION) return null; |
117 | return (CompositeDataType)eContainer(); |
118 | } |
119 | |
120 | /** |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | public NotificationChain basicSetCompositeDataType_InnerDeclaration(CompositeDataType newCompositeDataType_InnerDeclaration, NotificationChain msgs) { |
126 | msgs = eBasicSetContainer((InternalEObject)newCompositeDataType_InnerDeclaration, RepositoryPackage.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION, msgs); |
127 | return msgs; |
128 | } |
129 | |
130 | /** |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | public void setCompositeDataType_InnerDeclaration(CompositeDataType newCompositeDataType_InnerDeclaration) { |
136 | if (newCompositeDataType_InnerDeclaration != eInternalContainer() || (eContainerFeatureID() != RepositoryPackage.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION && newCompositeDataType_InnerDeclaration != null)) { |
137 | if (EcoreUtil.isAncestor(this, newCompositeDataType_InnerDeclaration)) |
138 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
139 | NotificationChain msgs = null; |
140 | if (eInternalContainer() != null) |
141 | msgs = eBasicRemoveFromContainer(msgs); |
142 | if (newCompositeDataType_InnerDeclaration != null) |
143 | msgs = ((InternalEObject)newCompositeDataType_InnerDeclaration).eInverseAdd(this, RepositoryPackage.COMPOSITE_DATA_TYPE__INNER_DECLARATION_COMPOSITE_DATA_TYPE, CompositeDataType.class, msgs); |
144 | msgs = basicSetCompositeDataType_InnerDeclaration(newCompositeDataType_InnerDeclaration, msgs); |
145 | if (msgs != null) msgs.dispatch(); |
146 | } |
147 | else if (eNotificationRequired()) |
148 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION, newCompositeDataType_InnerDeclaration, newCompositeDataType_InnerDeclaration)); |
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.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION: |
160 | if (eInternalContainer() != null) |
161 | msgs = eBasicRemoveFromContainer(msgs); |
162 | return basicSetCompositeDataType_InnerDeclaration((CompositeDataType)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.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION: |
176 | return basicSetCompositeDataType_InnerDeclaration(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.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION: |
190 | return eInternalContainer().eInverseRemove(this, RepositoryPackage.COMPOSITE_DATA_TYPE__INNER_DECLARATION_COMPOSITE_DATA_TYPE, CompositeDataType.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.INNER_DECLARATION__DATATYPE_INNER_DECLARATION: |
204 | if (resolve) return getDatatype_InnerDeclaration(); |
205 | return basicGetDatatype_InnerDeclaration(); |
206 | case RepositoryPackage.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION: |
207 | return getCompositeDataType_InnerDeclaration(); |
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.INNER_DECLARATION__DATATYPE_INNER_DECLARATION: |
221 | setDatatype_InnerDeclaration((DataType)newValue); |
222 | return; |
223 | case RepositoryPackage.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION: |
224 | setCompositeDataType_InnerDeclaration((CompositeDataType)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.INNER_DECLARATION__DATATYPE_INNER_DECLARATION: |
239 | setDatatype_InnerDeclaration((DataType)null); |
240 | return; |
241 | case RepositoryPackage.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION: |
242 | setCompositeDataType_InnerDeclaration((CompositeDataType)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.INNER_DECLARATION__DATATYPE_INNER_DECLARATION: |
257 | return datatype_InnerDeclaration != null; |
258 | case RepositoryPackage.INNER_DECLARATION__COMPOSITE_DATA_TYPE_INNER_DECLARATION: |
259 | return getCompositeDataType_InnerDeclaration() != null; |
260 | } |
261 | return super.eIsSet(featureID); |
262 | } |
263 | |
264 | } //InnerDeclarationImpl |