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

import java.lang.reflect.InvocationTargetException;

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.Comment;

import org.etsi.mts.tdl.impl.TestObjectiveImpl;

import org.etsi.mts.tdl.structuredobjectives.Element;
import org.etsi.mts.tdl.structuredobjectives.PICSReference;
import org.etsi.mts.tdl.structuredobjectives.StructuredObjectivesPackage;
import org.etsi.mts.tdl.structuredobjectives.StructuredTestObjective;
import org.etsi.mts.tdl.structuredobjectives.TestObjectiveVariant;
import org.etsi.mts.tdl.structuredobjectives.VariantBinding;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Test Objective Variant</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link org.etsi.mts.tdl.structuredobjectives.impl.TestObjectiveVariantImpl#getPicsReference <em>Pics Reference</em>}</li>
 *   <li>{@link org.etsi.mts.tdl.structuredobjectives.impl.TestObjectiveVariantImpl#getBindings <em>Bindings</em>}</li>
 * </ul>
 *
 * @generated
 */
public class TestObjectiveVariantImpl extends TestObjectiveImpl implements TestObjectiveVariant
{
	/**
	 * The cached value of the '{@link #getPicsReference() <em>Pics Reference</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPicsReference()
	 * @generated
	 * @ordered
	 */
	protected EList<PICSReference> picsReference;

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

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EList<PICSReference> getPicsReference()
	{
		if (picsReference == null)
		{
			picsReference = new EObjectContainmentEList<PICSReference>(PICSReference.class, this, StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT__PICS_REFERENCE);
		}
		return picsReference;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EList<VariantBinding> getBindings()
	{
		if (bindings == null)
		{
			bindings = new EObjectContainmentEList<VariantBinding>(VariantBinding.class, this, StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT__BINDINGS);
		}
		return bindings;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public StructuredTestObjective getTestObjective()
	{
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean contains(Element object)
	{
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EList<Comment> getNotes()
	{
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
	{
		switch (featureID)
		{
			case StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT__PICS_REFERENCE:
				return ((InternalEList<?>)getPicsReference()).basicRemove(otherEnd, msgs);
			case StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT__BINDINGS:
				return ((InternalEList<?>)getBindings()).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 StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT__PICS_REFERENCE:
				return getPicsReference();
			case StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT__BINDINGS:
				return getBindings();
		}
		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 StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT__PICS_REFERENCE:
				getPicsReference().clear();
				getPicsReference().addAll((Collection<? extends PICSReference>)newValue);
				return;
			case StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT__BINDINGS:
				getBindings().clear();
				getBindings().addAll((Collection<? extends VariantBinding>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID)
	{
		switch (featureID)
		{
			case StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT__PICS_REFERENCE:
				getPicsReference().clear();
				return;
			case StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT__BINDINGS:
				getBindings().clear();
				return;
		}
		super.eUnset(featureID);
	}

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public int eDerivedOperationID(int baseOperationID, Class<?> baseClass)
	{
		if (baseClass == Element.class)
		{
			switch (baseOperationID)
			{
				case StructuredObjectivesPackage.ELEMENT___GET_TEST_OBJECTIVE: return StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT___GET_TEST_OBJECTIVE;
				case StructuredObjectivesPackage.ELEMENT___CONTAINS__ELEMENT: return StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT___CONTAINS__ELEMENT;
				case StructuredObjectivesPackage.ELEMENT___GET_NOTES: return StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT___GET_NOTES;
				default: return -1;
			}
		}
		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 StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT___GET_TEST_OBJECTIVE:
				return getTestObjective();
			case StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT___CONTAINS__ELEMENT:
				return contains((Element)arguments.get(0));
			case StructuredObjectivesPackage.TEST_OBJECTIVE_VARIANT___GET_NOTES:
				return getNotes();
		}
		return super.eInvoke(operationID, arguments);
	}

} //TestObjectiveVariantImpl
