/**
*/
package rba.core.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.util.EcoreUtil;
import rba.core.Content;
import rba.core.ContentState;
import rba.core.Expression;
import rba.core.RBACorePackage;
/**
* An implementation of the model object 'Content State'.
*
* The following features are implemented:
*
*
* - {@link rba.core.impl.ContentStateImpl#getValue Value}
* - {@link rba.core.impl.ContentStateImpl#getOwner Owner}
*
*
* @generated
*/
public abstract class ContentStateImpl extends RuleObjectImpl implements ContentState {
/**
* The cached value of the '{@link #getValue() Value}' containment reference.
*
* @see #getValue()
* @generated
* @ordered
*/
protected Expression value;
/**
*
* @generated
*/
protected ContentStateImpl() {
super();
}
/**
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return RBACorePackage.Literals.CONTENT_STATE;
}
/**
*
* @generated
*/
public Expression getValue() {
return value;
}
/**
*
* @generated
*/
public NotificationChain basicSetValue(Expression newValue, NotificationChain msgs) {
Expression oldValue = value;
value = newValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
RBACorePackage.CONTENT_STATE__VALUE, oldValue, newValue);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
* @generated
*/
public void setValue(Expression newValue) {
if (newValue != value) {
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject) value).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - RBACorePackage.CONTENT_STATE__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject) newValue).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - RBACorePackage.CONTENT_STATE__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RBACorePackage.CONTENT_STATE__VALUE, newValue,
newValue));
}
/**
*
* @generated
*/
public Content getOwner() {
if (eContainerFeatureID() != RBACorePackage.CONTENT_STATE__OWNER)
return null;
return (Content) eInternalContainer();
}
/**
*
* @generated
*/
public NotificationChain basicSetOwner(Content newOwner, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject) newOwner, RBACorePackage.CONTENT_STATE__OWNER, msgs);
return msgs;
}
/**
*
* @generated
*/
public void setOwner(Content newOwner) {
if (newOwner != eInternalContainer()
|| (eContainerFeatureID() != RBACorePackage.CONTENT_STATE__OWNER && newOwner != null)) {
if (EcoreUtil.isAncestor(this, newOwner))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newOwner != null)
msgs = ((InternalEObject) newOwner).eInverseAdd(this, RBACorePackage.CONTENT__STATES, Content.class,
msgs);
msgs = basicSetOwner(newOwner, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RBACorePackage.CONTENT_STATE__OWNER, newOwner,
newOwner));
}
/**
*
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case RBACorePackage.CONTENT_STATE__OWNER:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetOwner((Content) otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case RBACorePackage.CONTENT_STATE__VALUE:
return basicSetValue(null, msgs);
case RBACorePackage.CONTENT_STATE__OWNER:
return basicSetOwner(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case RBACorePackage.CONTENT_STATE__OWNER:
return eInternalContainer().eInverseRemove(this, RBACorePackage.CONTENT__STATES, Content.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case RBACorePackage.CONTENT_STATE__VALUE:
return getValue();
case RBACorePackage.CONTENT_STATE__OWNER:
return getOwner();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case RBACorePackage.CONTENT_STATE__VALUE:
setValue((Expression) newValue);
return;
case RBACorePackage.CONTENT_STATE__OWNER:
setOwner((Content) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case RBACorePackage.CONTENT_STATE__VALUE:
setValue((Expression) null);
return;
case RBACorePackage.CONTENT_STATE__OWNER:
setOwner((Content) null);
return;
}
super.eUnset(featureID);
}
/**
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case RBACorePackage.CONTENT_STATE__VALUE:
return value != null;
case RBACorePackage.CONTENT_STATE__OWNER:
return getOwner() != null;
}
return super.eIsSet(featureID);
}
} // ContentStateImpl