/** */ package org.example.xbase.entities.entities.impl; 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; import org.eclipse.xtext.xtype.XImportSection; import org.example.xbase.entities.entities.EntitiesPackage; import org.example.xbase.entities.entities.Entity; import org.example.xbase.entities.entities.Model; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Model</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.example.xbase.entities.entities.impl.ModelImpl#getImportSection <em>Import Section</em>}</li> * <li>{@link org.example.xbase.entities.entities.impl.ModelImpl#getEntities <em>Entities</em>}</li> * </ul> * </p> * * @generated */ public class ModelImpl extends MinimalEObjectImpl.Container implements Model { /** * The cached value of the '{@link #getImportSection() <em>Import Section</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getImportSection() * @generated * @ordered */ protected XImportSection importSection; /** * The cached value of the '{@link #getEntities() <em>Entities</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEntities() * @generated * @ordered */ protected EList<Entity> entities; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ModelImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return EntitiesPackage.Literals.MODEL; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public XImportSection getImportSection() { return importSection; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetImportSection(XImportSection newImportSection, NotificationChain msgs) { XImportSection oldImportSection = importSection; importSection = newImportSection; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntitiesPackage.MODEL__IMPORT_SECTION, oldImportSection, newImportSection); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setImportSection(XImportSection newImportSection) { if (newImportSection != importSection) { NotificationChain msgs = null; if (importSection != null) msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.MODEL__IMPORT_SECTION, null, msgs); if (newImportSection != null) msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.MODEL__IMPORT_SECTION, null, msgs); msgs = basicSetImportSection(newImportSection, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EntitiesPackage.MODEL__IMPORT_SECTION, newImportSection, newImportSection)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Entity> getEntities() { if (entities == null) { entities = new EObjectContainmentEList<Entity>(Entity.class, this, EntitiesPackage.MODEL__ENTITIES); } return entities; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case EntitiesPackage.MODEL__IMPORT_SECTION: return basicSetImportSection(null, msgs); case EntitiesPackage.MODEL__ENTITIES: return ((InternalEList<?>)getEntities()).basicRemove(otherEnd, 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 EntitiesPackage.MODEL__IMPORT_SECTION: return getImportSection(); case EntitiesPackage.MODEL__ENTITIES: return getEntities(); } 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 EntitiesPackage.MODEL__IMPORT_SECTION: setImportSection((XImportSection)newValue); return; case EntitiesPackage.MODEL__ENTITIES: getEntities().clear(); getEntities().addAll((Collection<? extends Entity>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case EntitiesPackage.MODEL__IMPORT_SECTION: setImportSection((XImportSection)null); return; case EntitiesPackage.MODEL__ENTITIES: getEntities().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case EntitiesPackage.MODEL__IMPORT_SECTION: return importSection != null; case EntitiesPackage.MODEL__ENTITIES: return entities != null && !entities.isEmpty(); } return super.eIsSet(featureID); } } //ModelImpl