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

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.etsi.mts.tdl.CombinedBehaviour;
import org.etsi.mts.tdl.ExceptionalBehaviour;
import org.etsi.mts.tdl.PeriodicBehaviour;
import org.etsi.mts.tdl.tdlPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Combined Behaviour</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link org.etsi.mts.tdl.impl.CombinedBehaviourImpl#getPeriodic <em>Periodic</em>}</li>
 *   <li>{@link org.etsi.mts.tdl.impl.CombinedBehaviourImpl#getExceptional <em>Exceptional</em>}</li>
 * </ul>
 *
 * @generated
 */
public abstract class CombinedBehaviourImpl extends BehaviourImpl implements CombinedBehaviour
{
	/**
	 * The cached value of the '{@link #getPeriodic() <em>Periodic</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPeriodic()
	 * @generated
	 * @ordered
	 */
	protected EList<PeriodicBehaviour> periodic;

	/**
	 * The cached value of the '{@link #getExceptional() <em>Exceptional</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExceptional()
	 * @generated
	 * @ordered
	 */
	protected EList<ExceptionalBehaviour> exceptional;

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EList<PeriodicBehaviour> getPeriodic()
	{
		if (periodic == null) {
			periodic = new EObjectContainmentEList<PeriodicBehaviour>(PeriodicBehaviour.class, this, tdlPackage.COMBINED_BEHAVIOUR__PERIODIC);
		}
		return periodic;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EList<ExceptionalBehaviour> getExceptional()
	{
		if (exceptional == null) {
			exceptional = new EObjectContainmentEList<ExceptionalBehaviour>(ExceptionalBehaviour.class, this, tdlPackage.COMBINED_BEHAVIOUR__EXCEPTIONAL);
		}
		return exceptional;
	}

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue)
	{
		switch (featureID) {
			case tdlPackage.COMBINED_BEHAVIOUR__PERIODIC:
				getPeriodic().clear();
				getPeriodic().addAll((Collection<? extends PeriodicBehaviour>)newValue);
				return;
			case tdlPackage.COMBINED_BEHAVIOUR__EXCEPTIONAL:
				getExceptional().clear();
				getExceptional().addAll((Collection<? extends ExceptionalBehaviour>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID)
	{
		switch (featureID) {
			case tdlPackage.COMBINED_BEHAVIOUR__PERIODIC:
				getPeriodic().clear();
				return;
			case tdlPackage.COMBINED_BEHAVIOUR__EXCEPTIONAL:
				getExceptional().clear();
				return;
		}
		super.eUnset(featureID);
	}

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

} //CombinedBehaviourImpl
