/**
 * <copyright>
 * </copyright>
 *

 */
package jp.ac.jaist.kslab.e4.dsl.e4Dsl.impl;

import java.util.Collection;

import jp.ac.jaist.kslab.e4.dsl.e4Dsl.AbsMenu;
import jp.ac.jaist.kslab.e4.dsl.e4Dsl.AbsPart;
import jp.ac.jaist.kslab.e4.dsl.e4Dsl.E4DslPackage;
import jp.ac.jaist.kslab.e4.dsl.e4Dsl.ToolBar;
import jp.ac.jaist.kslab.e4.dsl.e4Dsl.TrimmedWindow;

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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Trimmed Window</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link jp.ac.jaist.kslab.e4.dsl.e4Dsl.impl.TrimmedWindowImpl#getParts <em>Parts</em>}</li>
 *   <li>{@link jp.ac.jaist.kslab.e4.dsl.e4Dsl.impl.TrimmedWindowImpl#getMenu <em>Menu</em>}</li>
 *   <li>{@link jp.ac.jaist.kslab.e4.dsl.e4Dsl.impl.TrimmedWindowImpl#getToolbars <em>Toolbars</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TrimmedWindowImpl extends AbsWindowImpl implements TrimmedWindow
{
  /**
   * The cached value of the '{@link #getParts() <em>Parts</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getParts()
   * @generated
   * @ordered
   */
  protected EList<AbsPart> parts;

  /**
   * The cached value of the '{@link #getMenu() <em>Menu</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMenu()
   * @generated
   * @ordered
   */
  protected EList<AbsMenu> menu;

  /**
   * The cached value of the '{@link #getToolbars() <em>Toolbars</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getToolbars()
   * @generated
   * @ordered
   */
  protected EList<ToolBar> toolbars;

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<AbsPart> getParts()
  {
    if (parts == null)
    {
      parts = new EObjectContainmentEList<AbsPart>(AbsPart.class, this, E4DslPackage.TRIMMED_WINDOW__PARTS);
    }
    return parts;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<AbsMenu> getMenu()
  {
    if (menu == null)
    {
      menu = new EObjectContainmentEList<AbsMenu>(AbsMenu.class, this, E4DslPackage.TRIMMED_WINDOW__MENU);
    }
    return menu;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<ToolBar> getToolbars()
  {
    if (toolbars == null)
    {
      toolbars = new EObjectContainmentEList<ToolBar>(ToolBar.class, this, E4DslPackage.TRIMMED_WINDOW__TOOLBARS);
    }
    return toolbars;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case E4DslPackage.TRIMMED_WINDOW__PARTS:
        return ((InternalEList<?>)getParts()).basicRemove(otherEnd, msgs);
      case E4DslPackage.TRIMMED_WINDOW__MENU:
        return ((InternalEList<?>)getMenu()).basicRemove(otherEnd, msgs);
      case E4DslPackage.TRIMMED_WINDOW__TOOLBARS:
        return ((InternalEList<?>)getToolbars()).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 E4DslPackage.TRIMMED_WINDOW__PARTS:
        return getParts();
      case E4DslPackage.TRIMMED_WINDOW__MENU:
        return getMenu();
      case E4DslPackage.TRIMMED_WINDOW__TOOLBARS:
        return getToolbars();
    }
    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 E4DslPackage.TRIMMED_WINDOW__PARTS:
        getParts().clear();
        getParts().addAll((Collection<? extends AbsPart>)newValue);
        return;
      case E4DslPackage.TRIMMED_WINDOW__MENU:
        getMenu().clear();
        getMenu().addAll((Collection<? extends AbsMenu>)newValue);
        return;
      case E4DslPackage.TRIMMED_WINDOW__TOOLBARS:
        getToolbars().clear();
        getToolbars().addAll((Collection<? extends ToolBar>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case E4DslPackage.TRIMMED_WINDOW__PARTS:
        getParts().clear();
        return;
      case E4DslPackage.TRIMMED_WINDOW__MENU:
        getMenu().clear();
        return;
      case E4DslPackage.TRIMMED_WINDOW__TOOLBARS:
        getToolbars().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case E4DslPackage.TRIMMED_WINDOW__PARTS:
        return parts != null && !parts.isEmpty();
      case E4DslPackage.TRIMMED_WINDOW__MENU:
        return menu != null && !menu.isEmpty();
      case E4DslPackage.TRIMMED_WINDOW__TOOLBARS:
        return toolbars != null && !toolbars.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //TrimmedWindowImpl
