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

import be.uantwerpen.cosys.contractLang.ContractLangPackage;
import be.uantwerpen.cosys.contractLang.MetaStatement;
import be.uantwerpen.cosys.contractLang.StatementOr;

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>Statement Or</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link be.uantwerpen.cosys.contractLang.impl.StatementOrImpl#getStatement1 <em>Statement1</em>}</li>
 *   <li>{@link be.uantwerpen.cosys.contractLang.impl.StatementOrImpl#getStatement2 <em>Statement2</em>}</li>
 * </ul>
 *
 * @generated
 */
public class StatementOrImpl extends StatementOpImpl implements StatementOr
{
  /**
   * The cached value of the '{@link #getStatement1() <em>Statement1</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getStatement1()
   * @generated
   * @ordered
   */
  protected MetaStatement statement1;

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

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public MetaStatement getStatement1()
  {
    return statement1;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetStatement1(MetaStatement newStatement1, NotificationChain msgs)
  {
    MetaStatement oldStatement1 = statement1;
    statement1 = newStatement1;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContractLangPackage.STATEMENT_OR__STATEMENT1, oldStatement1, newStatement1);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setStatement1(MetaStatement newStatement1)
  {
    if (newStatement1 != statement1)
    {
      NotificationChain msgs = null;
      if (statement1 != null)
        msgs = ((InternalEObject)statement1).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.STATEMENT_OR__STATEMENT1, null, msgs);
      if (newStatement1 != null)
        msgs = ((InternalEObject)newStatement1).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.STATEMENT_OR__STATEMENT1, null, msgs);
      msgs = basicSetStatement1(newStatement1, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ContractLangPackage.STATEMENT_OR__STATEMENT1, newStatement1, newStatement1));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public MetaStatement getStatement2()
  {
    return statement2;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetStatement2(MetaStatement newStatement2, NotificationChain msgs)
  {
    MetaStatement oldStatement2 = statement2;
    statement2 = newStatement2;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContractLangPackage.STATEMENT_OR__STATEMENT2, oldStatement2, newStatement2);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setStatement2(MetaStatement newStatement2)
  {
    if (newStatement2 != statement2)
    {
      NotificationChain msgs = null;
      if (statement2 != null)
        msgs = ((InternalEObject)statement2).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.STATEMENT_OR__STATEMENT2, null, msgs);
      if (newStatement2 != null)
        msgs = ((InternalEObject)newStatement2).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.STATEMENT_OR__STATEMENT2, null, msgs);
      msgs = basicSetStatement2(newStatement2, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ContractLangPackage.STATEMENT_OR__STATEMENT2, newStatement2, newStatement2));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ContractLangPackage.STATEMENT_OR__STATEMENT1:
        return basicSetStatement1(null, msgs);
      case ContractLangPackage.STATEMENT_OR__STATEMENT2:
        return basicSetStatement2(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.STATEMENT_OR__STATEMENT1:
        return getStatement1();
      case ContractLangPackage.STATEMENT_OR__STATEMENT2:
        return getStatement2();
    }
    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.STATEMENT_OR__STATEMENT1:
        setStatement1((MetaStatement)newValue);
        return;
      case ContractLangPackage.STATEMENT_OR__STATEMENT2:
        setStatement2((MetaStatement)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ContractLangPackage.STATEMENT_OR__STATEMENT1:
        setStatement1((MetaStatement)null);
        return;
      case ContractLangPackage.STATEMENT_OR__STATEMENT2:
        setStatement2((MetaStatement)null);
        return;
    }
    super.eUnset(featureID);
  }

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

} //StatementOrImpl
