/**
 */
package org.xtext.example.mydsl6.myDsl6.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.mydsl6.myDsl6.Collection;
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>Collection</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl6.myDsl6.impl.CollectionImpl#getOwnmethod <em>Ownmethod</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class CollectionImpl extends ContentextUnitImpl implements Collection
{
  /**
   * The cached value of the '{@link #getOwnmethod() <em>Ownmethod</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getOwnmethod()
   * @generated
   * @ordered
   */
  protected Method ownmethod;

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Method getOwnmethod()
  {
    return ownmethod;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetOwnmethod(Method newOwnmethod, NotificationChain msgs)
  {
    Method oldOwnmethod = ownmethod;
    ownmethod = newOwnmethod;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDsl6Package.COLLECTION__OWNMETHOD, oldOwnmethod, newOwnmethod);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setOwnmethod(Method newOwnmethod)
  {
    if (newOwnmethod != ownmethod)
    {
      NotificationChain msgs = null;
      if (ownmethod != null)
        msgs = ((InternalEObject)ownmethod).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDsl6Package.COLLECTION__OWNMETHOD, null, msgs);
      if (newOwnmethod != null)
        msgs = ((InternalEObject)newOwnmethod).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDsl6Package.COLLECTION__OWNMETHOD, null, msgs);
      msgs = basicSetOwnmethod(newOwnmethod, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDsl6Package.COLLECTION__OWNMETHOD, newOwnmethod, newOwnmethod));
  }

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDsl6Package.COLLECTION__OWNMETHOD:
        setOwnmethod((Method)null);
        return;
    }
    super.eUnset(featureID);
  }

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

} //CollectionImpl
