/*
 * This file has been developed at the University of Munich, Chair for Programming & Software Engineering.
 * 
 * This file is licensed under the Eclipse Public License (EPL) 1.0
 * 
 */
package eu.mdd4soa.smm.statik.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 eu.mdd4soa.smm.statik.ISMStatikPackage;
import eu.mdd4soa.smm.statik.InterfaceOperation;
import eu.mdd4soa.smm.statik.InterfaceType;
import eu.mdd4soa.smm.statik.SMMType;

/**
 * <!-- begin-user-doc --> An implementation of the model object '
 * <em><b>Interface Type</b></em>'. <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 * <li>{@link eu.mdd4soa.smm.statik.impl.InterfaceTypeImpl#getUsed <em>Used
 * </em>}</li>
 * <li>{@link eu.mdd4soa.smm.statik.impl.InterfaceTypeImpl#getImplemented <em>
 * Implemented</em>}</li>
 * </ul>
 * </p>
 * 
 * @generated
 */
public class InterfaceTypeImpl extends SMMTypeImpl implements InterfaceType {
	/**
	 * 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<InterfaceOperation> 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<InterfaceOperation> implemented;

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

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

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

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

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

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

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

	/**
	 * @generated NOT
	 */
	@Override
	public SMMType getBaseType() {
		return this;
	}

} // InterfaceTypeImpl
