/** * <copyright> * </copyright> * * $Id$ */ package org.reuseware.air.language.cmsl.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.reuseware.air.language.cmsl.BaseReference; import org.reuseware.air.language.cmsl.CmslPackage; import org.reuseware.air.language.cmsl.Injection; import org.reuseware.air.language.cmsl.NonTerminal; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Injection</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.reuseware.air.language.cmsl.impl.InjectionImpl#getSource <em>Source</em>}</li> * <li>{@link org.reuseware.air.language.cmsl.impl.InjectionImpl#getTarget <em>Target</em>}</li> * </ul> * </p> * * @generated */ public class InjectionImpl extends EObjectImpl implements Injection { /** * The cached value of the '{@link #getSource() <em>Source</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSource() * @generated * @ordered */ protected NonTerminal source; /** * The cached value of the '{@link #getTarget() <em>Target</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTarget() * @generated * @ordered */ protected BaseReference target; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected InjectionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return CmslPackage.Literals.INJECTION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NonTerminal getSource() { return source; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSource(NonTerminal newSource, NotificationChain msgs) { NonTerminal oldSource = source; source = newSource; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CmslPackage.INJECTION__SOURCE, oldSource, newSource); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSource(NonTerminal newSource) { if (newSource != source) { NotificationChain msgs = null; if (source != null) msgs = ((InternalEObject)source).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CmslPackage.INJECTION__SOURCE, null, msgs); if (newSource != null) msgs = ((InternalEObject)newSource).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CmslPackage.INJECTION__SOURCE, null, msgs); msgs = basicSetSource(newSource, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CmslPackage.INJECTION__SOURCE, newSource, newSource)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BaseReference getTarget() { return target; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetTarget(BaseReference newTarget, NotificationChain msgs) { BaseReference oldTarget = target; target = newTarget; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CmslPackage.INJECTION__TARGET, oldTarget, newTarget); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTarget(BaseReference newTarget) { if (newTarget != target) { NotificationChain msgs = null; if (target != null) msgs = ((InternalEObject)target).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CmslPackage.INJECTION__TARGET, null, msgs); if (newTarget != null) msgs = ((InternalEObject)newTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CmslPackage.INJECTION__TARGET, null, msgs); msgs = basicSetTarget(newTarget, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CmslPackage.INJECTION__TARGET, newTarget, newTarget)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case CmslPackage.INJECTION__SOURCE: return basicSetSource(null, msgs); case CmslPackage.INJECTION__TARGET: return basicSetTarget(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case CmslPackage.INJECTION__SOURCE: return getSource(); case CmslPackage.INJECTION__TARGET: return getTarget(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(int featureID, Object newValue) { switch (featureID) { case CmslPackage.INJECTION__SOURCE: setSource((NonTerminal)newValue); return; case CmslPackage.INJECTION__TARGET: setTarget((BaseReference)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(int featureID) { switch (featureID) { case CmslPackage.INJECTION__SOURCE: setSource((NonTerminal)null); return; case CmslPackage.INJECTION__TARGET: setTarget((BaseReference)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(int featureID) { switch (featureID) { case CmslPackage.INJECTION__SOURCE: return source != null; case CmslPackage.INJECTION__TARGET: return target != null; } return super.eIsSet(featureID); } } //InjectionImpl