1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.resourcerepository.impl; |
8 | |
9 | import de.uka.ipd.sdq.pcm.cost.FixedProcessingResourceCost; |
10 | |
11 | import de.uka.ipd.sdq.pcm.resourceenvironment.ProcessingResourceSpecification; |
12 | |
13 | import de.uka.ipd.sdq.pcm.resourcerepository.ResourceDescription; |
14 | import de.uka.ipd.sdq.pcm.resourcerepository.resourcerepositoryPackage; |
15 | |
16 | import de.uka.ipd.sdq.pcm.resourcerepository.util.resourcerepositoryValidator; |
17 | |
18 | import java.util.Map; |
19 | |
20 | import org.eclipse.emf.common.notify.Notification; |
21 | import org.eclipse.emf.common.notify.NotificationChain; |
22 | |
23 | import org.eclipse.emf.common.util.BasicDiagnostic; |
24 | import org.eclipse.emf.common.util.Diagnostic; |
25 | import org.eclipse.emf.common.util.DiagnosticChain; |
26 | |
27 | import org.eclipse.emf.ecore.EClass; |
28 | import org.eclipse.emf.ecore.InternalEObject; |
29 | |
30 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
31 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
32 | |
33 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
34 | |
35 | import org.eclipse.emf.ecore.util.EObjectValidator; |
36 | |
37 | /** |
38 | * <!-- begin-user-doc --> |
39 | * An implementation of the model object '<em><b>Resource Description</b></em>'. |
40 | * <!-- end-user-doc --> |
41 | * <p> |
42 | * The following features are implemented: |
43 | * <ul> |
44 | * <li>{@link de.uka.ipd.sdq.pcm.resourcerepository.impl.ResourceDescriptionImpl#getFixedProcessingResourceCost_ResourceDescription <em>Fixed Processing Resource Cost Resource Description</em>}</li> |
45 | * <li>{@link de.uka.ipd.sdq.pcm.resourcerepository.impl.ResourceDescriptionImpl#getProcessingResourceSpecification_ResourceDescription <em>Processing Resource Specification Resource Description</em>}</li> |
46 | * </ul> |
47 | * </p> |
48 | * |
49 | * @generated |
50 | */ |
51 | public class ResourceDescriptionImpl extends EObjectImpl implements ResourceDescription { |
52 | /** |
53 | * The cached value of the '{@link #getFixedProcessingResourceCost_ResourceDescription() <em>Fixed Processing Resource Cost Resource Description</em>}' containment reference. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @see #getFixedProcessingResourceCost_ResourceDescription() |
57 | * @generated |
58 | * @ordered |
59 | */ |
60 | protected FixedProcessingResourceCost fixedProcessingResourceCost_ResourceDescription; |
61 | |
62 | /** |
63 | * The cached value of the '{@link #getProcessingResourceSpecification_ResourceDescription() <em>Processing Resource Specification Resource Description</em>}' containment reference. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @see #getProcessingResourceSpecification_ResourceDescription() |
67 | * @generated |
68 | * @ordered |
69 | */ |
70 | protected ProcessingResourceSpecification processingResourceSpecification_ResourceDescription; |
71 | |
72 | /** |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | protected ResourceDescriptionImpl() { |
78 | super(); |
79 | } |
80 | |
81 | /** |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | @Override |
87 | protected EClass eStaticClass() { |
88 | return resourcerepositoryPackage.Literals.RESOURCE_DESCRIPTION; |
89 | } |
90 | |
91 | /** |
92 | * <!-- begin-user-doc --> |
93 | * <!-- end-user-doc --> |
94 | * @generated |
95 | */ |
96 | public FixedProcessingResourceCost getFixedProcessingResourceCost_ResourceDescription() { |
97 | return fixedProcessingResourceCost_ResourceDescription; |
98 | } |
99 | |
100 | /** |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | public NotificationChain basicSetFixedProcessingResourceCost_ResourceDescription(FixedProcessingResourceCost newFixedProcessingResourceCost_ResourceDescription, NotificationChain msgs) { |
106 | FixedProcessingResourceCost oldFixedProcessingResourceCost_ResourceDescription = fixedProcessingResourceCost_ResourceDescription; |
107 | fixedProcessingResourceCost_ResourceDescription = newFixedProcessingResourceCost_ResourceDescription; |
108 | if (eNotificationRequired()) { |
109 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, resourcerepositoryPackage.RESOURCE_DESCRIPTION__FIXED_PROCESSING_RESOURCE_COST_RESOURCE_DESCRIPTION, oldFixedProcessingResourceCost_ResourceDescription, newFixedProcessingResourceCost_ResourceDescription); |
110 | if (msgs == null) msgs = notification; else msgs.add(notification); |
111 | } |
112 | return msgs; |
113 | } |
114 | |
115 | /** |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | public void setFixedProcessingResourceCost_ResourceDescription(FixedProcessingResourceCost newFixedProcessingResourceCost_ResourceDescription) { |
121 | if (newFixedProcessingResourceCost_ResourceDescription != fixedProcessingResourceCost_ResourceDescription) { |
122 | NotificationChain msgs = null; |
123 | if (fixedProcessingResourceCost_ResourceDescription != null) |
124 | msgs = ((InternalEObject)fixedProcessingResourceCost_ResourceDescription).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - resourcerepositoryPackage.RESOURCE_DESCRIPTION__FIXED_PROCESSING_RESOURCE_COST_RESOURCE_DESCRIPTION, null, msgs); |
125 | if (newFixedProcessingResourceCost_ResourceDescription != null) |
126 | msgs = ((InternalEObject)newFixedProcessingResourceCost_ResourceDescription).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - resourcerepositoryPackage.RESOURCE_DESCRIPTION__FIXED_PROCESSING_RESOURCE_COST_RESOURCE_DESCRIPTION, null, msgs); |
127 | msgs = basicSetFixedProcessingResourceCost_ResourceDescription(newFixedProcessingResourceCost_ResourceDescription, msgs); |
128 | if (msgs != null) msgs.dispatch(); |
129 | } |
130 | else if (eNotificationRequired()) |
131 | eNotify(new ENotificationImpl(this, Notification.SET, resourcerepositoryPackage.RESOURCE_DESCRIPTION__FIXED_PROCESSING_RESOURCE_COST_RESOURCE_DESCRIPTION, newFixedProcessingResourceCost_ResourceDescription, newFixedProcessingResourceCost_ResourceDescription)); |
132 | } |
133 | |
134 | /** |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | public ProcessingResourceSpecification getProcessingResourceSpecification_ResourceDescription() { |
140 | return processingResourceSpecification_ResourceDescription; |
141 | } |
142 | |
143 | /** |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | public NotificationChain basicSetProcessingResourceSpecification_ResourceDescription(ProcessingResourceSpecification newProcessingResourceSpecification_ResourceDescription, NotificationChain msgs) { |
149 | ProcessingResourceSpecification oldProcessingResourceSpecification_ResourceDescription = processingResourceSpecification_ResourceDescription; |
150 | processingResourceSpecification_ResourceDescription = newProcessingResourceSpecification_ResourceDescription; |
151 | if (eNotificationRequired()) { |
152 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, resourcerepositoryPackage.RESOURCE_DESCRIPTION__PROCESSING_RESOURCE_SPECIFICATION_RESOURCE_DESCRIPTION, oldProcessingResourceSpecification_ResourceDescription, newProcessingResourceSpecification_ResourceDescription); |
153 | if (msgs == null) msgs = notification; else msgs.add(notification); |
154 | } |
155 | return msgs; |
156 | } |
157 | |
158 | /** |
159 | * <!-- begin-user-doc --> |
160 | * <!-- end-user-doc --> |
161 | * @generated |
162 | */ |
163 | public void setProcessingResourceSpecification_ResourceDescription(ProcessingResourceSpecification newProcessingResourceSpecification_ResourceDescription) { |
164 | if (newProcessingResourceSpecification_ResourceDescription != processingResourceSpecification_ResourceDescription) { |
165 | NotificationChain msgs = null; |
166 | if (processingResourceSpecification_ResourceDescription != null) |
167 | msgs = ((InternalEObject)processingResourceSpecification_ResourceDescription).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - resourcerepositoryPackage.RESOURCE_DESCRIPTION__PROCESSING_RESOURCE_SPECIFICATION_RESOURCE_DESCRIPTION, null, msgs); |
168 | if (newProcessingResourceSpecification_ResourceDescription != null) |
169 | msgs = ((InternalEObject)newProcessingResourceSpecification_ResourceDescription).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - resourcerepositoryPackage.RESOURCE_DESCRIPTION__PROCESSING_RESOURCE_SPECIFICATION_RESOURCE_DESCRIPTION, null, msgs); |
170 | msgs = basicSetProcessingResourceSpecification_ResourceDescription(newProcessingResourceSpecification_ResourceDescription, msgs); |
171 | if (msgs != null) msgs.dispatch(); |
172 | } |
173 | else if (eNotificationRequired()) |
174 | eNotify(new ENotificationImpl(this, Notification.SET, resourcerepositoryPackage.RESOURCE_DESCRIPTION__PROCESSING_RESOURCE_SPECIFICATION_RESOURCE_DESCRIPTION, newProcessingResourceSpecification_ResourceDescription, newProcessingResourceSpecification_ResourceDescription)); |
175 | } |
176 | |
177 | /** |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | public boolean CostAndResourceMustMatch(DiagnosticChain diagnostics, Map<Object, Object> context) { |
183 | // TODO: implement this method |
184 | // -> specify the condition that violates the invariant |
185 | // -> verify the details of the diagnostic, including severity and message |
186 | // Ensure that you remove @generated or mark it @generated NOT |
187 | if (false) { |
188 | if (diagnostics != null) { |
189 | diagnostics.add |
190 | (new BasicDiagnostic |
191 | (Diagnostic.ERROR, |
192 | resourcerepositoryValidator.DIAGNOSTIC_SOURCE, |
193 | resourcerepositoryValidator.RESOURCE_DESCRIPTION__COST_AND_RESOURCE_MUST_MATCH, |
194 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "CostAndResourceMustMatch", EObjectValidator.getObjectLabel(this, context) }), |
195 | new Object [] { this })); |
196 | } |
197 | return false; |
198 | } |
199 | return true; |
200 | } |
201 | |
202 | /** |
203 | * <!-- begin-user-doc --> |
204 | * <!-- end-user-doc --> |
205 | * @generated |
206 | */ |
207 | @Override |
208 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
209 | switch (featureID) { |
210 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION__FIXED_PROCESSING_RESOURCE_COST_RESOURCE_DESCRIPTION: |
211 | return basicSetFixedProcessingResourceCost_ResourceDescription(null, msgs); |
212 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION__PROCESSING_RESOURCE_SPECIFICATION_RESOURCE_DESCRIPTION: |
213 | return basicSetProcessingResourceSpecification_ResourceDescription(null, msgs); |
214 | } |
215 | return super.eInverseRemove(otherEnd, featureID, msgs); |
216 | } |
217 | |
218 | /** |
219 | * <!-- begin-user-doc --> |
220 | * <!-- end-user-doc --> |
221 | * @generated |
222 | */ |
223 | @Override |
224 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
225 | switch (featureID) { |
226 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION__FIXED_PROCESSING_RESOURCE_COST_RESOURCE_DESCRIPTION: |
227 | return getFixedProcessingResourceCost_ResourceDescription(); |
228 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION__PROCESSING_RESOURCE_SPECIFICATION_RESOURCE_DESCRIPTION: |
229 | return getProcessingResourceSpecification_ResourceDescription(); |
230 | } |
231 | return super.eGet(featureID, resolve, coreType); |
232 | } |
233 | |
234 | /** |
235 | * <!-- begin-user-doc --> |
236 | * <!-- end-user-doc --> |
237 | * @generated |
238 | */ |
239 | @Override |
240 | public void eSet(int featureID, Object newValue) { |
241 | switch (featureID) { |
242 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION__FIXED_PROCESSING_RESOURCE_COST_RESOURCE_DESCRIPTION: |
243 | setFixedProcessingResourceCost_ResourceDescription((FixedProcessingResourceCost)newValue); |
244 | return; |
245 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION__PROCESSING_RESOURCE_SPECIFICATION_RESOURCE_DESCRIPTION: |
246 | setProcessingResourceSpecification_ResourceDescription((ProcessingResourceSpecification)newValue); |
247 | return; |
248 | } |
249 | super.eSet(featureID, newValue); |
250 | } |
251 | |
252 | /** |
253 | * <!-- begin-user-doc --> |
254 | * <!-- end-user-doc --> |
255 | * @generated |
256 | */ |
257 | @Override |
258 | public void eUnset(int featureID) { |
259 | switch (featureID) { |
260 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION__FIXED_PROCESSING_RESOURCE_COST_RESOURCE_DESCRIPTION: |
261 | setFixedProcessingResourceCost_ResourceDescription((FixedProcessingResourceCost)null); |
262 | return; |
263 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION__PROCESSING_RESOURCE_SPECIFICATION_RESOURCE_DESCRIPTION: |
264 | setProcessingResourceSpecification_ResourceDescription((ProcessingResourceSpecification)null); |
265 | return; |
266 | } |
267 | super.eUnset(featureID); |
268 | } |
269 | |
270 | /** |
271 | * <!-- begin-user-doc --> |
272 | * <!-- end-user-doc --> |
273 | * @generated |
274 | */ |
275 | @Override |
276 | public boolean eIsSet(int featureID) { |
277 | switch (featureID) { |
278 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION__FIXED_PROCESSING_RESOURCE_COST_RESOURCE_DESCRIPTION: |
279 | return fixedProcessingResourceCost_ResourceDescription != null; |
280 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION__PROCESSING_RESOURCE_SPECIFICATION_RESOURCE_DESCRIPTION: |
281 | return processingResourceSpecification_ResourceDescription != null; |
282 | } |
283 | return super.eIsSet(featureID); |
284 | } |
285 | |
286 | } //ResourceDescriptionImpl |