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

import java.lang.reflect.InvocationTargetException;

import java.util.Collection;

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.util.EObjectResolvingEList;

import org.etsi.mts.tdl.Behaviour;
import org.etsi.mts.tdl.ComponentInstance;
import org.etsi.mts.tdl.TestObjective;
import org.etsi.mts.tdl.tdlPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Behaviour</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link org.etsi.mts.tdl.impl.BehaviourImpl#getTestObjective <em>Test Objective</em>}</li>
 * </ul>
 *
 * @generated
 */
public abstract class BehaviourImpl extends ElementImpl implements Behaviour
{
	/**
	 * The cached value of the '{@link #getTestObjective() <em>Test Objective</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTestObjective()
	 * @generated
	 * @ordered
	 */
	protected EList<TestObjective> testObjective;

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EList<TestObjective> getTestObjective()
	{
		if (testObjective == null)
		{
			testObjective = new EObjectResolvingEList<TestObjective>(TestObjective.class, this, tdlPackage.BEHAVIOUR__TEST_OBJECTIVE);
		}
		return testObjective;
	}

	/**
	 * The cached invocation delegate for the '{@link #isTesterInputEvent() <em>Is Tester Input Event</em>}' operation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isTesterInputEvent()
	 * @generated
	 * @ordered
	 */
	protected static final EOperation.Internal.InvocationDelegate IS_TESTER_INPUT_EVENT__EINVOCATION_DELEGATE = ((EOperation.Internal)tdlPackage.Literals.BEHAVIOUR___IS_TESTER_INPUT_EVENT).getInvocationDelegate();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Boolean isTesterInputEvent()
	{
		try
		{
			return (Boolean)IS_TESTER_INPUT_EVENT__EINVOCATION_DELEGATE.dynamicInvoke(this, null);
		}
		catch (InvocationTargetException ite)
		{
			throw new WrappedException(ite);
		}
	}

	/**
	 * 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.BEHAVIOUR___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.BEHAVIOUR__TEST_OBJECTIVE:
				return getTestObjective();
		}
		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.BEHAVIOUR__TEST_OBJECTIVE:
				getTestObjective().clear();
				getTestObjective().addAll((Collection<? extends TestObjective>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

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

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

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

} //BehaviourImpl
