/**
 */
package org.xtext.example.mydsl6.myDsl6.impl;

import java.util.Collection;

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;

import org.xtext.example.mydsl6.myDsl6.Function;
import org.xtext.example.mydsl6.myDsl6.Method;
import org.xtext.example.mydsl6.myDsl6.MyDsl6Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Method</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl6.myDsl6.impl.MethodImpl#getList <em>List</em>}</li>
 *   <li>{@link org.xtext.example.mydsl6.myDsl6.impl.MethodImpl#getOwnmethod <em>Ownmethod</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MethodImpl extends ContentextUnitImpl implements Method
{
  /**
   * The cached value of the '{@link #getList() <em>List</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getList()
   * @generated
   * @ordered
   */
  protected EList<Function> list;

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

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Function> getList()
  {
    if (list == null)
    {
      list = new EObjectContainmentEList<Function>(Function.class, this, MyDsl6Package.METHOD__LIST);
    }
    return list;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Method> getOwnmethod()
  {
    if (ownmethod == null)
    {
      ownmethod = new EObjectContainmentEList<Method>(Method.class, this, MyDsl6Package.METHOD__OWNMETHOD);
    }
    return ownmethod;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MyDsl6Package.METHOD__LIST:
        return ((InternalEList<?>)getList()).basicRemove(otherEnd, msgs);
      case MyDsl6Package.METHOD__OWNMETHOD:
        return ((InternalEList<?>)getOwnmethod()).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 MyDsl6Package.METHOD__LIST:
        return getList();
      case MyDsl6Package.METHOD__OWNMETHOD:
        return getOwnmethod();
    }
    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 MyDsl6Package.METHOD__LIST:
        getList().clear();
        getList().addAll((Collection<? extends Function>)newValue);
        return;
      case MyDsl6Package.METHOD__OWNMETHOD:
        getOwnmethod().clear();
        getOwnmethod().addAll((Collection<? extends Method>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDsl6Package.METHOD__LIST:
        getList().clear();
        return;
      case MyDsl6Package.METHOD__OWNMETHOD:
        getOwnmethod().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDsl6Package.METHOD__LIST:
        return list != null && !list.isEmpty();
      case MyDsl6Package.METHOD__OWNMETHOD:
        return ownmethod != null && !ownmethod.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //MethodImpl
