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

import java.lang.reflect.InvocationTargetException;

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

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

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

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.etsi.mts.tdl.AtomicBehaviour;
import org.etsi.mts.tdl.Behaviour;
import org.etsi.mts.tdl.ComponentInstance;
import org.etsi.mts.tdl.GateReference;
import org.etsi.mts.tdl.Quiescence;
import org.etsi.mts.tdl.TimeOperation;
import org.etsi.mts.tdl.tdlPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Quiescence</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link org.etsi.mts.tdl.impl.QuiescenceImpl#getGateReference <em>Gate Reference</em>}</li>
 * </ul>
 *
 * @generated
 */
public class QuiescenceImpl extends TimeOperationImpl implements Quiescence
{
	/**
	 * The cached value of the '{@link #getGateReference() <em>Gate Reference</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGateReference()
	 * @generated
	 * @ordered
	 */
	protected GateReference gateReference;

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public GateReference getGateReference()
	{
		if (gateReference != null && gateReference.eIsProxy()) {
			InternalEObject oldGateReference = (InternalEObject)gateReference;
			gateReference = (GateReference)eResolveProxy(oldGateReference);
			if (gateReference != oldGateReference) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, tdlPackage.QUIESCENCE__GATE_REFERENCE, oldGateReference, gateReference));
			}
		}
		return gateReference;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GateReference basicGetGateReference()
	{
		return gateReference;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void setGateReference(GateReference newGateReference)
	{
		GateReference oldGateReference = gateReference;
		gateReference = newGateReference;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, tdlPackage.QUIESCENCE__GATE_REFERENCE, oldGateReference, gateReference));
	}

	/**
	 * The cached invocation delegate for the '{@link #getParticipatingComponents() <em>Get Participating Components</em>}' operation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getParticipatingComponents()
	 * @generated
	 * @ordered
	 */
	protected static final EOperation.Internal.InvocationDelegate GET_PARTICIPATING_COMPONENTS__EINVOCATION_DELEGATE = ((EOperation.Internal)tdlPackage.Literals.QUIESCENCE___GET_PARTICIPATING_COMPONENTS).getInvocationDelegate();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public EList<ComponentInstance> getParticipatingComponents()
	{
		try {
			return (EList<ComponentInstance>)GET_PARTICIPATING_COMPONENTS__EINVOCATION_DELEGATE.dynamicInvoke(this, null);
		}
		catch (InvocationTargetException ite) {
			throw new WrappedException(ite);
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType)
	{
		switch (featureID) {
			case tdlPackage.QUIESCENCE__GATE_REFERENCE:
				if (resolve) return getGateReference();
				return basicGetGateReference();
		}
		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.QUIESCENCE__GATE_REFERENCE:
				setGateReference((GateReference)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public int eDerivedOperationID(int baseOperationID, Class<?> baseClass)
	{
		if (baseClass == Behaviour.class) {
			switch (baseOperationID) {
				case tdlPackage.BEHAVIOUR___GET_PARTICIPATING_COMPONENTS: return tdlPackage.QUIESCENCE___GET_PARTICIPATING_COMPONENTS;
				default: return super.eDerivedOperationID(baseOperationID, baseClass);
			}
		}
		if (baseClass == AtomicBehaviour.class) {
			switch (baseOperationID) {
				case tdlPackage.ATOMIC_BEHAVIOUR___GET_PARTICIPATING_COMPONENTS: return tdlPackage.QUIESCENCE___GET_PARTICIPATING_COMPONENTS;
				default: return super.eDerivedOperationID(baseOperationID, baseClass);
			}
		}
		if (baseClass == TimeOperation.class) {
			switch (baseOperationID) {
				case tdlPackage.TIME_OPERATION___GET_PARTICIPATING_COMPONENTS: return tdlPackage.QUIESCENCE___GET_PARTICIPATING_COMPONENTS;
				default: return super.eDerivedOperationID(baseOperationID, baseClass);
			}
		}
		return super.eDerivedOperationID(baseOperationID, baseClass);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException
	{
		switch (operationID) {
			case tdlPackage.QUIESCENCE___GET_PARTICIPATING_COMPONENTS:
				return getParticipatingComponents();
		}
		return super.eInvoke(operationID, arguments);
	}

} //QuiescenceImpl
