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

import be.uantwerpen.cosys.contractLang.ContractLangPackage;
import be.uantwerpen.cosys.contractLang.IntervalBound;
import be.uantwerpen.cosys.contractLang.NumValue;
import be.uantwerpen.cosys.contractLang.TimeInterval;

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>Time Interval</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link be.uantwerpen.cosys.contractLang.impl.TimeIntervalImpl#getL_bound <em>Lbound</em>}</li>
 *   <li>{@link be.uantwerpen.cosys.contractLang.impl.TimeIntervalImpl#getMin <em>Min</em>}</li>
 *   <li>{@link be.uantwerpen.cosys.contractLang.impl.TimeIntervalImpl#getMax <em>Max</em>}</li>
 *   <li>{@link be.uantwerpen.cosys.contractLang.impl.TimeIntervalImpl#getR_bound <em>Rbound</em>}</li>
 * </ul>
 *
 * @generated
 */
public class TimeIntervalImpl extends TimeImpl implements TimeInterval
{
  /**
   * The cached value of the '{@link #getL_bound() <em>Lbound</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getL_bound()
   * @generated
   * @ordered
   */
  protected IntervalBound l_bound;

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

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

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

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public IntervalBound getL_bound()
  {
    return l_bound;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetL_bound(IntervalBound newL_bound, NotificationChain msgs)
  {
    IntervalBound oldL_bound = l_bound;
    l_bound = newL_bound;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContractLangPackage.TIME_INTERVAL__LBOUND, oldL_bound, newL_bound);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setL_bound(IntervalBound newL_bound)
  {
    if (newL_bound != l_bound)
    {
      NotificationChain msgs = null;
      if (l_bound != null)
        msgs = ((InternalEObject)l_bound).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.TIME_INTERVAL__LBOUND, null, msgs);
      if (newL_bound != null)
        msgs = ((InternalEObject)newL_bound).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.TIME_INTERVAL__LBOUND, null, msgs);
      msgs = basicSetL_bound(newL_bound, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ContractLangPackage.TIME_INTERVAL__LBOUND, newL_bound, newL_bound));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NumValue getMin()
  {
    return min;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetMin(NumValue newMin, NotificationChain msgs)
  {
    NumValue oldMin = min;
    min = newMin;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContractLangPackage.TIME_INTERVAL__MIN, oldMin, newMin);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setMin(NumValue newMin)
  {
    if (newMin != min)
    {
      NotificationChain msgs = null;
      if (min != null)
        msgs = ((InternalEObject)min).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.TIME_INTERVAL__MIN, null, msgs);
      if (newMin != null)
        msgs = ((InternalEObject)newMin).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.TIME_INTERVAL__MIN, null, msgs);
      msgs = basicSetMin(newMin, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ContractLangPackage.TIME_INTERVAL__MIN, newMin, newMin));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NumValue getMax()
  {
    return max;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetMax(NumValue newMax, NotificationChain msgs)
  {
    NumValue oldMax = max;
    max = newMax;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContractLangPackage.TIME_INTERVAL__MAX, oldMax, newMax);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setMax(NumValue newMax)
  {
    if (newMax != max)
    {
      NotificationChain msgs = null;
      if (max != null)
        msgs = ((InternalEObject)max).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.TIME_INTERVAL__MAX, null, msgs);
      if (newMax != null)
        msgs = ((InternalEObject)newMax).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.TIME_INTERVAL__MAX, null, msgs);
      msgs = basicSetMax(newMax, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ContractLangPackage.TIME_INTERVAL__MAX, newMax, newMax));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public IntervalBound getR_bound()
  {
    return r_bound;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetR_bound(IntervalBound newR_bound, NotificationChain msgs)
  {
    IntervalBound oldR_bound = r_bound;
    r_bound = newR_bound;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContractLangPackage.TIME_INTERVAL__RBOUND, oldR_bound, newR_bound);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void setR_bound(IntervalBound newR_bound)
  {
    if (newR_bound != r_bound)
    {
      NotificationChain msgs = null;
      if (r_bound != null)
        msgs = ((InternalEObject)r_bound).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.TIME_INTERVAL__RBOUND, null, msgs);
      if (newR_bound != null)
        msgs = ((InternalEObject)newR_bound).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ContractLangPackage.TIME_INTERVAL__RBOUND, null, msgs);
      msgs = basicSetR_bound(newR_bound, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ContractLangPackage.TIME_INTERVAL__RBOUND, newR_bound, newR_bound));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ContractLangPackage.TIME_INTERVAL__LBOUND:
        return basicSetL_bound(null, msgs);
      case ContractLangPackage.TIME_INTERVAL__MIN:
        return basicSetMin(null, msgs);
      case ContractLangPackage.TIME_INTERVAL__MAX:
        return basicSetMax(null, msgs);
      case ContractLangPackage.TIME_INTERVAL__RBOUND:
        return basicSetR_bound(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.TIME_INTERVAL__LBOUND:
        return getL_bound();
      case ContractLangPackage.TIME_INTERVAL__MIN:
        return getMin();
      case ContractLangPackage.TIME_INTERVAL__MAX:
        return getMax();
      case ContractLangPackage.TIME_INTERVAL__RBOUND:
        return getR_bound();
    }
    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.TIME_INTERVAL__LBOUND:
        setL_bound((IntervalBound)newValue);
        return;
      case ContractLangPackage.TIME_INTERVAL__MIN:
        setMin((NumValue)newValue);
        return;
      case ContractLangPackage.TIME_INTERVAL__MAX:
        setMax((NumValue)newValue);
        return;
      case ContractLangPackage.TIME_INTERVAL__RBOUND:
        setR_bound((IntervalBound)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ContractLangPackage.TIME_INTERVAL__LBOUND:
        setL_bound((IntervalBound)null);
        return;
      case ContractLangPackage.TIME_INTERVAL__MIN:
        setMin((NumValue)null);
        return;
      case ContractLangPackage.TIME_INTERVAL__MAX:
        setMax((NumValue)null);
        return;
      case ContractLangPackage.TIME_INTERVAL__RBOUND:
        setR_bound((IntervalBound)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ContractLangPackage.TIME_INTERVAL__LBOUND:
        return l_bound != null;
      case ContractLangPackage.TIME_INTERVAL__MIN:
        return min != null;
      case ContractLangPackage.TIME_INTERVAL__MAX:
        return max != null;
      case ContractLangPackage.TIME_INTERVAL__RBOUND:
        return r_bound != null;
    }
    return super.eIsSet(featureID);
  }

} //TimeIntervalImpl
