/**
*/
package fr.tpt.mem4csd.loss.impl;
import fr.tpt.mem4csd.loss.LossPackage;
import fr.tpt.mem4csd.loss.Primitive;
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.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
*
* An implementation of the model object 'Primitive'.
*
*
* The following features are implemented:
*
*
* - {@link fr.tpt.mem4csd.loss.impl.PrimitiveImpl#getType Type}
*
*
* @generated
*/
public class PrimitiveImpl extends NamedObjectImpl implements Primitive {
/**
* The cached value of the '{@link #getType() Type}' containment reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected EObject type;
/**
*
*
* @generated
*/
protected PrimitiveImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return LossPackage.Literals.PRIMITIVE;
}
/**
*
*
* @generated
*/
@Override
public EObject getType() {
return type;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetType(EObject newType, NotificationChain msgs) {
EObject oldType = type;
type = newType;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LossPackage.PRIMITIVE__TYPE,
oldType, newType);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setType(EObject newType) {
if (newType != type) {
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject) type).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - LossPackage.PRIMITIVE__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject) newType).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - LossPackage.PRIMITIVE__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LossPackage.PRIMITIVE__TYPE, newType, newType));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case LossPackage.PRIMITIVE__TYPE:
return basicSetType(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case LossPackage.PRIMITIVE__TYPE:
return getType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case LossPackage.PRIMITIVE__TYPE:
setType((EObject) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LossPackage.PRIMITIVE__TYPE:
setType((EObject) null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LossPackage.PRIMITIVE__TYPE:
return type != null;
}
return super.eIsSet(featureID);
}
} //PrimitiveImpl