/**
* <copyright>
* </copyright>
*
* $Id$
*/
package orgomg.cwm.resource.multidimensional.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 orgomg.cwm.objectmodel.instance.impl.ExtentImpl;
import orgomg.cwm.resource.multidimensional.Dimension;
import orgomg.cwm.resource.multidimensional.MemberSet;
import orgomg.cwm.resource.multidimensional.MultidimensionalPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Member Set</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link orgomg.cwm.resource.multidimensional.impl.MemberSetImpl#getDimension <em>Dimension</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class MemberSetImpl extends ExtentImpl implements MemberSet {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MemberSetImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return MultidimensionalPackage.Literals.MEMBER_SET;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Dimension getDimension() {
if (eContainerFeatureID() != MultidimensionalPackage.MEMBER_SET__DIMENSION) return null;
return (Dimension)eContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDimension(Dimension newDimension, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newDimension, MultidimensionalPackage.MEMBER_SET__DIMENSION, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDimension(Dimension newDimension) {
if (newDimension != eInternalContainer() || (eContainerFeatureID() != MultidimensionalPackage.MEMBER_SET__DIMENSION && newDimension != null)) {
if (EcoreUtil.isAncestor(this, newDimension))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newDimension != null)
msgs = ((InternalEObject)newDimension).eInverseAdd(this, MultidimensionalPackage.DIMENSION__MEMBER_SET, Dimension.class, msgs);
msgs = basicSetDimension(newDimension, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MultidimensionalPackage.MEMBER_SET__DIMENSION, newDimension, newDimension));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case MultidimensionalPackage.MEMBER_SET__DIMENSION:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetDimension((Dimension)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case MultidimensionalPackage.MEMBER_SET__DIMENSION:
return basicSetDimension(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case MultidimensionalPackage.MEMBER_SET__DIMENSION:
return eInternalContainer().eInverseRemove(this, MultidimensionalPackage.DIMENSION__MEMBER_SET, Dimension.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case MultidimensionalPackage.MEMBER_SET__DIMENSION:
return getDimension();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case MultidimensionalPackage.MEMBER_SET__DIMENSION:
setDimension((Dimension)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case MultidimensionalPackage.MEMBER_SET__DIMENSION:
setDimension((Dimension)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case MultidimensionalPackage.MEMBER_SET__DIMENSION:
return getDimension() != null;
}
return super.eIsSet(featureID);
}
} //MemberSetImpl