/**
* <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.CmslPackage;
import org.reuseware.air.language.cmsl.NonTerminal;
import org.reuseware.air.language.cmsl.UpperLevelReference;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Upper Level Reference</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.reuseware.air.language.cmsl.impl.UpperLevelReferenceImpl#getUpper <em>Upper</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class UpperLevelReferenceImpl extends EObjectImpl implements UpperLevelReference {
/**
* The cached value of the '{@link #getUpper() <em>Upper</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUpper()
* @generated
* @ordered
*/
protected NonTerminal upper;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected UpperLevelReferenceImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return CmslPackage.Literals.UPPER_LEVEL_REFERENCE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NonTerminal getUpper() {
return upper;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetUpper(NonTerminal newUpper, NotificationChain msgs) {
NonTerminal oldUpper = upper;
upper = newUpper;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CmslPackage.UPPER_LEVEL_REFERENCE__UPPER, oldUpper, newUpper);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUpper(NonTerminal newUpper) {
if (newUpper != upper)
{
NotificationChain msgs = null;
if (upper != null)
msgs = ((InternalEObject)upper).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CmslPackage.UPPER_LEVEL_REFERENCE__UPPER, null, msgs);
if (newUpper != null)
msgs = ((InternalEObject)newUpper).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CmslPackage.UPPER_LEVEL_REFERENCE__UPPER, null, msgs);
msgs = basicSetUpper(newUpper, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CmslPackage.UPPER_LEVEL_REFERENCE__UPPER, newUpper, newUpper));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID)
{
case CmslPackage.UPPER_LEVEL_REFERENCE__UPPER:
return basicSetUpper(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.UPPER_LEVEL_REFERENCE__UPPER:
return getUpper();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID)
{
case CmslPackage.UPPER_LEVEL_REFERENCE__UPPER:
setUpper((NonTerminal)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID)
{
case CmslPackage.UPPER_LEVEL_REFERENCE__UPPER:
setUpper((NonTerminal)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID)
{
case CmslPackage.UPPER_LEVEL_REFERENCE__UPPER:
return upper != null;
}
return super.eIsSet(featureID);
}
} //UpperLevelReferenceImpl