/**
 * generated by Xtext 2.26.0
 */
package org.xtext.example.mydsl.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.xtext.example.mydsl.myDsl.AtomicTask;
import org.xtext.example.mydsl.myDsl.Location;
import org.xtext.example.mydsl.myDsl.MyDslPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Atomic Task</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.AtomicTaskImpl#getRobots <em>Robots</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.AtomicTaskImpl#getLoc <em>Loc</em>}</li>
 * </ul>
 *
 * @generated
 */
public class AtomicTaskImpl extends TasksModelImpl implements AtomicTask
{
  /**
   * The default value of the '{@link #getRobots() <em>Robots</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRobots()
   * @generated
   * @ordered
   */
  protected static final int ROBOTS_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getRobots() <em>Robots</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRobots()
   * @generated
   * @ordered
   */
  protected int robots = ROBOTS_EDEFAULT;

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

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

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setRobots(int newRobots)
  {
    int oldRobots = robots;
    robots = newRobots;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.ATOMIC_TASK__ROBOTS, oldRobots, robots));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Location getLoc()
  {
    if (loc != null && loc.eIsProxy())
    {
      InternalEObject oldLoc = (InternalEObject)loc;
      loc = (Location)eResolveProxy(oldLoc);
      if (loc != oldLoc)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, MyDslPackage.ATOMIC_TASK__LOC, oldLoc, loc));
      }
    }
    return loc;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Location basicGetLoc()
  {
    return loc;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setLoc(Location newLoc)
  {
    Location oldLoc = loc;
    loc = newLoc;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.ATOMIC_TASK__LOC, oldLoc, loc));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.ATOMIC_TASK__ROBOTS:
        return getRobots();
      case MyDslPackage.ATOMIC_TASK__LOC:
        if (resolve) return getLoc();
        return basicGetLoc();
    }
    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.ATOMIC_TASK__ROBOTS:
        setRobots((Integer)newValue);
        return;
      case MyDslPackage.ATOMIC_TASK__LOC:
        setLoc((Location)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.ATOMIC_TASK__ROBOTS:
        setRobots(ROBOTS_EDEFAULT);
        return;
      case MyDslPackage.ATOMIC_TASK__LOC:
        setLoc((Location)null);
        return;
    }
    super.eUnset(featureID);
  }

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

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

    StringBuilder result = new StringBuilder(super.toString());
    result.append(" (robots: ");
    result.append(robots);
    result.append(')');
    return result.toString();
  }

} //AtomicTaskImpl
