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