/**
 * generated by Xtext 2.16.0
 */
package be.uantwerpen.cosys.contractLang.impl;

import be.uantwerpen.cosys.contractLang.AndExpression;
import be.uantwerpen.cosys.contractLang.ContractLangPackage;
import be.uantwerpen.cosys.contractLang.Expression;

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;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>And Expression</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link be.uantwerpen.cosys.contractLang.impl.AndExpressionImpl#getArg0 <em>Arg0</em>}</li>
 *   <li>{@link be.uantwerpen.cosys.contractLang.impl.AndExpressionImpl#getArg1 <em>Arg1</em>}</li>
 * </ul>
 *
 * @generated
 */
public class AndExpressionImpl extends ExpressionImpl implements AndExpression
{
  /**
   * The cached value of the '{@link #getArg0() <em>Arg0</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getArg0()
   * @generated
   * @ordered
   */
  protected Expression arg0;

  /**
   * The cached value of the '{@link #getArg1() <em>Arg1</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getArg1()
   * @generated
   * @ordered
   */
  protected Expression arg1;

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Expression getArg0()
  {
    return arg0;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetArg0(Expression newArg0, NotificationChain msgs)
  {
    Expression oldArg0 = arg0;
    arg0 = newArg0;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContractLangPackage.AND_EXPRESSION__ARG0, oldArg0, newArg0);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setArg0(Expression newArg0)
  {
    if (newArg0 != arg0)
    {
      NotificationChain msgs = null;
      if (arg0 != null)
        msgs = ((InternalEObject)arg0).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.AND_EXPRESSION__ARG0, null, msgs);
      if (newArg0 != null)
        msgs = ((InternalEObject)newArg0).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.AND_EXPRESSION__ARG0, null, msgs);
      msgs = basicSetArg0(newArg0, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ContractLangPackage.AND_EXPRESSION__ARG0, newArg0, newArg0));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Expression getArg1()
  {
    return arg1;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetArg1(Expression newArg1, NotificationChain msgs)
  {
    Expression oldArg1 = arg1;
    arg1 = newArg1;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContractLangPackage.AND_EXPRESSION__ARG1, oldArg1, newArg1);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setArg1(Expression newArg1)
  {
    if (newArg1 != arg1)
    {
      NotificationChain msgs = null;
      if (arg1 != null)
        msgs = ((InternalEObject)arg1).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.AND_EXPRESSION__ARG1, null, msgs);
      if (newArg1 != null)
        msgs = ((InternalEObject)newArg1).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.AND_EXPRESSION__ARG1, null, msgs);
      msgs = basicSetArg1(newArg1, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ContractLangPackage.AND_EXPRESSION__ARG1, newArg1, newArg1));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ContractLangPackage.AND_EXPRESSION__ARG0:
        return basicSetArg0(null, msgs);
      case ContractLangPackage.AND_EXPRESSION__ARG1:
        return basicSetArg1(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 ContractLangPackage.AND_EXPRESSION__ARG0:
        return getArg0();
      case ContractLangPackage.AND_EXPRESSION__ARG1:
        return getArg1();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ContractLangPackage.AND_EXPRESSION__ARG0:
        setArg0((Expression)newValue);
        return;
      case ContractLangPackage.AND_EXPRESSION__ARG1:
        setArg1((Expression)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ContractLangPackage.AND_EXPRESSION__ARG0:
        setArg0((Expression)null);
        return;
      case ContractLangPackage.AND_EXPRESSION__ARG1:
        setArg1((Expression)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ContractLangPackage.AND_EXPRESSION__ARG0:
        return arg0 != null;
      case ContractLangPackage.AND_EXPRESSION__ARG1:
        return arg1 != null;
    }
    return super.eIsSet(featureID);
  }

} //AndExpressionImpl
