| /** |
| */ |
| package morphisms.impl; |
| |
| import morphisms.Morphism; |
| import morphisms.MorphismsPackage; |
| import morphisms.Pair; |
| |
| 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.MinimalEObjectImpl; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Pair</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link morphisms.impl.PairImpl#getA <em>A</em>}</li> |
| * <li>{@link morphisms.impl.PairImpl#getB <em>B</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class PairImpl extends MinimalEObjectImpl.Container implements Pair { |
| /** |
| * The cached value of the '{@link #getA() <em>A</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getA() |
| * @generated |
| * @ordered |
| */ |
| protected Morphism a; |
| |
| /** |
| * The cached value of the '{@link #getB() <em>B</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getB() |
| * @generated |
| * @ordered |
| */ |
| protected Morphism b; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PairImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return MorphismsPackage.Literals.PAIR; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Morphism getA() { |
| return a; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetA(Morphism newA, NotificationChain msgs) { |
| Morphism oldA = a; |
| a = newA; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MorphismsPackage.PAIR__A, oldA, newA); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setA(Morphism newA) { |
| if (newA != a) { |
| NotificationChain msgs = null; |
| if (a != null) |
| msgs = ((InternalEObject)a).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MorphismsPackage.PAIR__A, null, msgs); |
| if (newA != null) |
| msgs = ((InternalEObject)newA).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MorphismsPackage.PAIR__A, null, msgs); |
| msgs = basicSetA(newA, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MorphismsPackage.PAIR__A, newA, newA)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Morphism getB() { |
| return b; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetB(Morphism newB, NotificationChain msgs) { |
| Morphism oldB = b; |
| b = newB; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MorphismsPackage.PAIR__B, oldB, newB); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setB(Morphism newB) { |
| if (newB != b) { |
| NotificationChain msgs = null; |
| if (b != null) |
| msgs = ((InternalEObject)b).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MorphismsPackage.PAIR__B, null, msgs); |
| if (newB != null) |
| msgs = ((InternalEObject)newB).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MorphismsPackage.PAIR__B, null, msgs); |
| msgs = basicSetB(newB, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MorphismsPackage.PAIR__B, newB, newB)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case MorphismsPackage.PAIR__A: |
| return basicSetA(null, msgs); |
| case MorphismsPackage.PAIR__B: |
| return basicSetB(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case MorphismsPackage.PAIR__A: |
| return getA(); |
| case MorphismsPackage.PAIR__B: |
| return getB(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case MorphismsPackage.PAIR__A: |
| setA((Morphism)newValue); |
| return; |
| case MorphismsPackage.PAIR__B: |
| setB((Morphism)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case MorphismsPackage.PAIR__A: |
| setA((Morphism)null); |
| return; |
| case MorphismsPackage.PAIR__B: |
| setB((Morphism)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case MorphismsPackage.PAIR__A: |
| return a != null; |
| case MorphismsPackage.PAIR__B: |
| return b != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //PairImpl |