/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package de.lmu.ifi.pst.mdd4soa.transform.impl.iom.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
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.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import de.lmu.ifi.pst.mdd4soa.transform.impl.iom.IOMPackage;
import de.lmu.ifi.pst.mdd4soa.transform.impl.iom.ServiceInterface;
import de.lmu.ifi.pst.mdd4soa.transform.impl.iom.ServiceOperation;
import de.lmu.ifi.pst.mdd4soa.transform.impl.iom.type.impl.TypeImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Service Interface</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.lmu.ifi.pst.mdd4soa.transform.impl.iom.impl.ServiceInterfaceImpl#getUsed <em>Used</em>}</li>
 *   <li>{@link de.lmu.ifi.pst.mdd4soa.transform.impl.iom.impl.ServiceInterfaceImpl#getImplemented <em>Implemented</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ServiceInterfaceImpl extends TypeImpl implements ServiceInterface {
	/**
	 * The cached value of the '{@link #getUsed() <em>Used</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUsed()
	 * @generated
	 * @ordered
	 */
	protected EList<ServiceOperation> used;

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

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ServiceOperation> getUsed() {
		if (used == null) {
			used = new EObjectContainmentEList<ServiceOperation>(ServiceOperation.class, this, IOMPackage.SERVICE_INTERFACE__USED);
		}
		return used;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ServiceOperation> getImplemented() {
		if (implemented == null) {
			implemented = new EObjectContainmentEList<ServiceOperation>(ServiceOperation.class, this, IOMPackage.SERVICE_INTERFACE__IMPLEMENTED);
		}
		return implemented;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case IOMPackage.SERVICE_INTERFACE__USED:
				return ((InternalEList<?>)getUsed()).basicRemove(otherEnd, msgs);
			case IOMPackage.SERVICE_INTERFACE__IMPLEMENTED:
				return ((InternalEList<?>)getImplemented()).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 IOMPackage.SERVICE_INTERFACE__USED:
				return getUsed();
			case IOMPackage.SERVICE_INTERFACE__IMPLEMENTED:
				return getImplemented();
		}
		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 IOMPackage.SERVICE_INTERFACE__USED:
				getUsed().clear();
				getUsed().addAll((Collection<? extends ServiceOperation>)newValue);
				return;
			case IOMPackage.SERVICE_INTERFACE__IMPLEMENTED:
				getImplemented().clear();
				getImplemented().addAll((Collection<? extends ServiceOperation>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case IOMPackage.SERVICE_INTERFACE__USED:
				getUsed().clear();
				return;
			case IOMPackage.SERVICE_INTERFACE__IMPLEMENTED:
				getImplemented().clear();
				return;
		}
		super.eUnset(featureID);
	}

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

} //ServiceInterfaceImpl
