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.impl.EObjectImpl; |
14 | import org.eclipse.emf.ecore.util.EcoreUtil; |
15 | |
16 | import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisationType; |
17 | import de.uka.ipd.sdq.pcm.repository.Interface; |
18 | import de.uka.ipd.sdq.pcm.repository.Parameter; |
19 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
20 | import de.uka.ipd.sdq.pcm.repository.RequiredCharacterisation; |
21 | |
22 | /** |
23 | * <!-- begin-user-doc --> |
24 | * An implementation of the model object '<em><b>Required Characterisation</b></em>'. |
25 | * <!-- end-user-doc --> |
26 | * <p> |
27 | * The following features are implemented: |
28 | * <ul> |
29 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.RequiredCharacterisationImpl#getType <em>Type</em>}</li> |
30 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.RequiredCharacterisationImpl#getParameter <em>Parameter</em>}</li> |
31 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.RequiredCharacterisationImpl#getInterface_RequiredCharacterisation <em>Interface Required Characterisation</em>}</li> |
32 | * </ul> |
33 | * </p> |
34 | * |
35 | * @generated |
36 | */ |
37 | public class RequiredCharacterisationImpl extends EObjectImpl implements RequiredCharacterisation { |
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 default value of the '{@link #getType() <em>Type</em>}' attribute. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @see #getType() |
50 | * @generated |
51 | * @ordered |
52 | */ |
53 | protected static final VariableCharacterisationType TYPE_EDEFAULT = VariableCharacterisationType.STRUCTURE; |
54 | |
55 | /** |
56 | * The cached value of the '{@link #getType() <em>Type</em>}' attribute. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @see #getType() |
60 | * @generated |
61 | * @ordered |
62 | */ |
63 | protected VariableCharacterisationType type = TYPE_EDEFAULT; |
64 | |
65 | /** |
66 | * The cached value of the '{@link #getParameter() <em>Parameter</em>}' reference. |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @see #getParameter() |
70 | * @generated |
71 | * @ordered |
72 | */ |
73 | protected Parameter parameter; |
74 | |
75 | /** |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @generated |
79 | */ |
80 | protected RequiredCharacterisationImpl() { |
81 | super(); |
82 | } |
83 | |
84 | /** |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | @Override |
90 | protected EClass eStaticClass() { |
91 | return RepositoryPackage.Literals.REQUIRED_CHARACTERISATION; |
92 | } |
93 | |
94 | /** |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | public VariableCharacterisationType getType() { |
100 | return type; |
101 | } |
102 | |
103 | /** |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | public void setType(VariableCharacterisationType newType) { |
109 | VariableCharacterisationType oldType = type; |
110 | type = newType == null ? TYPE_EDEFAULT : newType; |
111 | if (eNotificationRequired()) |
112 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.REQUIRED_CHARACTERISATION__TYPE, oldType, type)); |
113 | } |
114 | |
115 | /** |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | public Parameter getParameter() { |
121 | if (parameter != null && parameter.eIsProxy()) { |
122 | InternalEObject oldParameter = (InternalEObject)parameter; |
123 | parameter = (Parameter)eResolveProxy(oldParameter); |
124 | if (parameter != oldParameter) { |
125 | if (eNotificationRequired()) |
126 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, RepositoryPackage.REQUIRED_CHARACTERISATION__PARAMETER, oldParameter, parameter)); |
127 | } |
128 | } |
129 | return parameter; |
130 | } |
131 | |
132 | /** |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | public Parameter basicGetParameter() { |
138 | return parameter; |
139 | } |
140 | |
141 | /** |
142 | * <!-- begin-user-doc --> |
143 | * <!-- end-user-doc --> |
144 | * @generated |
145 | */ |
146 | public void setParameter(Parameter newParameter) { |
147 | Parameter oldParameter = parameter; |
148 | parameter = newParameter; |
149 | if (eNotificationRequired()) |
150 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.REQUIRED_CHARACTERISATION__PARAMETER, oldParameter, parameter)); |
151 | } |
152 | |
153 | /** |
154 | * <!-- begin-user-doc --> |
155 | * <!-- end-user-doc --> |
156 | * @generated |
157 | */ |
158 | public Interface getInterface_RequiredCharacterisation() { |
159 | if (eContainerFeatureID() != RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION) return null; |
160 | return (Interface)eContainer(); |
161 | } |
162 | |
163 | /** |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @generated |
167 | */ |
168 | public NotificationChain basicSetInterface_RequiredCharacterisation(Interface newInterface_RequiredCharacterisation, NotificationChain msgs) { |
169 | msgs = eBasicSetContainer((InternalEObject)newInterface_RequiredCharacterisation, RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION, msgs); |
170 | return msgs; |
171 | } |
172 | |
173 | /** |
174 | * <!-- begin-user-doc --> |
175 | * <!-- end-user-doc --> |
176 | * @generated |
177 | */ |
178 | public void setInterface_RequiredCharacterisation(Interface newInterface_RequiredCharacterisation) { |
179 | if (newInterface_RequiredCharacterisation != eInternalContainer() || (eContainerFeatureID() != RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION && newInterface_RequiredCharacterisation != null)) { |
180 | if (EcoreUtil.isAncestor(this, newInterface_RequiredCharacterisation)) |
181 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
182 | NotificationChain msgs = null; |
183 | if (eInternalContainer() != null) |
184 | msgs = eBasicRemoveFromContainer(msgs); |
185 | if (newInterface_RequiredCharacterisation != null) |
186 | msgs = ((InternalEObject)newInterface_RequiredCharacterisation).eInverseAdd(this, RepositoryPackage.INTERFACE__REQUIRED_CHARACTERISATIONS, Interface.class, msgs); |
187 | msgs = basicSetInterface_RequiredCharacterisation(newInterface_RequiredCharacterisation, msgs); |
188 | if (msgs != null) msgs.dispatch(); |
189 | } |
190 | else if (eNotificationRequired()) |
191 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION, newInterface_RequiredCharacterisation, newInterface_RequiredCharacterisation)); |
192 | } |
193 | |
194 | /** |
195 | * <!-- begin-user-doc --> |
196 | * <!-- end-user-doc --> |
197 | * @generated |
198 | */ |
199 | @Override |
200 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
201 | switch (featureID) { |
202 | case RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION: |
203 | if (eInternalContainer() != null) |
204 | msgs = eBasicRemoveFromContainer(msgs); |
205 | return basicSetInterface_RequiredCharacterisation((Interface)otherEnd, msgs); |
206 | } |
207 | return super.eInverseAdd(otherEnd, featureID, msgs); |
208 | } |
209 | |
210 | /** |
211 | * <!-- begin-user-doc --> |
212 | * <!-- end-user-doc --> |
213 | * @generated |
214 | */ |
215 | @Override |
216 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
217 | switch (featureID) { |
218 | case RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION: |
219 | return basicSetInterface_RequiredCharacterisation(null, msgs); |
220 | } |
221 | return super.eInverseRemove(otherEnd, featureID, msgs); |
222 | } |
223 | |
224 | /** |
225 | * <!-- begin-user-doc --> |
226 | * <!-- end-user-doc --> |
227 | * @generated |
228 | */ |
229 | @Override |
230 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
231 | switch (eContainerFeatureID()) { |
232 | case RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION: |
233 | return eInternalContainer().eInverseRemove(this, RepositoryPackage.INTERFACE__REQUIRED_CHARACTERISATIONS, Interface.class, msgs); |
234 | } |
235 | return super.eBasicRemoveFromContainerFeature(msgs); |
236 | } |
237 | |
238 | /** |
239 | * <!-- begin-user-doc --> |
240 | * <!-- end-user-doc --> |
241 | * @generated |
242 | */ |
243 | @Override |
244 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
245 | switch (featureID) { |
246 | case RepositoryPackage.REQUIRED_CHARACTERISATION__TYPE: |
247 | return getType(); |
248 | case RepositoryPackage.REQUIRED_CHARACTERISATION__PARAMETER: |
249 | if (resolve) return getParameter(); |
250 | return basicGetParameter(); |
251 | case RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION: |
252 | return getInterface_RequiredCharacterisation(); |
253 | } |
254 | return super.eGet(featureID, resolve, coreType); |
255 | } |
256 | |
257 | /** |
258 | * <!-- begin-user-doc --> |
259 | * <!-- end-user-doc --> |
260 | * @generated |
261 | */ |
262 | @Override |
263 | public void eSet(int featureID, Object newValue) { |
264 | switch (featureID) { |
265 | case RepositoryPackage.REQUIRED_CHARACTERISATION__TYPE: |
266 | setType((VariableCharacterisationType)newValue); |
267 | return; |
268 | case RepositoryPackage.REQUIRED_CHARACTERISATION__PARAMETER: |
269 | setParameter((Parameter)newValue); |
270 | return; |
271 | case RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION: |
272 | setInterface_RequiredCharacterisation((Interface)newValue); |
273 | return; |
274 | } |
275 | super.eSet(featureID, newValue); |
276 | } |
277 | |
278 | /** |
279 | * <!-- begin-user-doc --> |
280 | * <!-- end-user-doc --> |
281 | * @generated |
282 | */ |
283 | @Override |
284 | public void eUnset(int featureID) { |
285 | switch (featureID) { |
286 | case RepositoryPackage.REQUIRED_CHARACTERISATION__TYPE: |
287 | setType(TYPE_EDEFAULT); |
288 | return; |
289 | case RepositoryPackage.REQUIRED_CHARACTERISATION__PARAMETER: |
290 | setParameter((Parameter)null); |
291 | return; |
292 | case RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION: |
293 | setInterface_RequiredCharacterisation((Interface)null); |
294 | return; |
295 | } |
296 | super.eUnset(featureID); |
297 | } |
298 | |
299 | /** |
300 | * <!-- begin-user-doc --> |
301 | * <!-- end-user-doc --> |
302 | * @generated |
303 | */ |
304 | @Override |
305 | public boolean eIsSet(int featureID) { |
306 | switch (featureID) { |
307 | case RepositoryPackage.REQUIRED_CHARACTERISATION__TYPE: |
308 | return type != TYPE_EDEFAULT; |
309 | case RepositoryPackage.REQUIRED_CHARACTERISATION__PARAMETER: |
310 | return parameter != null; |
311 | case RepositoryPackage.REQUIRED_CHARACTERISATION__INTERFACE_REQUIRED_CHARACTERISATION: |
312 | return getInterface_RequiredCharacterisation() != null; |
313 | } |
314 | return super.eIsSet(featureID); |
315 | } |
316 | |
317 | /** |
318 | * <!-- begin-user-doc --> |
319 | * <!-- end-user-doc --> |
320 | * @generated |
321 | */ |
322 | @Override |
323 | public String toString() { |
324 | if (eIsProxy()) return super.toString(); |
325 | |
326 | StringBuffer result = new StringBuffer(super.toString()); |
327 | result.append(" (type: "); |
328 | result.append(type); |
329 | result.append(')'); |
330 | return result.toString(); |
331 | } |
332 | |
333 | } //RequiredCharacterisationImpl |