/**
 */
package org.etsi.mts.tdl.impl;

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;

import org.etsi.mts.tdl.DataUse;
import org.etsi.mts.tdl.TimeConstraint;
import org.etsi.mts.tdl.tdlPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Time Constraint</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link org.etsi.mts.tdl.impl.TimeConstraintImpl#getTimeConstraintExpression <em>Time Constraint Expression</em>}</li>
 * </ul>
 *
 * @generated
 */
public class TimeConstraintImpl extends ElementImpl implements TimeConstraint
{
	/**
	 * The cached value of the '{@link #getTimeConstraintExpression() <em>Time Constraint Expression</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeConstraintExpression()
	 * @generated
	 * @ordered
	 */
	protected DataUse timeConstraintExpression;

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public DataUse getTimeConstraintExpression()
	{
		return timeConstraintExpression;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetTimeConstraintExpression(DataUse newTimeConstraintExpression, NotificationChain msgs)
	{
		DataUse oldTimeConstraintExpression = timeConstraintExpression;
		timeConstraintExpression = newTimeConstraintExpression;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, tdlPackage.TIME_CONSTRAINT__TIME_CONSTRAINT_EXPRESSION, oldTimeConstraintExpression, newTimeConstraintExpression);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void setTimeConstraintExpression(DataUse newTimeConstraintExpression)
	{
		if (newTimeConstraintExpression != timeConstraintExpression) {
			NotificationChain msgs = null;
			if (timeConstraintExpression != null)
				msgs = ((InternalEObject)timeConstraintExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - tdlPackage.TIME_CONSTRAINT__TIME_CONSTRAINT_EXPRESSION, null, msgs);
			if (newTimeConstraintExpression != null)
				msgs = ((InternalEObject)newTimeConstraintExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - tdlPackage.TIME_CONSTRAINT__TIME_CONSTRAINT_EXPRESSION, null, msgs);
			msgs = basicSetTimeConstraintExpression(newTimeConstraintExpression, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, tdlPackage.TIME_CONSTRAINT__TIME_CONSTRAINT_EXPRESSION, newTimeConstraintExpression, newTimeConstraintExpression));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
	{
		switch (featureID) {
			case tdlPackage.TIME_CONSTRAINT__TIME_CONSTRAINT_EXPRESSION:
				return basicSetTimeConstraintExpression(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 tdlPackage.TIME_CONSTRAINT__TIME_CONSTRAINT_EXPRESSION:
				return getTimeConstraintExpression();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue)
	{
		switch (featureID) {
			case tdlPackage.TIME_CONSTRAINT__TIME_CONSTRAINT_EXPRESSION:
				setTimeConstraintExpression((DataUse)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID)
	{
		switch (featureID) {
			case tdlPackage.TIME_CONSTRAINT__TIME_CONSTRAINT_EXPRESSION:
				setTimeConstraintExpression((DataUse)null);
				return;
		}
		super.eUnset(featureID);
	}

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

} //TimeConstraintImpl
