1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.sensitivity.impl; |
8 | |
9 | import de.uka.ipd.sdq.pcm.usagemodel.Branch; |
10 | import de.uka.ipd.sdq.pcm.usagemodel.ScenarioBehaviour; |
11 | |
12 | import de.uka.ipd.sdq.sensitivity.SensitivityPackage; |
13 | import de.uka.ipd.sdq.sensitivity.UsageBranchParameter; |
14 | |
15 | import de.uka.ipd.sdq.sensitivity.util.SensitivityValidator; |
16 | |
17 | import java.util.Map; |
18 | |
19 | import org.eclipse.emf.common.notify.Notification; |
20 | |
21 | import org.eclipse.emf.common.util.BasicDiagnostic; |
22 | import org.eclipse.emf.common.util.Diagnostic; |
23 | import org.eclipse.emf.common.util.DiagnosticChain; |
24 | |
25 | import org.eclipse.emf.ecore.EClass; |
26 | import org.eclipse.emf.ecore.InternalEObject; |
27 | |
28 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
29 | |
30 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
31 | |
32 | import org.eclipse.emf.ecore.util.EObjectValidator; |
33 | |
34 | /** |
35 | * <!-- begin-user-doc --> |
36 | * An implementation of the model object '<em><b>Usage Branch Parameter</b></em>'. |
37 | * <!-- end-user-doc --> |
38 | * <p> |
39 | * The following features are implemented: |
40 | * <ul> |
41 | * <li>{@link de.uka.ipd.sdq.sensitivity.impl.UsageBranchParameterImpl#getBranch__UsageBranchParameter <em>Branch Usage Branch Parameter</em>}</li> |
42 | * <li>{@link de.uka.ipd.sdq.sensitivity.impl.UsageBranchParameterImpl#getScenarioBehaviour__UsageBranchParameter <em>Scenario Behaviour Usage Branch Parameter</em>}</li> |
43 | * </ul> |
44 | * </p> |
45 | * |
46 | * @generated |
47 | */ |
48 | public class UsageBranchParameterImpl extends SingleSensitivityParameterImpl implements UsageBranchParameter { |
49 | /** |
50 | * The cached value of the '{@link #getBranch__UsageBranchParameter() <em>Branch Usage Branch Parameter</em>}' reference. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @see #getBranch__UsageBranchParameter() |
54 | * @generated |
55 | * @ordered |
56 | */ |
57 | protected Branch branch__UsageBranchParameter; |
58 | |
59 | /** |
60 | * The cached value of the '{@link #getScenarioBehaviour__UsageBranchParameter() <em>Scenario Behaviour Usage Branch Parameter</em>}' reference. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @see #getScenarioBehaviour__UsageBranchParameter() |
64 | * @generated |
65 | * @ordered |
66 | */ |
67 | protected ScenarioBehaviour scenarioBehaviour__UsageBranchParameter; |
68 | |
69 | /** |
70 | * <!-- begin-user-doc --> |
71 | * <!-- end-user-doc --> |
72 | * @generated |
73 | */ |
74 | protected UsageBranchParameterImpl() { |
75 | super(); |
76 | } |
77 | |
78 | /** |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | @Override |
84 | protected EClass eStaticClass() { |
85 | return SensitivityPackage.Literals.USAGE_BRANCH_PARAMETER; |
86 | } |
87 | |
88 | /** |
89 | * <!-- begin-user-doc --> |
90 | * <!-- end-user-doc --> |
91 | * @generated |
92 | */ |
93 | public Branch getBranch__UsageBranchParameter() { |
94 | if (branch__UsageBranchParameter != null && branch__UsageBranchParameter.eIsProxy()) { |
95 | InternalEObject oldBranch__UsageBranchParameter = (InternalEObject)branch__UsageBranchParameter; |
96 | branch__UsageBranchParameter = (Branch)eResolveProxy(oldBranch__UsageBranchParameter); |
97 | if (branch__UsageBranchParameter != oldBranch__UsageBranchParameter) { |
98 | if (eNotificationRequired()) |
99 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, SensitivityPackage.USAGE_BRANCH_PARAMETER__BRANCH_USAGE_BRANCH_PARAMETER, oldBranch__UsageBranchParameter, branch__UsageBranchParameter)); |
100 | } |
101 | } |
102 | return branch__UsageBranchParameter; |
103 | } |
104 | |
105 | /** |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | public Branch basicGetBranch__UsageBranchParameter() { |
111 | return branch__UsageBranchParameter; |
112 | } |
113 | |
114 | /** |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | public void setBranch__UsageBranchParameter(Branch newBranch__UsageBranchParameter) { |
120 | Branch oldBranch__UsageBranchParameter = branch__UsageBranchParameter; |
121 | branch__UsageBranchParameter = newBranch__UsageBranchParameter; |
122 | if (eNotificationRequired()) |
123 | eNotify(new ENotificationImpl(this, Notification.SET, SensitivityPackage.USAGE_BRANCH_PARAMETER__BRANCH_USAGE_BRANCH_PARAMETER, oldBranch__UsageBranchParameter, branch__UsageBranchParameter)); |
124 | } |
125 | |
126 | /** |
127 | * <!-- begin-user-doc --> |
128 | * <!-- end-user-doc --> |
129 | * @generated |
130 | */ |
131 | public ScenarioBehaviour getScenarioBehaviour__UsageBranchParameter() { |
132 | if (scenarioBehaviour__UsageBranchParameter != null && scenarioBehaviour__UsageBranchParameter.eIsProxy()) { |
133 | InternalEObject oldScenarioBehaviour__UsageBranchParameter = (InternalEObject)scenarioBehaviour__UsageBranchParameter; |
134 | scenarioBehaviour__UsageBranchParameter = (ScenarioBehaviour)eResolveProxy(oldScenarioBehaviour__UsageBranchParameter); |
135 | if (scenarioBehaviour__UsageBranchParameter != oldScenarioBehaviour__UsageBranchParameter) { |
136 | if (eNotificationRequired()) |
137 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, SensitivityPackage.USAGE_BRANCH_PARAMETER__SCENARIO_BEHAVIOUR_USAGE_BRANCH_PARAMETER, oldScenarioBehaviour__UsageBranchParameter, scenarioBehaviour__UsageBranchParameter)); |
138 | } |
139 | } |
140 | return scenarioBehaviour__UsageBranchParameter; |
141 | } |
142 | |
143 | /** |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | public ScenarioBehaviour basicGetScenarioBehaviour__UsageBranchParameter() { |
149 | return scenarioBehaviour__UsageBranchParameter; |
150 | } |
151 | |
152 | /** |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | public void setScenarioBehaviour__UsageBranchParameter(ScenarioBehaviour newScenarioBehaviour__UsageBranchParameter) { |
158 | ScenarioBehaviour oldScenarioBehaviour__UsageBranchParameter = scenarioBehaviour__UsageBranchParameter; |
159 | scenarioBehaviour__UsageBranchParameter = newScenarioBehaviour__UsageBranchParameter; |
160 | if (eNotificationRequired()) |
161 | eNotify(new ENotificationImpl(this, Notification.SET, SensitivityPackage.USAGE_BRANCH_PARAMETER__SCENARIO_BEHAVIOUR_USAGE_BRANCH_PARAMETER, oldScenarioBehaviour__UsageBranchParameter, scenarioBehaviour__UsageBranchParameter)); |
162 | } |
163 | |
164 | /** |
165 | * <!-- begin-user-doc --> |
166 | * <!-- end-user-doc --> |
167 | * @generated |
168 | */ |
169 | public boolean UsageBranchParameterMustHaveDoubleVariation(DiagnosticChain diagnostics, Map<Object, Object> context) { |
170 | // TODO: implement this method |
171 | // -> specify the condition that violates the invariant |
172 | // -> verify the details of the diagnostic, including severity and message |
173 | // Ensure that you remove @generated or mark it @generated NOT |
174 | if (false) { |
175 | if (diagnostics != null) { |
176 | diagnostics.add |
177 | (new BasicDiagnostic |
178 | (Diagnostic.ERROR, |
179 | SensitivityValidator.DIAGNOSTIC_SOURCE, |
180 | SensitivityValidator.USAGE_BRANCH_PARAMETER__USAGE_BRANCH_PARAMETER_MUST_HAVE_DOUBLE_VARIATION, |
181 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "UsageBranchParameterMustHaveDoubleVariation", EObjectValidator.getObjectLabel(this, context) }), |
182 | new Object [] { this })); |
183 | } |
184 | return false; |
185 | } |
186 | return true; |
187 | } |
188 | |
189 | /** |
190 | * <!-- begin-user-doc --> |
191 | * <!-- end-user-doc --> |
192 | * @generated |
193 | */ |
194 | @Override |
195 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
196 | switch (featureID) { |
197 | case SensitivityPackage.USAGE_BRANCH_PARAMETER__BRANCH_USAGE_BRANCH_PARAMETER: |
198 | if (resolve) return getBranch__UsageBranchParameter(); |
199 | return basicGetBranch__UsageBranchParameter(); |
200 | case SensitivityPackage.USAGE_BRANCH_PARAMETER__SCENARIO_BEHAVIOUR_USAGE_BRANCH_PARAMETER: |
201 | if (resolve) return getScenarioBehaviour__UsageBranchParameter(); |
202 | return basicGetScenarioBehaviour__UsageBranchParameter(); |
203 | } |
204 | return super.eGet(featureID, resolve, coreType); |
205 | } |
206 | |
207 | /** |
208 | * <!-- begin-user-doc --> |
209 | * <!-- end-user-doc --> |
210 | * @generated |
211 | */ |
212 | @Override |
213 | public void eSet(int featureID, Object newValue) { |
214 | switch (featureID) { |
215 | case SensitivityPackage.USAGE_BRANCH_PARAMETER__BRANCH_USAGE_BRANCH_PARAMETER: |
216 | setBranch__UsageBranchParameter((Branch)newValue); |
217 | return; |
218 | case SensitivityPackage.USAGE_BRANCH_PARAMETER__SCENARIO_BEHAVIOUR_USAGE_BRANCH_PARAMETER: |
219 | setScenarioBehaviour__UsageBranchParameter((ScenarioBehaviour)newValue); |
220 | return; |
221 | } |
222 | super.eSet(featureID, newValue); |
223 | } |
224 | |
225 | /** |
226 | * <!-- begin-user-doc --> |
227 | * <!-- end-user-doc --> |
228 | * @generated |
229 | */ |
230 | @Override |
231 | public void eUnset(int featureID) { |
232 | switch (featureID) { |
233 | case SensitivityPackage.USAGE_BRANCH_PARAMETER__BRANCH_USAGE_BRANCH_PARAMETER: |
234 | setBranch__UsageBranchParameter((Branch)null); |
235 | return; |
236 | case SensitivityPackage.USAGE_BRANCH_PARAMETER__SCENARIO_BEHAVIOUR_USAGE_BRANCH_PARAMETER: |
237 | setScenarioBehaviour__UsageBranchParameter((ScenarioBehaviour)null); |
238 | return; |
239 | } |
240 | super.eUnset(featureID); |
241 | } |
242 | |
243 | /** |
244 | * <!-- begin-user-doc --> |
245 | * <!-- end-user-doc --> |
246 | * @generated |
247 | */ |
248 | @Override |
249 | public boolean eIsSet(int featureID) { |
250 | switch (featureID) { |
251 | case SensitivityPackage.USAGE_BRANCH_PARAMETER__BRANCH_USAGE_BRANCH_PARAMETER: |
252 | return branch__UsageBranchParameter != null; |
253 | case SensitivityPackage.USAGE_BRANCH_PARAMETER__SCENARIO_BEHAVIOUR_USAGE_BRANCH_PARAMETER: |
254 | return scenarioBehaviour__UsageBranchParameter != null; |
255 | } |
256 | return super.eIsSet(featureID); |
257 | } |
258 | |
259 | } //UsageBranchParameterImpl |