1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.computed_allocation.impl; |
7 | |
8 | import java.util.Collection; |
9 | |
10 | import org.eclipse.emf.common.notify.Notification; |
11 | import org.eclipse.emf.common.notify.NotificationChain; |
12 | import org.eclipse.emf.common.util.EList; |
13 | import org.eclipse.emf.ecore.EClass; |
14 | import org.eclipse.emf.ecore.InternalEObject; |
15 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
16 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
17 | import org.eclipse.emf.ecore.util.InternalEList; |
18 | |
19 | import de.uka.ipd.sdq.context.computed_allocation.ComputedAllocationContext; |
20 | import de.uka.ipd.sdq.context.computed_allocation.ComputedAllocationPackage; |
21 | import de.uka.ipd.sdq.context.computed_allocation.ResourceDemand; |
22 | import de.uka.ipd.sdq.context.computed_usage.ComputedUsageContext; |
23 | import de.uka.ipd.sdq.pcm.allocation.AllocationContext; |
24 | import de.uka.ipd.sdq.pcm.core.entity.impl.EntityImpl; |
25 | |
26 | /** |
27 | * <!-- begin-user-doc --> |
28 | * An implementation of the model object '<em><b>Context</b></em>'. |
29 | * <!-- end-user-doc --> |
30 | * <p> |
31 | * The following features are implemented: |
32 | * <ul> |
33 | * <li>{@link de.uka.ipd.sdq.context.computed_allocation.impl.ComputedAllocationContextImpl#getResourceDemands_ComputedAllocationContext <em>Resource Demands Computed Allocation Context</em>}</li> |
34 | * <li>{@link de.uka.ipd.sdq.context.computed_allocation.impl.ComputedAllocationContextImpl#getUsageContext_ComputedAllocationContext <em>Usage Context Computed Allocation Context</em>}</li> |
35 | * <li>{@link de.uka.ipd.sdq.context.computed_allocation.impl.ComputedAllocationContextImpl#getAllocationContext_ComputedAllocationContext <em>Allocation Context Computed Allocation Context</em>}</li> |
36 | * </ul> |
37 | * </p> |
38 | * |
39 | * @generated |
40 | */ |
41 | public class ComputedAllocationContextImpl extends EntityImpl implements ComputedAllocationContext { |
42 | /** |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @generated |
46 | */ |
47 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
48 | |
49 | /** |
50 | * The cached value of the '{@link #getResourceDemands_ComputedAllocationContext() <em>Resource Demands Computed Allocation Context</em>}' containment reference list. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @see #getResourceDemands_ComputedAllocationContext() |
54 | * @generated |
55 | * @ordered |
56 | */ |
57 | protected EList<ResourceDemand> resourceDemands_ComputedAllocationContext; |
58 | |
59 | /** |
60 | * The cached value of the '{@link #getUsageContext_ComputedAllocationContext() <em>Usage Context Computed Allocation Context</em>}' reference. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @see #getUsageContext_ComputedAllocationContext() |
64 | * @generated |
65 | * @ordered |
66 | */ |
67 | protected ComputedUsageContext usageContext_ComputedAllocationContext; |
68 | |
69 | /** |
70 | * The cached value of the '{@link #getAllocationContext_ComputedAllocationContext() <em>Allocation Context Computed Allocation Context</em>}' reference. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @see #getAllocationContext_ComputedAllocationContext() |
74 | * @generated |
75 | * @ordered |
76 | */ |
77 | protected AllocationContext allocationContext_ComputedAllocationContext; |
78 | |
79 | /** |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | protected ComputedAllocationContextImpl() { |
85 | super(); |
86 | } |
87 | |
88 | /** |
89 | * <!-- begin-user-doc --> |
90 | * <!-- end-user-doc --> |
91 | * @generated |
92 | */ |
93 | @Override |
94 | protected EClass eStaticClass() { |
95 | return ComputedAllocationPackage.Literals.COMPUTED_ALLOCATION_CONTEXT; |
96 | } |
97 | |
98 | /** |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | public EList<ResourceDemand> getResourceDemands_ComputedAllocationContext() { |
104 | if (resourceDemands_ComputedAllocationContext == null) { |
105 | resourceDemands_ComputedAllocationContext = new EObjectContainmentEList<ResourceDemand>(ResourceDemand.class, this, ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__RESOURCE_DEMANDS_COMPUTED_ALLOCATION_CONTEXT); |
106 | } |
107 | return resourceDemands_ComputedAllocationContext; |
108 | } |
109 | |
110 | /** |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | public ComputedUsageContext getUsageContext_ComputedAllocationContext() { |
116 | if (usageContext_ComputedAllocationContext != null && usageContext_ComputedAllocationContext.eIsProxy()) { |
117 | InternalEObject oldUsageContext_ComputedAllocationContext = (InternalEObject)usageContext_ComputedAllocationContext; |
118 | usageContext_ComputedAllocationContext = (ComputedUsageContext)eResolveProxy(oldUsageContext_ComputedAllocationContext); |
119 | if (usageContext_ComputedAllocationContext != oldUsageContext_ComputedAllocationContext) { |
120 | if (eNotificationRequired()) |
121 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__USAGE_CONTEXT_COMPUTED_ALLOCATION_CONTEXT, oldUsageContext_ComputedAllocationContext, usageContext_ComputedAllocationContext)); |
122 | } |
123 | } |
124 | return usageContext_ComputedAllocationContext; |
125 | } |
126 | |
127 | /** |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | public ComputedUsageContext basicGetUsageContext_ComputedAllocationContext() { |
133 | return usageContext_ComputedAllocationContext; |
134 | } |
135 | |
136 | /** |
137 | * <!-- begin-user-doc --> |
138 | * <!-- end-user-doc --> |
139 | * @generated |
140 | */ |
141 | public void setUsageContext_ComputedAllocationContext(ComputedUsageContext newUsageContext_ComputedAllocationContext) { |
142 | ComputedUsageContext oldUsageContext_ComputedAllocationContext = usageContext_ComputedAllocationContext; |
143 | usageContext_ComputedAllocationContext = newUsageContext_ComputedAllocationContext; |
144 | if (eNotificationRequired()) |
145 | eNotify(new ENotificationImpl(this, Notification.SET, ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__USAGE_CONTEXT_COMPUTED_ALLOCATION_CONTEXT, oldUsageContext_ComputedAllocationContext, usageContext_ComputedAllocationContext)); |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | public AllocationContext getAllocationContext_ComputedAllocationContext() { |
154 | if (allocationContext_ComputedAllocationContext != null && allocationContext_ComputedAllocationContext.eIsProxy()) { |
155 | InternalEObject oldAllocationContext_ComputedAllocationContext = (InternalEObject)allocationContext_ComputedAllocationContext; |
156 | allocationContext_ComputedAllocationContext = (AllocationContext)eResolveProxy(oldAllocationContext_ComputedAllocationContext); |
157 | if (allocationContext_ComputedAllocationContext != oldAllocationContext_ComputedAllocationContext) { |
158 | if (eNotificationRequired()) |
159 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__ALLOCATION_CONTEXT_COMPUTED_ALLOCATION_CONTEXT, oldAllocationContext_ComputedAllocationContext, allocationContext_ComputedAllocationContext)); |
160 | } |
161 | } |
162 | return allocationContext_ComputedAllocationContext; |
163 | } |
164 | |
165 | /** |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | public AllocationContext basicGetAllocationContext_ComputedAllocationContext() { |
171 | return allocationContext_ComputedAllocationContext; |
172 | } |
173 | |
174 | /** |
175 | * <!-- begin-user-doc --> |
176 | * <!-- end-user-doc --> |
177 | * @generated |
178 | */ |
179 | public void setAllocationContext_ComputedAllocationContext(AllocationContext newAllocationContext_ComputedAllocationContext) { |
180 | AllocationContext oldAllocationContext_ComputedAllocationContext = allocationContext_ComputedAllocationContext; |
181 | allocationContext_ComputedAllocationContext = newAllocationContext_ComputedAllocationContext; |
182 | if (eNotificationRequired()) |
183 | eNotify(new ENotificationImpl(this, Notification.SET, ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__ALLOCATION_CONTEXT_COMPUTED_ALLOCATION_CONTEXT, oldAllocationContext_ComputedAllocationContext, allocationContext_ComputedAllocationContext)); |
184 | } |
185 | |
186 | /** |
187 | * <!-- begin-user-doc --> |
188 | * <!-- end-user-doc --> |
189 | * @generated |
190 | */ |
191 | @Override |
192 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
193 | switch (featureID) { |
194 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__RESOURCE_DEMANDS_COMPUTED_ALLOCATION_CONTEXT: |
195 | return ((InternalEList<?>)getResourceDemands_ComputedAllocationContext()).basicRemove(otherEnd, msgs); |
196 | } |
197 | return super.eInverseRemove(otherEnd, featureID, msgs); |
198 | } |
199 | |
200 | /** |
201 | * <!-- begin-user-doc --> |
202 | * <!-- end-user-doc --> |
203 | * @generated |
204 | */ |
205 | @Override |
206 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
207 | switch (featureID) { |
208 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__RESOURCE_DEMANDS_COMPUTED_ALLOCATION_CONTEXT: |
209 | return getResourceDemands_ComputedAllocationContext(); |
210 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__USAGE_CONTEXT_COMPUTED_ALLOCATION_CONTEXT: |
211 | if (resolve) return getUsageContext_ComputedAllocationContext(); |
212 | return basicGetUsageContext_ComputedAllocationContext(); |
213 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__ALLOCATION_CONTEXT_COMPUTED_ALLOCATION_CONTEXT: |
214 | if (resolve) return getAllocationContext_ComputedAllocationContext(); |
215 | return basicGetAllocationContext_ComputedAllocationContext(); |
216 | } |
217 | return super.eGet(featureID, resolve, coreType); |
218 | } |
219 | |
220 | /** |
221 | * <!-- begin-user-doc --> |
222 | * <!-- end-user-doc --> |
223 | * @generated |
224 | */ |
225 | @SuppressWarnings("unchecked") |
226 | @Override |
227 | public void eSet(int featureID, Object newValue) { |
228 | switch (featureID) { |
229 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__RESOURCE_DEMANDS_COMPUTED_ALLOCATION_CONTEXT: |
230 | getResourceDemands_ComputedAllocationContext().clear(); |
231 | getResourceDemands_ComputedAllocationContext().addAll((Collection<? extends ResourceDemand>)newValue); |
232 | return; |
233 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__USAGE_CONTEXT_COMPUTED_ALLOCATION_CONTEXT: |
234 | setUsageContext_ComputedAllocationContext((ComputedUsageContext)newValue); |
235 | return; |
236 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__ALLOCATION_CONTEXT_COMPUTED_ALLOCATION_CONTEXT: |
237 | setAllocationContext_ComputedAllocationContext((AllocationContext)newValue); |
238 | return; |
239 | } |
240 | super.eSet(featureID, newValue); |
241 | } |
242 | |
243 | /** |
244 | * <!-- begin-user-doc --> |
245 | * <!-- end-user-doc --> |
246 | * @generated |
247 | */ |
248 | @Override |
249 | public void eUnset(int featureID) { |
250 | switch (featureID) { |
251 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__RESOURCE_DEMANDS_COMPUTED_ALLOCATION_CONTEXT: |
252 | getResourceDemands_ComputedAllocationContext().clear(); |
253 | return; |
254 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__USAGE_CONTEXT_COMPUTED_ALLOCATION_CONTEXT: |
255 | setUsageContext_ComputedAllocationContext((ComputedUsageContext)null); |
256 | return; |
257 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__ALLOCATION_CONTEXT_COMPUTED_ALLOCATION_CONTEXT: |
258 | setAllocationContext_ComputedAllocationContext((AllocationContext)null); |
259 | return; |
260 | } |
261 | super.eUnset(featureID); |
262 | } |
263 | |
264 | /** |
265 | * <!-- begin-user-doc --> |
266 | * <!-- end-user-doc --> |
267 | * @generated |
268 | */ |
269 | @Override |
270 | public boolean eIsSet(int featureID) { |
271 | switch (featureID) { |
272 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__RESOURCE_DEMANDS_COMPUTED_ALLOCATION_CONTEXT: |
273 | return resourceDemands_ComputedAllocationContext != null && !resourceDemands_ComputedAllocationContext.isEmpty(); |
274 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__USAGE_CONTEXT_COMPUTED_ALLOCATION_CONTEXT: |
275 | return usageContext_ComputedAllocationContext != null; |
276 | case ComputedAllocationPackage.COMPUTED_ALLOCATION_CONTEXT__ALLOCATION_CONTEXT_COMPUTED_ALLOCATION_CONTEXT: |
277 | return allocationContext_ComputedAllocationContext != null; |
278 | } |
279 | return super.eIsSet(featureID); |
280 | } |
281 | |
282 | } //ComputedAllocationContextImpl |