/**
* <copyright>
* </copyright>
*
* $Id$
*/
package net.atos.optimus.emf.metamodels.properties.impl;
import net.atos.optimus.emf.metamodels.properties.Content;
import net.atos.optimus.emf.metamodels.properties.Properties;
import net.atos.optimus.emf.metamodels.properties.PropertiesPackage;
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.EObjectImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Content</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.atos.optimus.emf.metamodels.properties.impl.ContentImpl#getProperties <em>Properties</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ContentImpl extends EObjectImpl implements Content {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ContentImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PropertiesPackage.Literals.CONTENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Properties getProperties() {
if (eContainerFeatureID() != PropertiesPackage.CONTENT__PROPERTIES) return null;
return (Properties)eContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetProperties(Properties newProperties, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newProperties, PropertiesPackage.CONTENT__PROPERTIES, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setProperties(Properties newProperties) {
if (newProperties != eInternalContainer() || (eContainerFeatureID() != PropertiesPackage.CONTENT__PROPERTIES && newProperties != null)) {
if (EcoreUtil.isAncestor(this, newProperties))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newProperties != null)
msgs = ((InternalEObject)newProperties).eInverseAdd(this, PropertiesPackage.PROPERTIES__CONTENTS, Properties.class, msgs);
msgs = basicSetProperties(newProperties, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PropertiesPackage.CONTENT__PROPERTIES, newProperties, newProperties));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PropertiesPackage.CONTENT__PROPERTIES:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetProperties((Properties)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 PropertiesPackage.CONTENT__PROPERTIES:
return basicSetProperties(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case PropertiesPackage.CONTENT__PROPERTIES:
return eInternalContainer().eInverseRemove(this, PropertiesPackage.PROPERTIES__CONTENTS, Properties.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 PropertiesPackage.CONTENT__PROPERTIES:
return getProperties();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PropertiesPackage.CONTENT__PROPERTIES:
setProperties((Properties)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PropertiesPackage.CONTENT__PROPERTIES:
setProperties((Properties)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PropertiesPackage.CONTENT__PROPERTIES:
return getProperties() != null;
}
return super.eIsSet(featureID);
}
} //ContentImpl