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

 */
package org.xtext.example.mydsl3.myDsl.impl;

import org.eclipse.emf.common.notify.Notification;

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.xtext.example.mydsl3.myDsl.Behaviour;
import org.xtext.example.mydsl3.myDsl.MyDslPackage;
import org.xtext.example.mydsl3.myDsl.Plan;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Behaviour</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl3.myDsl.impl.BehaviourImpl#getName <em>Name</em>}</li>
 *   <li>{@link org.xtext.example.mydsl3.myDsl.impl.BehaviourImpl#getResident <em>Resident</em>}</li>
 *   <li>{@link org.xtext.example.mydsl3.myDsl.impl.BehaviourImpl#getBeh <em>Beh</em>}</li>
 *   <li>{@link org.xtext.example.mydsl3.myDsl.impl.BehaviourImpl#getPlan <em>Plan</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BehaviourImpl extends MinimalEObjectImpl.Container implements Behaviour
{
  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * The default value of the '{@link #getResident() <em>Resident</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getResident()
   * @generated
   * @ordered
   */
  protected static final int RESİDENT_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getResident() <em>Resident</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getResident()
   * @generated
   * @ordered
   */
  protected int resident = RESİDENT_EDEFAULT;

  /**
   * The cached value of the '{@link #getBeh() <em>Beh</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBeh()
   * @generated
   * @ordered
   */
  protected Behaviour beh;

  /**
   * The cached value of the '{@link #getPlan() <em>Plan</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPlan()
   * @generated
   * @ordered
   */
  protected Plan plan;

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.BEHAVİOUR__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getResident()
  {
    return resident;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setResident(int newResident)
  {
    int oldResident = resident;
    resident = newResident;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.BEHAVİOUR__RESİDENT, oldResident, resident));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Behaviour getBeh()
  {
    if (beh != null && beh.eIsProxy())
    {
      InternalEObject oldBeh = (InternalEObject)beh;
      beh = (Behaviour)eResolveProxy(oldBeh);
      if (beh != oldBeh)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, MyDslPackage.BEHAVİOUR__BEH, oldBeh, beh));
      }
    }
    return beh;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Behaviour basicGetBeh()
  {
    return beh;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setBeh(Behaviour newBeh)
  {
    Behaviour oldBeh = beh;
    beh = newBeh;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.BEHAVİOUR__BEH, oldBeh, beh));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Plan getPlan()
  {
    if (plan != null && plan.eIsProxy())
    {
      InternalEObject oldPlan = (InternalEObject)plan;
      plan = (Plan)eResolveProxy(oldPlan);
      if (plan != oldPlan)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, MyDslPackage.BEHAVİOUR__PLAN, oldPlan, plan));
      }
    }
    return plan;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Plan basicGetPlan()
  {
    return plan;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPlan(Plan newPlan)
  {
    Plan oldPlan = plan;
    plan = newPlan;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.BEHAVİOUR__PLAN, oldPlan, plan));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.BEHAVİOUR__NAME:
        return getName();
      case MyDslPackage.BEHAVİOUR__RESİDENT:
        return getResident();
      case MyDslPackage.BEHAVİOUR__BEH:
        if (resolve) return getBeh();
        return basicGetBeh();
      case MyDslPackage.BEHAVİOUR__PLAN:
        if (resolve) return getPlan();
        return basicGetPlan();
    }
    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.BEHAVİOUR__NAME:
        setName((String)newValue);
        return;
      case MyDslPackage.BEHAVİOUR__RESİDENT:
        setResident((Integer)newValue);
        return;
      case MyDslPackage.BEHAVİOUR__BEH:
        setBeh((Behaviour)newValue);
        return;
      case MyDslPackage.BEHAVİOUR__PLAN:
        setPlan((Plan)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.BEHAVİOUR__NAME:
        setName(NAME_EDEFAULT);
        return;
      case MyDslPackage.BEHAVİOUR__RESİDENT:
        setResident(RESİDENT_EDEFAULT);
        return;
      case MyDslPackage.BEHAVİOUR__BEH:
        setBeh((Behaviour)null);
        return;
      case MyDslPackage.BEHAVİOUR__PLAN:
        setPlan((Plan)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.BEHAVİOUR__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
      case MyDslPackage.BEHAVİOUR__RESİDENT:
        return resident != RESİDENT_EDEFAULT;
      case MyDslPackage.BEHAVİOUR__BEH:
        return beh != null;
      case MyDslPackage.BEHAVİOUR__PLAN:
        return plan != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (name: ");
    result.append(name);
    result.append(", resident: ");
    result.append(resident);
    result.append(')');
    return result.toString();
  }

} //BehaviourImpl
