/**
 */
package org.xtext.example.mydsl.myDsl.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.xtext.example.mydsl.myDsl.ContentModel;
import org.xtext.example.mydsl.myDsl.MyDslPackage;
import org.xtext.example.mydsl.myDsl.Web;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Content Model</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.ContentModelImpl#getOwnedWeb <em>Owned Web</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ContentModelImpl extends ContentUnitImpl implements ContentModel
{
  /**
   * The cached value of the '{@link #getOwnedWeb() <em>Owned Web</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getOwnedWeb()
   * @generated
   * @ordered
   */
  protected Web ownedWeb;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ContentModelImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MyDslPackage.Literals.CONTENT_MODEL;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Web getOwnedWeb()
  {
    return ownedWeb;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetOwnedWeb(Web newOwnedWeb, NotificationChain msgs)
  {
    Web oldOwnedWeb = ownedWeb;
    ownedWeb = newOwnedWeb;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDslPackage.CONTENT_MODEL__OWNED_WEB, oldOwnedWeb, newOwnedWeb);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setOwnedWeb(Web newOwnedWeb)
  {
    if (newOwnedWeb != ownedWeb)
    {
      NotificationChain msgs = null;
      if (ownedWeb != null)
        msgs = ((InternalEObject)ownedWeb).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.CONTENT_MODEL__OWNED_WEB, null, msgs);
      if (newOwnedWeb != null)
        msgs = ((InternalEObject)newOwnedWeb).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.CONTENT_MODEL__OWNED_WEB, null, msgs);
      msgs = basicSetOwnedWeb(newOwnedWeb, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.CONTENT_MODEL__OWNED_WEB, newOwnedWeb, newOwnedWeb));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MyDslPackage.CONTENT_MODEL__OWNED_WEB:
        return basicSetOwnedWeb(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 MyDslPackage.CONTENT_MODEL__OWNED_WEB:
        return getOwnedWeb();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MyDslPackage.CONTENT_MODEL__OWNED_WEB:
        setOwnedWeb((Web)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.CONTENT_MODEL__OWNED_WEB:
        setOwnedWeb((Web)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.CONTENT_MODEL__OWNED_WEB:
        return ownedWeb != null;
    }
    return super.eIsSet(featureID);
  }

} //ContentModelImpl
