/**
 * 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.Location;
import org.xtext.example.mydsl.myDsl.MyDslPackage;
import org.xtext.example.mydsl.myDsl.Paths;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Paths</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.PathsImpl#getLoc1 <em>Loc1</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.PathsImpl#getLoc2 <em>Loc2</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.PathsImpl#getDistance <em>Distance</em>}</li>
 * </ul>
 *
 * @generated
 */
public class PathsImpl extends WorldModelImpl implements Paths
{
  /**
   * The cached value of the '{@link #getLoc1() <em>Loc1</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLoc1()
   * @generated
   * @ordered
   */
  protected Location loc1;

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

  /**
   * The default value of the '{@link #getDistance() <em>Distance</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDistance()
   * @generated
   * @ordered
   */
  protected static final double DISTANCE_EDEFAULT = 0.0;

  /**
   * The cached value of the '{@link #getDistance() <em>Distance</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDistance()
   * @generated
   * @ordered
   */
  protected double distance = DISTANCE_EDEFAULT;

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

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

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setLoc1(Location newLoc1)
  {
    Location oldLoc1 = loc1;
    loc1 = newLoc1;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.PATHS__LOC1, oldLoc1, loc1));
  }

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setLoc2(Location newLoc2)
  {
    Location oldLoc2 = loc2;
    loc2 = newLoc2;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.PATHS__LOC2, oldLoc2, loc2));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public double getDistance()
  {
    return distance;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setDistance(double newDistance)
  {
    double oldDistance = distance;
    distance = newDistance;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.PATHS__DISTANCE, oldDistance, distance));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.PATHS__LOC1:
        if (resolve) return getLoc1();
        return basicGetLoc1();
      case MyDslPackage.PATHS__LOC2:
        if (resolve) return getLoc2();
        return basicGetLoc2();
      case MyDslPackage.PATHS__DISTANCE:
        return getDistance();
    }
    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.PATHS__LOC1:
        setLoc1((Location)newValue);
        return;
      case MyDslPackage.PATHS__LOC2:
        setLoc2((Location)newValue);
        return;
      case MyDslPackage.PATHS__DISTANCE:
        setDistance((Double)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.PATHS__LOC1:
        setLoc1((Location)null);
        return;
      case MyDslPackage.PATHS__LOC2:
        setLoc2((Location)null);
        return;
      case MyDslPackage.PATHS__DISTANCE:
        setDistance(DISTANCE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.PATHS__LOC1:
        return loc1 != null;
      case MyDslPackage.PATHS__LOC2:
        return loc2 != null;
      case MyDslPackage.PATHS__DISTANCE:
        return distance != DISTANCE_EDEFAULT;
    }
    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(" (distance: ");
    result.append(distance);
    result.append(')');
    return result.toString();
  }

} //PathsImpl
