/**
*/
package de.gebit.integrity.dsl.impl;
import de.gebit.integrity.dsl.DslPackage;
import de.gebit.integrity.dsl.JavaConstantReference;
import de.gebit.integrity.dsl.JavaConstantValue;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Java Constant Value</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link de.gebit.integrity.dsl.impl.JavaConstantValueImpl#getConstant <em>Constant</em>}</li>
* </ul>
*
* @generated
*/
public class JavaConstantValueImpl extends StaticValueImpl implements JavaConstantValue
{
/**
* The cached value of the '{@link #getConstant() <em>Constant</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConstant()
* @generated
* @ordered
*/
protected JavaConstantReference constant;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected JavaConstantValueImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return DslPackage.Literals.JAVA_CONSTANT_VALUE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JavaConstantReference getConstant()
{
return constant;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetConstant(JavaConstantReference newConstant, NotificationChain msgs)
{
JavaConstantReference oldConstant = constant;
constant = newConstant;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DslPackage.JAVA_CONSTANT_VALUE__CONSTANT, oldConstant, newConstant);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setConstant(JavaConstantReference newConstant)
{
if (newConstant != constant)
{
NotificationChain msgs = null;
if (constant != null)
msgs = ((InternalEObject)constant).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DslPackage.JAVA_CONSTANT_VALUE__CONSTANT, null, msgs);
if (newConstant != null)
msgs = ((InternalEObject)newConstant).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DslPackage.JAVA_CONSTANT_VALUE__CONSTANT, null, msgs);
msgs = basicSetConstant(newConstant, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.JAVA_CONSTANT_VALUE__CONSTANT, newConstant, newConstant));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case DslPackage.JAVA_CONSTANT_VALUE__CONSTANT:
return basicSetConstant(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 DslPackage.JAVA_CONSTANT_VALUE__CONSTANT:
return getConstant();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case DslPackage.JAVA_CONSTANT_VALUE__CONSTANT:
setConstant((JavaConstantReference)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case DslPackage.JAVA_CONSTANT_VALUE__CONSTANT:
setConstant((JavaConstantReference)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case DslPackage.JAVA_CONSTANT_VALUE__CONSTANT:
return constant != null;
}
return super.eIsSet(featureID);
}
} //JavaConstantValueImpl