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