1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.designdecision.impl; |
8 | |
9 | import de.uka.ipd.sdq.pcm.designdecision.DiscreteProcessingRateDegree; |
10 | import de.uka.ipd.sdq.pcm.designdecision.ProcessingRateDegree; |
11 | import de.uka.ipd.sdq.pcm.designdecision.ProcessingResourceDegree; |
12 | import de.uka.ipd.sdq.pcm.designdecision.designdecisionPackage; |
13 | |
14 | import de.uka.ipd.sdq.pcm.resourcetype.ProcessingResourceType; |
15 | |
16 | import org.eclipse.emf.common.notify.Notification; |
17 | |
18 | import org.eclipse.emf.ecore.EClass; |
19 | import org.eclipse.emf.ecore.InternalEObject; |
20 | |
21 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
22 | |
23 | /** |
24 | * <!-- begin-user-doc --> |
25 | * An implementation of the model object '<em><b>Discrete Processing Rate Degree</b></em>'. |
26 | * <!-- end-user-doc --> |
27 | * <p> |
28 | * The following features are implemented: |
29 | * <ul> |
30 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.impl.DiscreteProcessingRateDegreeImpl#getProcessingresourcetype <em>Processingresourcetype</em>}</li> |
31 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.impl.DiscreteProcessingRateDegreeImpl#getNumberOfSteps <em>Number Of Steps</em>}</li> |
32 | * </ul> |
33 | * </p> |
34 | * |
35 | * @generated |
36 | */ |
37 | public class DiscreteProcessingRateDegreeImpl extends DiscreteRangeDegreeImpl implements DiscreteProcessingRateDegree { |
38 | /** |
39 | * The cached value of the '{@link #getProcessingresourcetype() <em>Processingresourcetype</em>}' reference. |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @see #getProcessingresourcetype() |
43 | * @generated |
44 | * @ordered |
45 | */ |
46 | protected ProcessingResourceType processingresourcetype; |
47 | |
48 | /** |
49 | * The default value of the '{@link #getNumberOfSteps() <em>Number Of Steps</em>}' attribute. |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @see #getNumberOfSteps() |
53 | * @generated |
54 | * @ordered |
55 | */ |
56 | protected static final int NUMBER_OF_STEPS_EDEFAULT = 0; |
57 | |
58 | /** |
59 | * The cached value of the '{@link #getNumberOfSteps() <em>Number Of Steps</em>}' attribute. |
60 | * <!-- begin-user-doc --> |
61 | * <!-- end-user-doc --> |
62 | * @see #getNumberOfSteps() |
63 | * @generated |
64 | * @ordered |
65 | */ |
66 | protected int numberOfSteps = NUMBER_OF_STEPS_EDEFAULT; |
67 | |
68 | /** |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | protected DiscreteProcessingRateDegreeImpl() { |
74 | super(); |
75 | } |
76 | |
77 | /** |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | @Override |
83 | protected EClass eStaticClass() { |
84 | return designdecisionPackage.Literals.DISCRETE_PROCESSING_RATE_DEGREE; |
85 | } |
86 | |
87 | /** |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | public ProcessingResourceType getProcessingresourcetype() { |
93 | if (processingresourcetype != null && processingresourcetype.eIsProxy()) { |
94 | InternalEObject oldProcessingresourcetype = (InternalEObject)processingresourcetype; |
95 | processingresourcetype = (ProcessingResourceType)eResolveProxy(oldProcessingresourcetype); |
96 | if (processingresourcetype != oldProcessingresourcetype) { |
97 | if (eNotificationRequired()) |
98 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__PROCESSINGRESOURCETYPE, oldProcessingresourcetype, processingresourcetype)); |
99 | } |
100 | } |
101 | return processingresourcetype; |
102 | } |
103 | |
104 | /** |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | public ProcessingResourceType basicGetProcessingresourcetype() { |
110 | return processingresourcetype; |
111 | } |
112 | |
113 | /** |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | public void setProcessingresourcetype(ProcessingResourceType newProcessingresourcetype) { |
119 | ProcessingResourceType oldProcessingresourcetype = processingresourcetype; |
120 | processingresourcetype = newProcessingresourcetype; |
121 | if (eNotificationRequired()) |
122 | eNotify(new ENotificationImpl(this, Notification.SET, designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__PROCESSINGRESOURCETYPE, oldProcessingresourcetype, processingresourcetype)); |
123 | } |
124 | |
125 | /** |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | public int getNumberOfSteps() { |
131 | return numberOfSteps; |
132 | } |
133 | |
134 | /** |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | public void setNumberOfSteps(int newNumberOfSteps) { |
140 | int oldNumberOfSteps = numberOfSteps; |
141 | numberOfSteps = newNumberOfSteps; |
142 | if (eNotificationRequired()) |
143 | eNotify(new ENotificationImpl(this, Notification.SET, designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__NUMBER_OF_STEPS, oldNumberOfSteps, numberOfSteps)); |
144 | } |
145 | |
146 | /** |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | @Override |
152 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
153 | switch (featureID) { |
154 | case designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__PROCESSINGRESOURCETYPE: |
155 | if (resolve) return getProcessingresourcetype(); |
156 | return basicGetProcessingresourcetype(); |
157 | case designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__NUMBER_OF_STEPS: |
158 | return getNumberOfSteps(); |
159 | } |
160 | return super.eGet(featureID, resolve, coreType); |
161 | } |
162 | |
163 | /** |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @generated |
167 | */ |
168 | @Override |
169 | public void eSet(int featureID, Object newValue) { |
170 | switch (featureID) { |
171 | case designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__PROCESSINGRESOURCETYPE: |
172 | setProcessingresourcetype((ProcessingResourceType)newValue); |
173 | return; |
174 | case designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__NUMBER_OF_STEPS: |
175 | setNumberOfSteps((Integer)newValue); |
176 | return; |
177 | } |
178 | super.eSet(featureID, newValue); |
179 | } |
180 | |
181 | /** |
182 | * <!-- begin-user-doc --> |
183 | * <!-- end-user-doc --> |
184 | * @generated |
185 | */ |
186 | @Override |
187 | public void eUnset(int featureID) { |
188 | switch (featureID) { |
189 | case designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__PROCESSINGRESOURCETYPE: |
190 | setProcessingresourcetype((ProcessingResourceType)null); |
191 | return; |
192 | case designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__NUMBER_OF_STEPS: |
193 | setNumberOfSteps(NUMBER_OF_STEPS_EDEFAULT); |
194 | return; |
195 | } |
196 | super.eUnset(featureID); |
197 | } |
198 | |
199 | /** |
200 | * <!-- begin-user-doc --> |
201 | * <!-- end-user-doc --> |
202 | * @generated |
203 | */ |
204 | @Override |
205 | public boolean eIsSet(int featureID) { |
206 | switch (featureID) { |
207 | case designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__PROCESSINGRESOURCETYPE: |
208 | return processingresourcetype != null; |
209 | case designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__NUMBER_OF_STEPS: |
210 | return numberOfSteps != NUMBER_OF_STEPS_EDEFAULT; |
211 | } |
212 | return super.eIsSet(featureID); |
213 | } |
214 | |
215 | /** |
216 | * <!-- begin-user-doc --> |
217 | * <!-- end-user-doc --> |
218 | * @generated |
219 | */ |
220 | @Override |
221 | public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
222 | if (baseClass == ProcessingResourceDegree.class) { |
223 | switch (derivedFeatureID) { |
224 | case designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__PROCESSINGRESOURCETYPE: return designdecisionPackage.PROCESSING_RESOURCE_DEGREE__PROCESSINGRESOURCETYPE; |
225 | default: return -1; |
226 | } |
227 | } |
228 | if (baseClass == ProcessingRateDegree.class) { |
229 | switch (derivedFeatureID) { |
230 | default: return -1; |
231 | } |
232 | } |
233 | return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
234 | } |
235 | |
236 | /** |
237 | * <!-- begin-user-doc --> |
238 | * <!-- end-user-doc --> |
239 | * @generated |
240 | */ |
241 | @Override |
242 | public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
243 | if (baseClass == ProcessingResourceDegree.class) { |
244 | switch (baseFeatureID) { |
245 | case designdecisionPackage.PROCESSING_RESOURCE_DEGREE__PROCESSINGRESOURCETYPE: return designdecisionPackage.DISCRETE_PROCESSING_RATE_DEGREE__PROCESSINGRESOURCETYPE; |
246 | default: return -1; |
247 | } |
248 | } |
249 | if (baseClass == ProcessingRateDegree.class) { |
250 | switch (baseFeatureID) { |
251 | default: return -1; |
252 | } |
253 | } |
254 | return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
255 | } |
256 | |
257 | /** |
258 | * <!-- begin-user-doc --> |
259 | * <!-- end-user-doc --> |
260 | * @generated |
261 | */ |
262 | @Override |
263 | public String toString() { |
264 | if (eIsProxy()) return super.toString(); |
265 | |
266 | StringBuffer result = new StringBuffer(super.toString()); |
267 | result.append(" (numberOfSteps: "); |
268 | result.append(numberOfSteps); |
269 | result.append(')'); |
270 | return result.toString(); |
271 | } |
272 | |
273 | } //DiscreteProcessingRateDegreeImpl |