001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id$
006: */package newprocess.impl;
007:
008: import newprocess.Element;
009: import newprocess.Event;
010: import newprocess.Expression;
011: import newprocess.NewprocessPackage;
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>Event</b></em>'.
024: * <!-- end-user-doc -->
025: * <p>
026: * The following features are implemented:
027: * <ul>
028: * <li>{@link newprocess.impl.EventImpl#getHasPostcondition <em>Has Postcondition</em>}</li>
029: * <li>{@link newprocess.impl.EventImpl#isReentrant <em>Reentrant</em>}</li>
030: * </ul>
031: * </p>
032: *
033: * @generated NOT
034: * @author sh
035: */
036: public class EventImpl extends ElementImpl implements Event,
037: ElementValidator {
038:
039: /**
040: * The cached value of the '{@link #getHasPostcondition() <em>Has Postcondition</em>}' containment reference.
041: * <!-- begin-user-doc -->
042: * <!-- end-user-doc -->
043: * @see #getHasPostcondition()
044: * @generated
045: * @ordered
046: */
047: protected Expression hasPostcondition = null;
048:
049: /**
050: * The default value of the '{@link #isReentrant() <em>Reentrant</em>}' attribute.
051: * <!-- begin-user-doc -->
052: * <!-- end-user-doc -->
053: * @see #isReentrant()
054: * @generated
055: * @ordered
056: */
057: protected static final boolean REENTRANT_EDEFAULT = false;
058: /**
059: * The cached value of the '{@link #isReentrant() <em>Reentrant</em>}' attribute.
060: * <!-- begin-user-doc -->
061: * <!-- end-user-doc -->
062: * @see #isReentrant()
063: * @generated
064: * @ordered
065: */
066: protected boolean reentrant = REENTRANT_EDEFAULT;
067:
068: /**
069: * <!-- begin-user-doc -->
070: * <!-- end-user-doc -->
071: * @generated
072: */
073: protected EventImpl() {
074: super ();
075: }
076:
077: /**
078: * <!-- begin-user-doc -->
079: * <!-- end-user-doc -->
080: * @generated
081: */
082: @Override
083: protected EClass eStaticClass() {
084: return NewprocessPackage.Literals.EVENT;
085: }
086:
087: /**
088: * <!-- begin-user-doc -->
089: * <!-- end-user-doc -->
090: * @generated
091: */
092: public Expression getHasPostcondition() {
093: return hasPostcondition;
094: }
095:
096: /**
097: * <!-- begin-user-doc -->
098: * <!-- end-user-doc -->
099: * @generated
100: */
101: public NotificationChain basicSetHasPostcondition(
102: Expression newHasPostcondition, NotificationChain msgs) {
103: Expression oldHasPostcondition = hasPostcondition;
104: hasPostcondition = newHasPostcondition;
105: if (eNotificationRequired()) {
106: ENotificationImpl notification = new ENotificationImpl(
107: this , Notification.SET,
108: NewprocessPackage.EVENT__HAS_POSTCONDITION,
109: oldHasPostcondition, newHasPostcondition);
110: if (msgs == null)
111: msgs = notification;
112: else
113: msgs.add(notification);
114: }
115: return msgs;
116: }
117:
118: /**
119: * <!-- begin-user-doc -->
120: * <!-- end-user-doc -->
121: * @generated
122: */
123: public void setHasPostcondition(Expression newHasPostcondition) {
124: if (newHasPostcondition != hasPostcondition) {
125: NotificationChain msgs = null;
126: if (hasPostcondition != null)
127: msgs = ((InternalEObject) hasPostcondition)
128: .eInverseRemove(
129: this ,
130: EOPPOSITE_FEATURE_BASE
131: - NewprocessPackage.EVENT__HAS_POSTCONDITION,
132: null, msgs);
133: if (newHasPostcondition != null)
134: msgs = ((InternalEObject) newHasPostcondition)
135: .eInverseAdd(
136: this ,
137: EOPPOSITE_FEATURE_BASE
138: - NewprocessPackage.EVENT__HAS_POSTCONDITION,
139: null, msgs);
140: msgs = basicSetHasPostcondition(newHasPostcondition, msgs);
141: if (msgs != null)
142: msgs.dispatch();
143: } else if (eNotificationRequired())
144: eNotify(new ENotificationImpl(this , Notification.SET,
145: NewprocessPackage.EVENT__HAS_POSTCONDITION,
146: newHasPostcondition, newHasPostcondition));
147: }
148:
149: /**
150: * <!-- begin-user-doc -->
151: * <!-- end-user-doc -->
152: * @generated
153: */
154: public boolean isReentrant() {
155: return reentrant;
156: }
157:
158: /**
159: * <!-- begin-user-doc -->
160: * <!-- end-user-doc -->
161: * @generated
162: */
163: public void setReentrant(boolean newReentrant) {
164: boolean oldReentrant = reentrant;
165: reentrant = newReentrant;
166: if (eNotificationRequired())
167: eNotify(new ENotificationImpl(this , Notification.SET,
168: NewprocessPackage.EVENT__REENTRANT, oldReentrant,
169: reentrant));
170: }
171:
172: /**
173: * <!-- begin-user-doc -->
174: * <!-- end-user-doc -->
175: * @generated NOT
176: * @author sh
177: */
178: public void performUpdate() {
179: Expression postconExpr = getHasPostcondition();
180: if (postconExpr != null)
181: postconExpr.updateName();
182: }
183:
184: /**
185: * <!-- begin-user-doc -->
186: * <!-- end-user-doc -->
187: * @generated
188: */
189: @Override
190: public NotificationChain eInverseRemove(InternalEObject otherEnd,
191: int featureID, NotificationChain msgs) {
192: switch (featureID) {
193: case NewprocessPackage.EVENT__HAS_POSTCONDITION:
194: return basicSetHasPostcondition(null, msgs);
195: }
196: return super .eInverseRemove(otherEnd, featureID, msgs);
197: }
198:
199: /**
200: * <!-- begin-user-doc -->
201: * <!-- end-user-doc -->
202: * @generated
203: */
204: @Override
205: public Object eGet(int featureID, boolean resolve, boolean coreType) {
206: switch (featureID) {
207: case NewprocessPackage.EVENT__HAS_POSTCONDITION:
208: return getHasPostcondition();
209: case NewprocessPackage.EVENT__REENTRANT:
210: return isReentrant() ? Boolean.TRUE : Boolean.FALSE;
211: }
212: return super .eGet(featureID, resolve, coreType);
213: }
214:
215: /**
216: * <!-- begin-user-doc -->
217: * <!-- end-user-doc -->
218: * @generated
219: */
220: @Override
221: public void eSet(int featureID, Object newValue) {
222: switch (featureID) {
223: case NewprocessPackage.EVENT__HAS_POSTCONDITION:
224: setHasPostcondition((Expression) newValue);
225: return;
226: case NewprocessPackage.EVENT__REENTRANT:
227: setReentrant(((Boolean) newValue).booleanValue());
228: return;
229: }
230: super .eSet(featureID, newValue);
231: }
232:
233: /**
234: * <!-- begin-user-doc -->
235: * <!-- end-user-doc -->
236: * @generated
237: */
238: @Override
239: public void eUnset(int featureID) {
240: switch (featureID) {
241: case NewprocessPackage.EVENT__HAS_POSTCONDITION:
242: setHasPostcondition((Expression) null);
243: return;
244: case NewprocessPackage.EVENT__REENTRANT:
245: setReentrant(REENTRANT_EDEFAULT);
246: return;
247: }
248: super .eUnset(featureID);
249: }
250:
251: /**
252: * <!-- begin-user-doc -->
253: * <!-- end-user-doc -->
254: * @generated
255: */
256: @Override
257: public boolean eIsSet(int featureID) {
258: switch (featureID) {
259: case NewprocessPackage.EVENT__HAS_POSTCONDITION:
260: return hasPostcondition != null;
261: case NewprocessPackage.EVENT__REENTRANT:
262: return reentrant != REENTRANT_EDEFAULT;
263: }
264: return super .eIsSet(featureID);
265: }
266:
267: /**
268: * <!-- begin-user-doc -->
269: * <!-- end-user-doc -->
270: * @generated
271: */
272: @Override
273: public String toString() {
274: if (eIsProxy())
275: return super .toString();
276:
277: StringBuffer result = new StringBuffer(super .toString());
278: result.append(" (reentrant: ");
279: result.append(reentrant);
280: result.append(')');
281: return result.toString();
282: }
283:
284: /**
285: * Validates the Implementation of the Event
286: * @author sh
287: */
288: public boolean validateImplementation(Element value) {
289: return ElementValidatorImpl.INSTANCE
290: .validateImplementation(value);
291: }
292:
293: /**
294: * Validates the Name of the Event
295: * @author sh
296: */
297: public boolean validateName(Element value) {
298: return ElementValidatorImpl.INSTANCE.validateName(value);
299: }
300: } //EventImpl
|