/**
*/
package org.xtest.xTest.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.xtend.core.xtend.XtendFunction;
import org.eclipse.xtext.xbase.impl.XExpressionImpl;
import org.xtest.xTest.XMethodDefExpression;
import org.xtest.xTest.XTestPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>XMethod Def Expression</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.xtest.xTest.impl.XMethodDefExpressionImpl#getMethod <em>Method</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class XMethodDefExpressionImpl extends XExpressionImpl implements XMethodDefExpression
{
/**
* The cached value of the '{@link #getMethod() <em>Method</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMethod()
* @generated
* @ordered
*/
protected XtendFunction method;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected XMethodDefExpressionImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return XTestPackage.Literals.XMETHOD_DEF_EXPRESSION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public XtendFunction getMethod()
{
return method;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetMethod(XtendFunction newMethod, NotificationChain msgs)
{
XtendFunction oldMethod = method;
method = newMethod;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XTestPackage.XMETHOD_DEF_EXPRESSION__METHOD, oldMethod, newMethod);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMethod(XtendFunction newMethod)
{
if (newMethod != method)
{
NotificationChain msgs = null;
if (method != null)
msgs = ((InternalEObject)method).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XTestPackage.XMETHOD_DEF_EXPRESSION__METHOD, null, msgs);
if (newMethod != null)
msgs = ((InternalEObject)newMethod).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XTestPackage.XMETHOD_DEF_EXPRESSION__METHOD, null, msgs);
msgs = basicSetMethod(newMethod, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XTestPackage.XMETHOD_DEF_EXPRESSION__METHOD, newMethod, newMethod));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XTestPackage.XMETHOD_DEF_EXPRESSION__METHOD:
return basicSetMethod(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 XTestPackage.XMETHOD_DEF_EXPRESSION__METHOD:
return getMethod();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case XTestPackage.XMETHOD_DEF_EXPRESSION__METHOD:
setMethod((XtendFunction)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XTestPackage.XMETHOD_DEF_EXPRESSION__METHOD:
setMethod((XtendFunction)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XTestPackage.XMETHOD_DEF_EXPRESSION__METHOD:
return method != null;
}
return super.eIsSet(featureID);
}
} //XMethodDefExpressionImpl