/**
*/
package org.eclipse.emf.mwe2.language.mwe2.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.MinimalEObjectImpl;
import org.eclipse.emf.mwe2.language.mwe2.Assignment;
import org.eclipse.emf.mwe2.language.mwe2.Mwe2Package;
import org.eclipse.emf.mwe2.language.mwe2.Value;
import org.eclipse.xtext.common.types.JvmIdentifiableElement;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Assignment</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.emf.mwe2.language.mwe2.impl.AssignmentImpl#getFeature <em>Feature</em>}</li>
* <li>{@link org.eclipse.emf.mwe2.language.mwe2.impl.AssignmentImpl#getValue <em>Value</em>}</li>
* <li>{@link org.eclipse.emf.mwe2.language.mwe2.impl.AssignmentImpl#getFeatureName <em>Feature Name</em>}</li>
* </ul>
*
* @generated
*/
public class AssignmentImpl extends MinimalEObjectImpl.Container implements Assignment
{
/**
* The cached value of the '{@link #getFeature() <em>Feature</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeature()
* @generated
* @ordered
*/
protected JvmIdentifiableElement feature;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected Value value;
/**
* The default value of the '{@link #getFeatureName() <em>Feature Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeatureName()
* @generated
* @ordered
*/
protected static final String FEATURE_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getFeatureName() <em>Feature Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeatureName()
* @generated
* @ordered
*/
protected String featureName = FEATURE_NAME_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AssignmentImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return Mwe2Package.Literals.ASSIGNMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JvmIdentifiableElement getFeature()
{
if (feature != null && feature.eIsProxy())
{
InternalEObject oldFeature = (InternalEObject)feature;
feature = (JvmIdentifiableElement)eResolveProxy(oldFeature);
if (feature != oldFeature)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, Mwe2Package.ASSIGNMENT__FEATURE, oldFeature, feature));
}
}
return feature;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JvmIdentifiableElement basicGetFeature()
{
return feature;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFeature(JvmIdentifiableElement newFeature)
{
JvmIdentifiableElement oldFeature = feature;
feature = newFeature;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Mwe2Package.ASSIGNMENT__FEATURE, oldFeature, feature));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Value getValue()
{
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetValue(Value newValue, NotificationChain msgs)
{
Value oldValue = value;
value = newValue;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Mwe2Package.ASSIGNMENT__VALUE, oldValue, newValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValue(Value newValue)
{
if (newValue != value)
{
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Mwe2Package.ASSIGNMENT__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Mwe2Package.ASSIGNMENT__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Mwe2Package.ASSIGNMENT__VALUE, newValue, newValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFeatureName()
{
return featureName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case Mwe2Package.ASSIGNMENT__VALUE:
return basicSetValue(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 Mwe2Package.ASSIGNMENT__FEATURE:
if (resolve) return getFeature();
return basicGetFeature();
case Mwe2Package.ASSIGNMENT__VALUE:
return getValue();
case Mwe2Package.ASSIGNMENT__FEATURE_NAME:
return getFeatureName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case Mwe2Package.ASSIGNMENT__FEATURE:
setFeature((JvmIdentifiableElement)newValue);
return;
case Mwe2Package.ASSIGNMENT__VALUE:
setValue((Value)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case Mwe2Package.ASSIGNMENT__FEATURE:
setFeature((JvmIdentifiableElement)null);
return;
case Mwe2Package.ASSIGNMENT__VALUE:
setValue((Value)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case Mwe2Package.ASSIGNMENT__FEATURE:
return feature != null;
case Mwe2Package.ASSIGNMENT__VALUE:
return value != null;
case Mwe2Package.ASSIGNMENT__FEATURE_NAME:
return FEATURE_NAME_EDEFAULT == null ? featureName != null : !FEATURE_NAME_EDEFAULT.equals(featureName);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (featureName: ");
result.append(featureName);
result.append(')');
return result.toString();
}
} //AssignmentImpl