/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.eclipse.gmf.codegen.gmfgen.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.eclipse.gmf.codegen.gmfgen.GMFGenPackage;
import org.eclipse.gmf.codegen.gmfgen.GenCommonBase;
import org.eclipse.gmf.codegen.gmfgen.GenNavigatorPath;
import org.eclipse.gmf.codegen.gmfgen.GenNavigatorPathSegment;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Gen Navigator Path Segment</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenNavigatorPathSegmentImpl#getPath <em>Path</em>}</li>
* <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenNavigatorPathSegmentImpl#getFrom <em>From</em>}</li>
* <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenNavigatorPathSegmentImpl#getTo <em>To</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class GenNavigatorPathSegmentImpl extends EObjectImpl implements GenNavigatorPathSegment {
/**
* The cached value of the '{@link #getFrom() <em>From</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFrom()
* @generated
* @ordered
*/
protected GenCommonBase from;
/**
* The cached value of the '{@link #getTo() <em>To</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTo()
* @generated
* @ordered
*/
protected GenCommonBase to;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GenNavigatorPathSegmentImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return GMFGenPackage.eINSTANCE.getGenNavigatorPathSegment();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public GenNavigatorPath getPath() {
if (eContainerFeatureID() != GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__PATH) return null;
return (GenNavigatorPath)eInternalContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public GenCommonBase getFrom() {
if (from != null && from.eIsProxy()) {
InternalEObject oldFrom = (InternalEObject)from;
from = (GenCommonBase)eResolveProxy(oldFrom);
if (from != oldFrom) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__FROM, oldFrom, from));
}
}
return from;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public GenCommonBase basicGetFrom() {
return from;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFrom(GenCommonBase newFrom) {
GenCommonBase oldFrom = from;
from = newFrom;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__FROM, oldFrom, from));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public GenCommonBase getTo() {
if (to != null && to.eIsProxy()) {
InternalEObject oldTo = (InternalEObject)to;
to = (GenCommonBase)eResolveProxy(oldTo);
if (to != oldTo) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__TO, oldTo, to));
}
}
return to;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public GenCommonBase basicGetTo() {
return to;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTo(GenCommonBase newTo) {
GenCommonBase oldTo = to;
to = newTo;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__TO, oldTo, to));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__PATH:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return eBasicSetContainer(otherEnd, GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__PATH, 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 GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__PATH:
return eBasicSetContainer(null, GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__PATH, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__PATH:
return eInternalContainer().eInverseRemove(this, GMFGenPackage.GEN_NAVIGATOR_PATH__SEGMENTS, GenNavigatorPath.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__PATH:
return getPath();
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__FROM:
if (resolve) return getFrom();
return basicGetFrom();
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__TO:
if (resolve) return getTo();
return basicGetTo();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__FROM:
setFrom((GenCommonBase)newValue);
return;
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__TO:
setTo((GenCommonBase)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__FROM:
setFrom((GenCommonBase)null);
return;
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__TO:
setTo((GenCommonBase)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__PATH:
return getPath() != null;
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__FROM:
return from != null;
case GMFGenPackage.GEN_NAVIGATOR_PATH_SEGMENT__TO:
return to != null;
}
return super.eIsSet(featureID);
}
} //GenNavigatorPathSegmentImpl