/** * <copyright> * </copyright> * * $Id$ */ package orgomg.cwm.objectmodel.relationships.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 orgomg.cwm.objectmodel.core.Classifier; import orgomg.cwm.objectmodel.core.CorePackage; import orgomg.cwm.objectmodel.core.impl.ModelElementImpl; import orgomg.cwm.objectmodel.relationships.Generalization; import orgomg.cwm.objectmodel.relationships.RelationshipsPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Generalization</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link orgomg.cwm.objectmodel.relationships.impl.GeneralizationImpl#getChild <em>Child</em>}</li> * <li>{@link orgomg.cwm.objectmodel.relationships.impl.GeneralizationImpl#getParent <em>Parent</em>}</li> * </ul> * </p> * * @generated */ public class GeneralizationImpl extends ModelElementImpl implements Generalization { /** * The cached value of the '{@link #getChild() <em>Child</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getChild() * @generated * @ordered */ protected Classifier child; /** * The cached value of the '{@link #getParent() <em>Parent</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getParent() * @generated * @ordered */ protected Classifier parent; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected GeneralizationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return RelationshipsPackage.Literals.GENERALIZATION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Classifier getChild() { if (child != null && child.eIsProxy()) { InternalEObject oldChild = (InternalEObject)child; child = (Classifier)eResolveProxy(oldChild); if (child != oldChild) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, RelationshipsPackage.GENERALIZATION__CHILD, oldChild, child)); } } return child; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Classifier basicGetChild() { return child; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetChild(Classifier newChild, NotificationChain msgs) { Classifier oldChild = child; child = newChild; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RelationshipsPackage.GENERALIZATION__CHILD, oldChild, newChild); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setChild(Classifier newChild) { if (newChild != child) { NotificationChain msgs = null; if (child != null) msgs = ((InternalEObject)child).eInverseRemove(this, CorePackage.CLASSIFIER__GENERALIZATION, Classifier.class, msgs); if (newChild != null) msgs = ((InternalEObject)newChild).eInverseAdd(this, CorePackage.CLASSIFIER__GENERALIZATION, Classifier.class, msgs); msgs = basicSetChild(newChild, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, RelationshipsPackage.GENERALIZATION__CHILD, newChild, newChild)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Classifier getParent() { if (parent != null && parent.eIsProxy()) { InternalEObject oldParent = (InternalEObject)parent; parent = (Classifier)eResolveProxy(oldParent); if (parent != oldParent) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, RelationshipsPackage.GENERALIZATION__PARENT, oldParent, parent)); } } return parent; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Classifier basicGetParent() { return parent; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetParent(Classifier newParent, NotificationChain msgs) { Classifier oldParent = parent; parent = newParent; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RelationshipsPackage.GENERALIZATION__PARENT, oldParent, newParent); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setParent(Classifier newParent) { if (newParent != parent) { NotificationChain msgs = null; if (parent != null) msgs = ((InternalEObject)parent).eInverseRemove(this, CorePackage.CLASSIFIER__SPECIALIZATION, Classifier.class, msgs); if (newParent != null) msgs = ((InternalEObject)newParent).eInverseAdd(this, CorePackage.CLASSIFIER__SPECIALIZATION, Classifier.class, msgs); msgs = basicSetParent(newParent, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, RelationshipsPackage.GENERALIZATION__PARENT, newParent, newParent)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case RelationshipsPackage.GENERALIZATION__CHILD: if (child != null) msgs = ((InternalEObject)child).eInverseRemove(this, CorePackage.CLASSIFIER__GENERALIZATION, Classifier.class, msgs); return basicSetChild((Classifier)otherEnd, msgs); case RelationshipsPackage.GENERALIZATION__PARENT: if (parent != null) msgs = ((InternalEObject)parent).eInverseRemove(this, CorePackage.CLASSIFIER__SPECIALIZATION, Classifier.class, msgs); return basicSetParent((Classifier)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case RelationshipsPackage.GENERALIZATION__CHILD: return basicSetChild(null, msgs); case RelationshipsPackage.GENERALIZATION__PARENT: return basicSetParent(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 RelationshipsPackage.GENERALIZATION__CHILD: if (resolve) return getChild(); return basicGetChild(); case RelationshipsPackage.GENERALIZATION__PARENT: if (resolve) return getParent(); return basicGetParent(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case RelationshipsPackage.GENERALIZATION__CHILD: setChild((Classifier)newValue); return; case RelationshipsPackage.GENERALIZATION__PARENT: setParent((Classifier)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case RelationshipsPackage.GENERALIZATION__CHILD: setChild((Classifier)null); return; case RelationshipsPackage.GENERALIZATION__PARENT: setParent((Classifier)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case RelationshipsPackage.GENERALIZATION__CHILD: return child != null; case RelationshipsPackage.GENERALIZATION__PARENT: return parent != null; } return super.eIsSet(featureID); } } //GeneralizationImpl