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

import be.uantwerpen.cosys.contractLang.ContractLangPackage;
import be.uantwerpen.cosys.contractLang.FMUSignal;
import be.uantwerpen.cosys.contractLang.PowerBondSuggestion;

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>Power Bond Suggestion</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link be.uantwerpen.cosys.contractLang.impl.PowerBondSuggestionImpl#getOtherSignal <em>Other Signal</em>}</li>
 * </ul>
 *
 * @generated
 */
public class PowerBondSuggestionImpl extends DomainValueImpl implements PowerBondSuggestion
{
  /**
   * The cached value of the '{@link #getOtherSignal() <em>Other Signal</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getOtherSignal()
   * @generated
   * @ordered
   */
  protected FMUSignal otherSignal;

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public FMUSignal getOtherSignal()
  {
    return otherSignal;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetOtherSignal(FMUSignal newOtherSignal, NotificationChain msgs)
  {
    FMUSignal oldOtherSignal = otherSignal;
    otherSignal = newOtherSignal;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContractLangPackage.POWER_BOND_SUGGESTION__OTHER_SIGNAL, oldOtherSignal, newOtherSignal);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setOtherSignal(FMUSignal newOtherSignal)
  {
    if (newOtherSignal != otherSignal)
    {
      NotificationChain msgs = null;
      if (otherSignal != null)
        msgs = ((InternalEObject)otherSignal).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.POWER_BOND_SUGGESTION__OTHER_SIGNAL, null, msgs);
      if (newOtherSignal != null)
        msgs = ((InternalEObject)newOtherSignal).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.POWER_BOND_SUGGESTION__OTHER_SIGNAL, null, msgs);
      msgs = basicSetOtherSignal(newOtherSignal, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ContractLangPackage.POWER_BOND_SUGGESTION__OTHER_SIGNAL, newOtherSignal, newOtherSignal));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ContractLangPackage.POWER_BOND_SUGGESTION__OTHER_SIGNAL:
        return basicSetOtherSignal(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.POWER_BOND_SUGGESTION__OTHER_SIGNAL:
        return getOtherSignal();
    }
    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.POWER_BOND_SUGGESTION__OTHER_SIGNAL:
        setOtherSignal((FMUSignal)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ContractLangPackage.POWER_BOND_SUGGESTION__OTHER_SIGNAL:
        setOtherSignal((FMUSignal)null);
        return;
    }
    super.eUnset(featureID);
  }

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

} //PowerBondSuggestionImpl
