1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package LqnCore.impl; |
8 | |
9 | import LqnCore.LqnCorePackage; |
10 | import LqnCore.ParaType; |
11 | |
12 | import java.util.Collection; |
13 | |
14 | import org.eclipse.emf.common.notify.Notification; |
15 | |
16 | import org.eclipse.emf.common.util.EList; |
17 | |
18 | import org.eclipse.emf.ecore.EClass; |
19 | |
20 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
21 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
22 | |
23 | import org.eclipse.emf.ecore.util.EDataTypeEList; |
24 | |
25 | /** |
26 | * <!-- begin-user-doc --> |
27 | * An implementation of the model object '<em><b>Para Type</b></em>'. |
28 | * <!-- end-user-doc --> |
29 | * <p> |
30 | * The following features are implemented: |
31 | * <ul> |
32 | * <li>{@link LqnCore.impl.ParaTypeImpl#getStartValue <em>Start Value</em>}</li> |
33 | * <li>{@link LqnCore.impl.ParaTypeImpl#getEndValue <em>End Value</em>}</li> |
34 | * <li>{@link LqnCore.impl.ParaTypeImpl#getStepValue <em>Step Value</em>}</li> |
35 | * <li>{@link LqnCore.impl.ParaTypeImpl#getValue <em>Value</em>}</li> |
36 | * </ul> |
37 | * </p> |
38 | * |
39 | * @generated |
40 | */ |
41 | public class ParaTypeImpl extends EObjectImpl implements ParaType { |
42 | /** |
43 | * The default value of the '{@link #getStartValue() <em>Start Value</em>}' attribute. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @see #getStartValue() |
47 | * @generated |
48 | * @ordered |
49 | */ |
50 | protected static final int START_VALUE_EDEFAULT = 0; |
51 | |
52 | /** |
53 | * The cached value of the '{@link #getStartValue() <em>Start Value</em>}' attribute. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @see #getStartValue() |
57 | * @generated |
58 | * @ordered |
59 | */ |
60 | protected int startValue = START_VALUE_EDEFAULT; |
61 | |
62 | /** |
63 | * This is true if the Start Value attribute has been set. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | * @ordered |
68 | */ |
69 | protected boolean startValueESet; |
70 | |
71 | /** |
72 | * The default value of the '{@link #getEndValue() <em>End Value</em>}' attribute. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @see #getEndValue() |
76 | * @generated |
77 | * @ordered |
78 | */ |
79 | protected static final int END_VALUE_EDEFAULT = 0; |
80 | |
81 | /** |
82 | * The cached value of the '{@link #getEndValue() <em>End Value</em>}' attribute. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @see #getEndValue() |
86 | * @generated |
87 | * @ordered |
88 | */ |
89 | protected int endValue = END_VALUE_EDEFAULT; |
90 | |
91 | /** |
92 | * This is true if the End Value attribute has been set. |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | * @ordered |
97 | */ |
98 | protected boolean endValueESet; |
99 | |
100 | /** |
101 | * The default value of the '{@link #getStepValue() <em>Step Value</em>}' attribute. |
102 | * <!-- begin-user-doc --> |
103 | * <!-- end-user-doc --> |
104 | * @see #getStepValue() |
105 | * @generated |
106 | * @ordered |
107 | */ |
108 | protected static final int STEP_VALUE_EDEFAULT = 0; |
109 | |
110 | /** |
111 | * The cached value of the '{@link #getStepValue() <em>Step Value</em>}' attribute. |
112 | * <!-- begin-user-doc --> |
113 | * <!-- end-user-doc --> |
114 | * @see #getStepValue() |
115 | * @generated |
116 | * @ordered |
117 | */ |
118 | protected int stepValue = STEP_VALUE_EDEFAULT; |
119 | |
120 | /** |
121 | * This is true if the Step Value attribute has been set. |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | * @ordered |
126 | */ |
127 | protected boolean stepValueESet; |
128 | |
129 | /** |
130 | * The cached value of the '{@link #getValue() <em>Value</em>}' attribute list. |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @see #getValue() |
134 | * @generated |
135 | * @ordered |
136 | */ |
137 | protected EList<Integer> value; |
138 | |
139 | /** |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | protected ParaTypeImpl() { |
145 | super(); |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | protected EClass eStaticClass() { |
155 | return LqnCorePackage.Literals.PARA_TYPE; |
156 | } |
157 | |
158 | /** |
159 | * <!-- begin-user-doc --> |
160 | * <!-- end-user-doc --> |
161 | * @generated |
162 | */ |
163 | public int getStartValue() { |
164 | return startValue; |
165 | } |
166 | |
167 | /** |
168 | * <!-- begin-user-doc --> |
169 | * <!-- end-user-doc --> |
170 | * @generated |
171 | */ |
172 | public void setStartValue(int newStartValue) { |
173 | int oldStartValue = startValue; |
174 | startValue = newStartValue; |
175 | boolean oldStartValueESet = startValueESet; |
176 | startValueESet = true; |
177 | if (eNotificationRequired()) |
178 | eNotify(new ENotificationImpl(this, Notification.SET, LqnCorePackage.PARA_TYPE__START_VALUE, oldStartValue, startValue, !oldStartValueESet)); |
179 | } |
180 | |
181 | /** |
182 | * <!-- begin-user-doc --> |
183 | * <!-- end-user-doc --> |
184 | * @generated |
185 | */ |
186 | public void unsetStartValue() { |
187 | int oldStartValue = startValue; |
188 | boolean oldStartValueESet = startValueESet; |
189 | startValue = START_VALUE_EDEFAULT; |
190 | startValueESet = false; |
191 | if (eNotificationRequired()) |
192 | eNotify(new ENotificationImpl(this, Notification.UNSET, LqnCorePackage.PARA_TYPE__START_VALUE, oldStartValue, START_VALUE_EDEFAULT, oldStartValueESet)); |
193 | } |
194 | |
195 | /** |
196 | * <!-- begin-user-doc --> |
197 | * <!-- end-user-doc --> |
198 | * @generated |
199 | */ |
200 | public boolean isSetStartValue() { |
201 | return startValueESet; |
202 | } |
203 | |
204 | /** |
205 | * <!-- begin-user-doc --> |
206 | * <!-- end-user-doc --> |
207 | * @generated |
208 | */ |
209 | public int getEndValue() { |
210 | return endValue; |
211 | } |
212 | |
213 | /** |
214 | * <!-- begin-user-doc --> |
215 | * <!-- end-user-doc --> |
216 | * @generated |
217 | */ |
218 | public void setEndValue(int newEndValue) { |
219 | int oldEndValue = endValue; |
220 | endValue = newEndValue; |
221 | boolean oldEndValueESet = endValueESet; |
222 | endValueESet = true; |
223 | if (eNotificationRequired()) |
224 | eNotify(new ENotificationImpl(this, Notification.SET, LqnCorePackage.PARA_TYPE__END_VALUE, oldEndValue, endValue, !oldEndValueESet)); |
225 | } |
226 | |
227 | /** |
228 | * <!-- begin-user-doc --> |
229 | * <!-- end-user-doc --> |
230 | * @generated |
231 | */ |
232 | public void unsetEndValue() { |
233 | int oldEndValue = endValue; |
234 | boolean oldEndValueESet = endValueESet; |
235 | endValue = END_VALUE_EDEFAULT; |
236 | endValueESet = false; |
237 | if (eNotificationRequired()) |
238 | eNotify(new ENotificationImpl(this, Notification.UNSET, LqnCorePackage.PARA_TYPE__END_VALUE, oldEndValue, END_VALUE_EDEFAULT, oldEndValueESet)); |
239 | } |
240 | |
241 | /** |
242 | * <!-- begin-user-doc --> |
243 | * <!-- end-user-doc --> |
244 | * @generated |
245 | */ |
246 | public boolean isSetEndValue() { |
247 | return endValueESet; |
248 | } |
249 | |
250 | /** |
251 | * <!-- begin-user-doc --> |
252 | * <!-- end-user-doc --> |
253 | * @generated |
254 | */ |
255 | public int getStepValue() { |
256 | return stepValue; |
257 | } |
258 | |
259 | /** |
260 | * <!-- begin-user-doc --> |
261 | * <!-- end-user-doc --> |
262 | * @generated |
263 | */ |
264 | public void setStepValue(int newStepValue) { |
265 | int oldStepValue = stepValue; |
266 | stepValue = newStepValue; |
267 | boolean oldStepValueESet = stepValueESet; |
268 | stepValueESet = true; |
269 | if (eNotificationRequired()) |
270 | eNotify(new ENotificationImpl(this, Notification.SET, LqnCorePackage.PARA_TYPE__STEP_VALUE, oldStepValue, stepValue, !oldStepValueESet)); |
271 | } |
272 | |
273 | /** |
274 | * <!-- begin-user-doc --> |
275 | * <!-- end-user-doc --> |
276 | * @generated |
277 | */ |
278 | public void unsetStepValue() { |
279 | int oldStepValue = stepValue; |
280 | boolean oldStepValueESet = stepValueESet; |
281 | stepValue = STEP_VALUE_EDEFAULT; |
282 | stepValueESet = false; |
283 | if (eNotificationRequired()) |
284 | eNotify(new ENotificationImpl(this, Notification.UNSET, LqnCorePackage.PARA_TYPE__STEP_VALUE, oldStepValue, STEP_VALUE_EDEFAULT, oldStepValueESet)); |
285 | } |
286 | |
287 | /** |
288 | * <!-- begin-user-doc --> |
289 | * <!-- end-user-doc --> |
290 | * @generated |
291 | */ |
292 | public boolean isSetStepValue() { |
293 | return stepValueESet; |
294 | } |
295 | |
296 | /** |
297 | * <!-- begin-user-doc --> |
298 | * <!-- end-user-doc --> |
299 | * @generated |
300 | */ |
301 | public EList<Integer> getValue() { |
302 | if (value == null) { |
303 | value = new EDataTypeEList<Integer>(Integer.class, this, LqnCorePackage.PARA_TYPE__VALUE); |
304 | } |
305 | return value; |
306 | } |
307 | |
308 | /** |
309 | * <!-- begin-user-doc --> |
310 | * <!-- end-user-doc --> |
311 | * @generated |
312 | */ |
313 | @Override |
314 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
315 | switch (featureID) { |
316 | case LqnCorePackage.PARA_TYPE__START_VALUE: |
317 | return new Integer(getStartValue()); |
318 | case LqnCorePackage.PARA_TYPE__END_VALUE: |
319 | return new Integer(getEndValue()); |
320 | case LqnCorePackage.PARA_TYPE__STEP_VALUE: |
321 | return new Integer(getStepValue()); |
322 | case LqnCorePackage.PARA_TYPE__VALUE: |
323 | return getValue(); |
324 | } |
325 | return super.eGet(featureID, resolve, coreType); |
326 | } |
327 | |
328 | /** |
329 | * <!-- begin-user-doc --> |
330 | * <!-- end-user-doc --> |
331 | * @generated |
332 | */ |
333 | @SuppressWarnings("unchecked") |
334 | @Override |
335 | public void eSet(int featureID, Object newValue) { |
336 | switch (featureID) { |
337 | case LqnCorePackage.PARA_TYPE__START_VALUE: |
338 | setStartValue(((Integer)newValue).intValue()); |
339 | return; |
340 | case LqnCorePackage.PARA_TYPE__END_VALUE: |
341 | setEndValue(((Integer)newValue).intValue()); |
342 | return; |
343 | case LqnCorePackage.PARA_TYPE__STEP_VALUE: |
344 | setStepValue(((Integer)newValue).intValue()); |
345 | return; |
346 | case LqnCorePackage.PARA_TYPE__VALUE: |
347 | getValue().clear(); |
348 | getValue().addAll((Collection<? extends Integer>)newValue); |
349 | return; |
350 | } |
351 | super.eSet(featureID, newValue); |
352 | } |
353 | |
354 | /** |
355 | * <!-- begin-user-doc --> |
356 | * <!-- end-user-doc --> |
357 | * @generated |
358 | */ |
359 | @Override |
360 | public void eUnset(int featureID) { |
361 | switch (featureID) { |
362 | case LqnCorePackage.PARA_TYPE__START_VALUE: |
363 | unsetStartValue(); |
364 | return; |
365 | case LqnCorePackage.PARA_TYPE__END_VALUE: |
366 | unsetEndValue(); |
367 | return; |
368 | case LqnCorePackage.PARA_TYPE__STEP_VALUE: |
369 | unsetStepValue(); |
370 | return; |
371 | case LqnCorePackage.PARA_TYPE__VALUE: |
372 | getValue().clear(); |
373 | return; |
374 | } |
375 | super.eUnset(featureID); |
376 | } |
377 | |
378 | /** |
379 | * <!-- begin-user-doc --> |
380 | * <!-- end-user-doc --> |
381 | * @generated |
382 | */ |
383 | @Override |
384 | public boolean eIsSet(int featureID) { |
385 | switch (featureID) { |
386 | case LqnCorePackage.PARA_TYPE__START_VALUE: |
387 | return isSetStartValue(); |
388 | case LqnCorePackage.PARA_TYPE__END_VALUE: |
389 | return isSetEndValue(); |
390 | case LqnCorePackage.PARA_TYPE__STEP_VALUE: |
391 | return isSetStepValue(); |
392 | case LqnCorePackage.PARA_TYPE__VALUE: |
393 | return value != null && !value.isEmpty(); |
394 | } |
395 | return super.eIsSet(featureID); |
396 | } |
397 | |
398 | /** |
399 | * <!-- begin-user-doc --> |
400 | * <!-- end-user-doc --> |
401 | * @generated |
402 | */ |
403 | @Override |
404 | public String toString() { |
405 | if (eIsProxy()) return super.toString(); |
406 | |
407 | StringBuffer result = new StringBuffer(super.toString()); |
408 | result.append(" (startValue: "); |
409 | if (startValueESet) result.append(startValue); else result.append("<unset>"); |
410 | result.append(", endValue: "); |
411 | if (endValueESet) result.append(endValue); else result.append("<unset>"); |
412 | result.append(", stepValue: "); |
413 | if (stepValueESet) result.append(stepValue); else result.append("<unset>"); |
414 | result.append(", value: "); |
415 | result.append(value); |
416 | result.append(')'); |
417 | return result.toString(); |
418 | } |
419 | |
420 | } //ParaTypeImpl |