/**
*/
package at.bestsolution.efxclipse.tooling.efxbean.fXBean.impl;
import at.bestsolution.efxclipse.tooling.efxbean.fXBean.Bean;
import at.bestsolution.efxclipse.tooling.efxbean.fXBean.FXBeanPackage;
import at.bestsolution.efxclipse.tooling.efxbean.fXBean.FXBeanUnit;
import at.bestsolution.efxclipse.tooling.efxbean.fXBean.Import;
import at.bestsolution.efxclipse.tooling.efxbean.fXBean.PackageDeclaration;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
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.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Unit</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link at.bestsolution.efxclipse.tooling.efxbean.fXBean.impl.FXBeanUnitImpl#getPackage <em>Package</em>}</li>
* <li>{@link at.bestsolution.efxclipse.tooling.efxbean.fXBean.impl.FXBeanUnitImpl#getImports <em>Imports</em>}</li>
* <li>{@link at.bestsolution.efxclipse.tooling.efxbean.fXBean.impl.FXBeanUnitImpl#getBean <em>Bean</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class FXBeanUnitImpl extends MinimalEObjectImpl.Container implements FXBeanUnit
{
/**
* The cached value of the '{@link #getPackage() <em>Package</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPackage()
* @generated
* @ordered
*/
protected PackageDeclaration package_;
/**
* The cached value of the '{@link #getImports() <em>Imports</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getImports()
* @generated
* @ordered
*/
protected EList<Import> imports;
/**
* The cached value of the '{@link #getBean() <em>Bean</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBean()
* @generated
* @ordered
*/
protected Bean bean;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected FXBeanUnitImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return FXBeanPackage.Literals.FX_BEAN_UNIT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PackageDeclaration getPackage()
{
return package_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetPackage(PackageDeclaration newPackage, NotificationChain msgs)
{
PackageDeclaration oldPackage = package_;
package_ = newPackage;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FXBeanPackage.FX_BEAN_UNIT__PACKAGE, oldPackage, newPackage);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPackage(PackageDeclaration newPackage)
{
if (newPackage != package_)
{
NotificationChain msgs = null;
if (package_ != null)
msgs = ((InternalEObject)package_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FXBeanPackage.FX_BEAN_UNIT__PACKAGE, null, msgs);
if (newPackage != null)
msgs = ((InternalEObject)newPackage).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FXBeanPackage.FX_BEAN_UNIT__PACKAGE, null, msgs);
msgs = basicSetPackage(newPackage, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FXBeanPackage.FX_BEAN_UNIT__PACKAGE, newPackage, newPackage));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Import> getImports()
{
if (imports == null)
{
imports = new EObjectContainmentEList<Import>(Import.class, this, FXBeanPackage.FX_BEAN_UNIT__IMPORTS);
}
return imports;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Bean getBean()
{
return bean;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetBean(Bean newBean, NotificationChain msgs)
{
Bean oldBean = bean;
bean = newBean;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FXBeanPackage.FX_BEAN_UNIT__BEAN, oldBean, newBean);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBean(Bean newBean)
{
if (newBean != bean)
{
NotificationChain msgs = null;
if (bean != null)
msgs = ((InternalEObject)bean).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FXBeanPackage.FX_BEAN_UNIT__BEAN, null, msgs);
if (newBean != null)
msgs = ((InternalEObject)newBean).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FXBeanPackage.FX_BEAN_UNIT__BEAN, null, msgs);
msgs = basicSetBean(newBean, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FXBeanPackage.FX_BEAN_UNIT__BEAN, newBean, newBean));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case FXBeanPackage.FX_BEAN_UNIT__PACKAGE:
return basicSetPackage(null, msgs);
case FXBeanPackage.FX_BEAN_UNIT__IMPORTS:
return ((InternalEList<?>)getImports()).basicRemove(otherEnd, msgs);
case FXBeanPackage.FX_BEAN_UNIT__BEAN:
return basicSetBean(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 FXBeanPackage.FX_BEAN_UNIT__PACKAGE:
return getPackage();
case FXBeanPackage.FX_BEAN_UNIT__IMPORTS:
return getImports();
case FXBeanPackage.FX_BEAN_UNIT__BEAN:
return getBean();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case FXBeanPackage.FX_BEAN_UNIT__PACKAGE:
setPackage((PackageDeclaration)newValue);
return;
case FXBeanPackage.FX_BEAN_UNIT__IMPORTS:
getImports().clear();
getImports().addAll((Collection<? extends Import>)newValue);
return;
case FXBeanPackage.FX_BEAN_UNIT__BEAN:
setBean((Bean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case FXBeanPackage.FX_BEAN_UNIT__PACKAGE:
setPackage((PackageDeclaration)null);
return;
case FXBeanPackage.FX_BEAN_UNIT__IMPORTS:
getImports().clear();
return;
case FXBeanPackage.FX_BEAN_UNIT__BEAN:
setBean((Bean)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case FXBeanPackage.FX_BEAN_UNIT__PACKAGE:
return package_ != null;
case FXBeanPackage.FX_BEAN_UNIT__IMPORTS:
return imports != null && !imports.isEmpty();
case FXBeanPackage.FX_BEAN_UNIT__BEAN:
return bean != null;
}
return super.eIsSet(featureID);
}
} //FXBeanUnitImpl