1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.fzi.se.quality.parameters.impl; |
8 | |
9 | import de.fzi.se.quality.parameters.ParameterInstance; |
10 | import de.fzi.se.quality.parameters.ParameterReference; |
11 | import de.fzi.se.quality.parameters.ParametersPackage; |
12 | |
13 | import de.fzi.se.quality.qualityannotation.CallParameterDeviation; |
14 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
15 | |
16 | import de.uka.ipd.sdq.identifier.impl.IdentifierImpl; |
17 | |
18 | import org.eclipse.emf.common.notify.Notification; |
19 | import org.eclipse.emf.common.notify.NotificationChain; |
20 | |
21 | import org.eclipse.emf.ecore.EClass; |
22 | import org.eclipse.emf.ecore.InternalEObject; |
23 | |
24 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
25 | |
26 | import org.eclipse.emf.ecore.util.EcoreUtil; |
27 | |
28 | /** |
29 | * <!-- begin-user-doc --> |
30 | * An implementation of the model object '<em><b>Parameter Reference</b></em>'. |
31 | * <!-- end-user-doc --> |
32 | * <p> |
33 | * The following features are implemented: |
34 | * <ul> |
35 | * <li>{@link de.fzi.se.quality.parameters.impl.ParameterReferenceImpl#getParameterInstance <em>Parameter Instance</em>}</li> |
36 | * <li>{@link de.fzi.se.quality.parameters.impl.ParameterReferenceImpl#getCallParameterDeviation <em>Call Parameter Deviation</em>}</li> |
37 | * </ul> |
38 | * </p> |
39 | * |
40 | * @generated |
41 | */ |
42 | public abstract class ParameterReferenceImpl extends IdentifierImpl implements ParameterReference { |
43 | /** |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @generated |
47 | */ |
48 | protected ParameterReferenceImpl() { |
49 | super(); |
50 | } |
51 | |
52 | /** |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | @Override |
58 | protected EClass eStaticClass() { |
59 | return ParametersPackage.Literals.PARAMETER_REFERENCE; |
60 | } |
61 | |
62 | /** |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | public ParameterInstance getParameterInstance() { |
68 | if (eContainerFeatureID() != ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE) return null; |
69 | return (ParameterInstance)eContainer(); |
70 | } |
71 | |
72 | /** |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | public NotificationChain basicSetParameterInstance(ParameterInstance newParameterInstance, NotificationChain msgs) { |
78 | msgs = eBasicSetContainer((InternalEObject)newParameterInstance, ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE, msgs); |
79 | return msgs; |
80 | } |
81 | |
82 | /** |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | public void setParameterInstance(ParameterInstance newParameterInstance) { |
88 | if (newParameterInstance != eInternalContainer() || (eContainerFeatureID() != ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE && newParameterInstance != null)) { |
89 | if (EcoreUtil.isAncestor(this, newParameterInstance)) |
90 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
91 | NotificationChain msgs = null; |
92 | if (eInternalContainer() != null) |
93 | msgs = eBasicRemoveFromContainer(msgs); |
94 | if (newParameterInstance != null) |
95 | msgs = ((InternalEObject)newParameterInstance).eInverseAdd(this, ParametersPackage.PARAMETER_INSTANCE__PARAMETER_REFERENCE, ParameterInstance.class, msgs); |
96 | msgs = basicSetParameterInstance(newParameterInstance, msgs); |
97 | if (msgs != null) msgs.dispatch(); |
98 | } |
99 | else if (eNotificationRequired()) |
100 | eNotify(new ENotificationImpl(this, Notification.SET, ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE, newParameterInstance, newParameterInstance)); |
101 | } |
102 | |
103 | /** |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | public CallParameterDeviation getCallParameterDeviation() { |
109 | if (eContainerFeatureID() != ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION) return null; |
110 | return (CallParameterDeviation)eContainer(); |
111 | } |
112 | |
113 | /** |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | public NotificationChain basicSetCallParameterDeviation(CallParameterDeviation newCallParameterDeviation, NotificationChain msgs) { |
119 | msgs = eBasicSetContainer((InternalEObject)newCallParameterDeviation, ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION, msgs); |
120 | return msgs; |
121 | } |
122 | |
123 | /** |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated |
127 | */ |
128 | public void setCallParameterDeviation(CallParameterDeviation newCallParameterDeviation) { |
129 | if (newCallParameterDeviation != eInternalContainer() || (eContainerFeatureID() != ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION && newCallParameterDeviation != null)) { |
130 | if (EcoreUtil.isAncestor(this, newCallParameterDeviation)) |
131 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
132 | NotificationChain msgs = null; |
133 | if (eInternalContainer() != null) |
134 | msgs = eBasicRemoveFromContainer(msgs); |
135 | if (newCallParameterDeviation != null) |
136 | msgs = ((InternalEObject)newCallParameterDeviation).eInverseAdd(this, QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE, CallParameterDeviation.class, msgs); |
137 | msgs = basicSetCallParameterDeviation(newCallParameterDeviation, msgs); |
138 | if (msgs != null) msgs.dispatch(); |
139 | } |
140 | else if (eNotificationRequired()) |
141 | eNotify(new ENotificationImpl(this, Notification.SET, ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION, newCallParameterDeviation, newCallParameterDeviation)); |
142 | } |
143 | |
144 | /** |
145 | * <!-- begin-user-doc --> |
146 | * <!-- end-user-doc --> |
147 | * @generated |
148 | */ |
149 | @Override |
150 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
151 | switch (featureID) { |
152 | case ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE: |
153 | if (eInternalContainer() != null) |
154 | msgs = eBasicRemoveFromContainer(msgs); |
155 | return basicSetParameterInstance((ParameterInstance)otherEnd, msgs); |
156 | case ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION: |
157 | if (eInternalContainer() != null) |
158 | msgs = eBasicRemoveFromContainer(msgs); |
159 | return basicSetCallParameterDeviation((CallParameterDeviation)otherEnd, msgs); |
160 | } |
161 | return super.eInverseAdd(otherEnd, featureID, msgs); |
162 | } |
163 | |
164 | /** |
165 | * <!-- begin-user-doc --> |
166 | * <!-- end-user-doc --> |
167 | * @generated |
168 | */ |
169 | @Override |
170 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
171 | switch (featureID) { |
172 | case ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE: |
173 | return basicSetParameterInstance(null, msgs); |
174 | case ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION: |
175 | return basicSetCallParameterDeviation(null, msgs); |
176 | } |
177 | return super.eInverseRemove(otherEnd, featureID, msgs); |
178 | } |
179 | |
180 | /** |
181 | * <!-- begin-user-doc --> |
182 | * <!-- end-user-doc --> |
183 | * @generated |
184 | */ |
185 | @Override |
186 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
187 | switch (eContainerFeatureID()) { |
188 | case ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE: |
189 | return eInternalContainer().eInverseRemove(this, ParametersPackage.PARAMETER_INSTANCE__PARAMETER_REFERENCE, ParameterInstance.class, msgs); |
190 | case ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION: |
191 | return eInternalContainer().eInverseRemove(this, QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE, CallParameterDeviation.class, msgs); |
192 | } |
193 | return super.eBasicRemoveFromContainerFeature(msgs); |
194 | } |
195 | |
196 | /** |
197 | * <!-- begin-user-doc --> |
198 | * <!-- end-user-doc --> |
199 | * @generated |
200 | */ |
201 | @Override |
202 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
203 | switch (featureID) { |
204 | case ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE: |
205 | return getParameterInstance(); |
206 | case ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION: |
207 | return getCallParameterDeviation(); |
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 ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE: |
221 | setParameterInstance((ParameterInstance)newValue); |
222 | return; |
223 | case ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION: |
224 | setCallParameterDeviation((CallParameterDeviation)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 ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE: |
239 | setParameterInstance((ParameterInstance)null); |
240 | return; |
241 | case ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION: |
242 | setCallParameterDeviation((CallParameterDeviation)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 ParametersPackage.PARAMETER_REFERENCE__PARAMETER_INSTANCE: |
257 | return getParameterInstance() != null; |
258 | case ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION: |
259 | return getCallParameterDeviation() != null; |
260 | } |
261 | return super.eIsSet(featureID); |
262 | } |
263 | |
264 | } //ParameterReferenceImpl |