001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id$
006: */package newprocess.impl;
007:
008: import newprocess.Element;
009: import newprocess.Expression;
010: import newprocess.NewprocessPackage;
011: import newprocess.SyncActivity;
012: import newprocess.validation.ElementValidator;
013: import newprocess.validation.ElementValidatorImpl;
014:
015: import org.eclipse.emf.common.notify.Notification;
016: import org.eclipse.emf.common.notify.NotificationChain;
017: import org.eclipse.emf.ecore.EClass;
018: import org.eclipse.emf.ecore.InternalEObject;
019: import org.eclipse.emf.ecore.impl.ENotificationImpl;
020:
021: /**
022: * <!-- begin-user-doc -->
023: * An implementation of the model object '<em><b>Sync Activity</b></em>'.
024: * <!-- end-user-doc -->
025: * <p>
026: * The following features are implemented:
027: * <ul>
028: * <li>{@link newprocess.impl.SyncActivityImpl#getTrials <em>Trials</em>}</li>
029: * <li>{@link newprocess.impl.SyncActivityImpl#getRetryDelay <em>Retry Delay</em>}</li>
030: * <li>{@link newprocess.impl.SyncActivityImpl#getHasPostcondition <em>Has Postcondition</em>}</li>
031: * <li>{@link newprocess.impl.SyncActivityImpl#getHasPrecondition <em>Has Precondition</em>}</li>
032: * <li>{@link newprocess.impl.SyncActivityImpl#isReentrant <em>Reentrant</em>}</li>
033: * </ul>
034: * </p>
035: *
036: * @generated NOT
037: * @author sh
038: */
039: public class SyncActivityImpl extends ElementImpl implements
040: SyncActivity, ElementValidator {
041:
042: /**
043: * The default value of the '{@link #getTrials() <em>Trials</em>}' attribute.
044: * <!-- begin-user-doc -->
045: * <!-- end-user-doc -->
046: * @see #getTrials()
047: * @generated
048: * @ordered
049: */
050: protected static final int TRIALS_EDEFAULT = 0;
051:
052: /**
053: * The cached value of the '{@link #getTrials() <em>Trials</em>}' attribute.
054: * <!-- begin-user-doc -->
055: * <!-- end-user-doc -->
056: * @see #getTrials()
057: * @generated
058: * @ordered
059: */
060: protected int trials = TRIALS_EDEFAULT;
061:
062: /**
063: * The default value of the '{@link #getRetryDelay() <em>Retry Delay</em>}' attribute.
064: * <!-- begin-user-doc -->
065: * <!-- end-user-doc -->
066: * @see #getRetryDelay()
067: * @generated
068: * @ordered
069: */
070: protected static final int RETRY_DELAY_EDEFAULT = 0;
071:
072: /**
073: * The cached value of the '{@link #getRetryDelay() <em>Retry Delay</em>}' attribute.
074: * <!-- begin-user-doc -->
075: * <!-- end-user-doc -->
076: * @see #getRetryDelay()
077: * @generated
078: * @ordered
079: */
080: protected int retryDelay = RETRY_DELAY_EDEFAULT;
081:
082: /**
083: * The cached value of the '{@link #getHasPostcondition() <em>Has Postcondition</em>}' containment reference.
084: * <!-- begin-user-doc -->
085: * <!-- end-user-doc -->
086: * @see #getHasPostcondition()
087: * @generated
088: * @ordered
089: */
090: protected Expression hasPostcondition = null;
091:
092: /**
093: * The cached value of the '{@link #getHasPrecondition() <em>Has Precondition</em>}' containment reference.
094: * <!-- begin-user-doc -->
095: * <!-- end-user-doc -->
096: * @see #getHasPrecondition()
097: * @generated
098: * @ordered
099: */
100: protected Expression hasPrecondition = null;
101:
102: /**
103: * The default value of the '{@link #isReentrant() <em>Reentrant</em>}' attribute.
104: * <!-- begin-user-doc -->
105: * <!-- end-user-doc -->
106: * @see #isReentrant()
107: * @generated
108: * @ordered
109: */
110: protected static final boolean REENTRANT_EDEFAULT = false;
111:
112: /**
113: * The cached value of the '{@link #isReentrant() <em>Reentrant</em>}' attribute.
114: * <!-- begin-user-doc -->
115: * <!-- end-user-doc -->
116: * @see #isReentrant()
117: * @generated
118: * @ordered
119: */
120: protected boolean reentrant = REENTRANT_EDEFAULT;
121:
122: /**
123: * <!-- begin-user-doc -->
124: * <!-- end-user-doc -->
125: * @generated
126: */
127: protected SyncActivityImpl() {
128: super ();
129: }
130:
131: /**
132: * <!-- begin-user-doc -->
133: * <!-- end-user-doc -->
134: * @generated
135: */
136: @Override
137: protected EClass eStaticClass() {
138: return NewprocessPackage.Literals.SYNC_ACTIVITY;
139: }
140:
141: /**
142: * <!-- begin-user-doc -->
143: * <!-- end-user-doc -->
144: * @generated
145: */
146: public int getTrials() {
147: return trials;
148: }
149:
150: /**
151: * <!-- begin-user-doc -->
152: * <!-- end-user-doc -->
153: * @generated
154: */
155: public void setTrials(int newTrials) {
156: int oldTrials = trials;
157: trials = newTrials;
158: if (eNotificationRequired())
159: eNotify(new ENotificationImpl(this , Notification.SET,
160: NewprocessPackage.SYNC_ACTIVITY__TRIALS, oldTrials,
161: trials));
162: }
163:
164: /**
165: * <!-- begin-user-doc -->
166: * <!-- end-user-doc -->
167: * @generated
168: */
169: public int getRetryDelay() {
170: return retryDelay;
171: }
172:
173: /**
174: * <!-- begin-user-doc -->
175: * <!-- end-user-doc -->
176: * @generated
177: */
178: public void setRetryDelay(int newRetryDelay) {
179: int oldRetryDelay = retryDelay;
180: retryDelay = newRetryDelay;
181: if (eNotificationRequired())
182: eNotify(new ENotificationImpl(this , Notification.SET,
183: NewprocessPackage.SYNC_ACTIVITY__RETRY_DELAY,
184: oldRetryDelay, retryDelay));
185: }
186:
187: /**
188: * <!-- begin-user-doc -->
189: * <!-- end-user-doc -->
190: * @generated
191: */
192: public Expression getHasPostcondition() {
193: return hasPostcondition;
194: }
195:
196: /**
197: * <!-- begin-user-doc -->
198: * <!-- end-user-doc -->
199: * @generated
200: */
201: public NotificationChain basicSetHasPostcondition(
202: Expression newHasPostcondition, NotificationChain msgs) {
203: Expression oldHasPostcondition = hasPostcondition;
204: hasPostcondition = newHasPostcondition;
205: if (eNotificationRequired()) {
206: ENotificationImpl notification = new ENotificationImpl(
207: this , Notification.SET,
208: NewprocessPackage.SYNC_ACTIVITY__HAS_POSTCONDITION,
209: oldHasPostcondition, newHasPostcondition);
210: if (msgs == null)
211: msgs = notification;
212: else
213: msgs.add(notification);
214: }
215: return msgs;
216: }
217:
218: /**
219: * <!-- begin-user-doc -->
220: * <!-- end-user-doc -->
221: * @generated
222: */
223: public void setHasPostcondition(Expression newHasPostcondition) {
224: if (newHasPostcondition != hasPostcondition) {
225: NotificationChain msgs = null;
226: if (hasPostcondition != null)
227: msgs = ((InternalEObject) hasPostcondition)
228: .eInverseRemove(
229: this ,
230: EOPPOSITE_FEATURE_BASE
231: - NewprocessPackage.SYNC_ACTIVITY__HAS_POSTCONDITION,
232: null, msgs);
233: if (newHasPostcondition != null)
234: msgs = ((InternalEObject) newHasPostcondition)
235: .eInverseAdd(
236: this ,
237: EOPPOSITE_FEATURE_BASE
238: - NewprocessPackage.SYNC_ACTIVITY__HAS_POSTCONDITION,
239: null, msgs);
240: msgs = basicSetHasPostcondition(newHasPostcondition, msgs);
241: if (msgs != null)
242: msgs.dispatch();
243: } else if (eNotificationRequired())
244: eNotify(new ENotificationImpl(this , Notification.SET,
245: NewprocessPackage.SYNC_ACTIVITY__HAS_POSTCONDITION,
246: newHasPostcondition, newHasPostcondition));
247: }
248:
249: /**
250: * <!-- begin-user-doc -->
251: * <!-- end-user-doc -->
252: * @generated
253: */
254: public Expression getHasPrecondition() {
255: return hasPrecondition;
256: }
257:
258: /**
259: * <!-- begin-user-doc -->
260: * <!-- end-user-doc -->
261: * @generated
262: */
263: public NotificationChain basicSetHasPrecondition(
264: Expression newHasPrecondition, NotificationChain msgs) {
265: Expression oldHasPrecondition = hasPrecondition;
266: hasPrecondition = newHasPrecondition;
267: if (eNotificationRequired()) {
268: ENotificationImpl notification = new ENotificationImpl(
269: this , Notification.SET,
270: NewprocessPackage.SYNC_ACTIVITY__HAS_PRECONDITION,
271: oldHasPrecondition, newHasPrecondition);
272: if (msgs == null)
273: msgs = notification;
274: else
275: msgs.add(notification);
276: }
277: return msgs;
278: }
279:
280: /**
281: * <!-- begin-user-doc -->
282: * <!-- end-user-doc -->
283: * @generated
284: */
285: public void setHasPrecondition(Expression newHasPrecondition) {
286: if (newHasPrecondition != hasPrecondition) {
287: NotificationChain msgs = null;
288: if (hasPrecondition != null)
289: msgs = ((InternalEObject) hasPrecondition)
290: .eInverseRemove(
291: this ,
292: EOPPOSITE_FEATURE_BASE
293: - NewprocessPackage.SYNC_ACTIVITY__HAS_PRECONDITION,
294: null, msgs);
295: if (newHasPrecondition != null)
296: msgs = ((InternalEObject) newHasPrecondition)
297: .eInverseAdd(
298: this ,
299: EOPPOSITE_FEATURE_BASE
300: - NewprocessPackage.SYNC_ACTIVITY__HAS_PRECONDITION,
301: null, msgs);
302: msgs = basicSetHasPrecondition(newHasPrecondition, msgs);
303: if (msgs != null)
304: msgs.dispatch();
305: } else if (eNotificationRequired())
306: eNotify(new ENotificationImpl(this , Notification.SET,
307: NewprocessPackage.SYNC_ACTIVITY__HAS_PRECONDITION,
308: newHasPrecondition, newHasPrecondition));
309: }
310:
311: /**
312: * <!-- begin-user-doc -->
313: * <!-- end-user-doc -->
314: * @generated
315: */
316: public boolean isReentrant() {
317: return reentrant;
318: }
319:
320: /**
321: * <!-- begin-user-doc -->
322: * <!-- end-user-doc -->
323: * @generated
324: */
325: public void setReentrant(boolean newReentrant) {
326: boolean oldReentrant = reentrant;
327: reentrant = newReentrant;
328: if (eNotificationRequired())
329: eNotify(new ENotificationImpl(this , Notification.SET,
330: NewprocessPackage.SYNC_ACTIVITY__REENTRANT,
331: oldReentrant, reentrant));
332: }
333:
334: /**
335: * <!-- begin-user-doc -->
336: * <!-- end-user-doc -->
337: * @generated NOT
338: * @author sh
339: */
340: public void performUpdate() {
341: Expression preconExpr = getHasPrecondition();
342: Expression postconExpr = getHasPostcondition();
343: if (preconExpr != null)
344: preconExpr.updateName();
345: if (postconExpr != null)
346: postconExpr.updateName();
347: }
348:
349: /**
350: * <!-- begin-user-doc -->
351: * <!-- end-user-doc -->
352: * @generated
353: */
354: @Override
355: public NotificationChain eInverseRemove(InternalEObject otherEnd,
356: int featureID, NotificationChain msgs) {
357: switch (featureID) {
358: case NewprocessPackage.SYNC_ACTIVITY__HAS_POSTCONDITION:
359: return basicSetHasPostcondition(null, msgs);
360: case NewprocessPackage.SYNC_ACTIVITY__HAS_PRECONDITION:
361: return basicSetHasPrecondition(null, msgs);
362: }
363: return super .eInverseRemove(otherEnd, featureID, msgs);
364: }
365:
366: /**
367: * <!-- begin-user-doc -->
368: * <!-- end-user-doc -->
369: * @generated
370: */
371: @Override
372: public Object eGet(int featureID, boolean resolve, boolean coreType) {
373: switch (featureID) {
374: case NewprocessPackage.SYNC_ACTIVITY__TRIALS:
375: return new Integer(getTrials());
376: case NewprocessPackage.SYNC_ACTIVITY__RETRY_DELAY:
377: return new Integer(getRetryDelay());
378: case NewprocessPackage.SYNC_ACTIVITY__HAS_POSTCONDITION:
379: return getHasPostcondition();
380: case NewprocessPackage.SYNC_ACTIVITY__HAS_PRECONDITION:
381: return getHasPrecondition();
382: case NewprocessPackage.SYNC_ACTIVITY__REENTRANT:
383: return isReentrant() ? Boolean.TRUE : Boolean.FALSE;
384: }
385: return super .eGet(featureID, resolve, coreType);
386: }
387:
388: /**
389: * <!-- begin-user-doc -->
390: * <!-- end-user-doc -->
391: * @generated
392: */
393: @Override
394: public void eSet(int featureID, Object newValue) {
395: switch (featureID) {
396: case NewprocessPackage.SYNC_ACTIVITY__TRIALS:
397: setTrials(((Integer) newValue).intValue());
398: return;
399: case NewprocessPackage.SYNC_ACTIVITY__RETRY_DELAY:
400: setRetryDelay(((Integer) newValue).intValue());
401: return;
402: case NewprocessPackage.SYNC_ACTIVITY__HAS_POSTCONDITION:
403: setHasPostcondition((Expression) newValue);
404: return;
405: case NewprocessPackage.SYNC_ACTIVITY__HAS_PRECONDITION:
406: setHasPrecondition((Expression) newValue);
407: return;
408: case NewprocessPackage.SYNC_ACTIVITY__REENTRANT:
409: setReentrant(((Boolean) newValue).booleanValue());
410: return;
411: }
412: super .eSet(featureID, newValue);
413: }
414:
415: /**
416: * <!-- begin-user-doc -->
417: * <!-- end-user-doc -->
418: * @generated
419: */
420: @Override
421: public void eUnset(int featureID) {
422: switch (featureID) {
423: case NewprocessPackage.SYNC_ACTIVITY__TRIALS:
424: setTrials(TRIALS_EDEFAULT);
425: return;
426: case NewprocessPackage.SYNC_ACTIVITY__RETRY_DELAY:
427: setRetryDelay(RETRY_DELAY_EDEFAULT);
428: return;
429: case NewprocessPackage.SYNC_ACTIVITY__HAS_POSTCONDITION:
430: setHasPostcondition((Expression) null);
431: return;
432: case NewprocessPackage.SYNC_ACTIVITY__HAS_PRECONDITION:
433: setHasPrecondition((Expression) null);
434: return;
435: case NewprocessPackage.SYNC_ACTIVITY__REENTRANT:
436: setReentrant(REENTRANT_EDEFAULT);
437: return;
438: }
439: super .eUnset(featureID);
440: }
441:
442: /**
443: * <!-- begin-user-doc -->
444: * <!-- end-user-doc -->
445: * @generated
446: */
447: @Override
448: public boolean eIsSet(int featureID) {
449: switch (featureID) {
450: case NewprocessPackage.SYNC_ACTIVITY__TRIALS:
451: return trials != TRIALS_EDEFAULT;
452: case NewprocessPackage.SYNC_ACTIVITY__RETRY_DELAY:
453: return retryDelay != RETRY_DELAY_EDEFAULT;
454: case NewprocessPackage.SYNC_ACTIVITY__HAS_POSTCONDITION:
455: return hasPostcondition != null;
456: case NewprocessPackage.SYNC_ACTIVITY__HAS_PRECONDITION:
457: return hasPrecondition != null;
458: case NewprocessPackage.SYNC_ACTIVITY__REENTRANT:
459: return reentrant != REENTRANT_EDEFAULT;
460: }
461: return super .eIsSet(featureID);
462: }
463:
464: /**
465: * <!-- begin-user-doc -->
466: * <!-- end-user-doc -->
467: * @generated
468: */
469: @Override
470: public String toString() {
471: if (eIsProxy())
472: return super .toString();
473:
474: StringBuffer result = new StringBuffer(super .toString());
475: result.append(" (trials: ");
476: result.append(trials);
477: result.append(", retryDelay: ");
478: result.append(retryDelay);
479: result.append(", reentrant: ");
480: result.append(reentrant);
481: result.append(')');
482: return result.toString();
483: }
484:
485: /**
486: * Validates the Implementation of the SyncActivity
487: * @author sh
488: */
489: public boolean validateImplementation(Element value) {
490: return ElementValidatorImpl.INSTANCE
491: .validateImplementation(value);
492: }
493:
494: /**
495: * Validates the Name of the SyncActivity
496: * @author sh
497: */
498: public boolean validateName(Element value) {
499: return ElementValidatorImpl.INSTANCE.validateName(value);
500: }
501: } //SyncActivityImpl
|