/**
 * <copyright>
 * </copyright>
 *
 * $Id: MethodLibraryImpl.java,v 1.2 2006/06/23 00:01:25 jxi Exp $
 */
package org.eclipse.epf.xml.uma.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 org.eclipse.epf.xml.uma.MethodConfiguration;
import org.eclipse.epf.xml.uma.MethodLibrary;
import org.eclipse.epf.xml.uma.MethodPlugin;
import org.eclipse.epf.xml.uma.UmaPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Method Library</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.eclipse.epf.xml.uma.impl.MethodLibraryImpl#getMethodPlugin <em>Method Plugin</em>}</li>
 *   <li>{@link org.eclipse.epf.xml.uma.impl.MethodLibraryImpl#getMethodConfiguration <em>Method Configuration</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MethodLibraryImpl extends MethodUnitImpl implements MethodLibrary {
	/**
	 * The cached value of the '{@link #getMethodPlugin() <em>Method Plugin</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMethodPlugin()
	 * @generated
	 * @ordered
	 */
	protected EList methodPlugin = null;

	/**
	 * The cached value of the '{@link #getMethodConfiguration() <em>Method Configuration</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMethodConfiguration()
	 * @generated
	 * @ordered
	 */
	protected EList methodConfiguration = null;

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getMethodPlugin() {
		if (methodPlugin == null) {
			methodPlugin = new EObjectContainmentEList(MethodPlugin.class, this, UmaPackage.METHOD_LIBRARY__METHOD_PLUGIN);
		}
		return methodPlugin;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getMethodConfiguration() {
		if (methodConfiguration == null) {
			methodConfiguration = new EObjectContainmentEList(MethodConfiguration.class, this, UmaPackage.METHOD_LIBRARY__METHOD_CONFIGURATION);
		}
		return methodConfiguration;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case UmaPackage.METHOD_LIBRARY__METHOD_PLUGIN:
				return ((InternalEList)getMethodPlugin()).basicRemove(otherEnd, msgs);
			case UmaPackage.METHOD_LIBRARY__METHOD_CONFIGURATION:
				return ((InternalEList)getMethodConfiguration()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case UmaPackage.METHOD_LIBRARY__METHOD_PLUGIN:
				return getMethodPlugin();
			case UmaPackage.METHOD_LIBRARY__METHOD_CONFIGURATION:
				return getMethodConfiguration();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case UmaPackage.METHOD_LIBRARY__METHOD_PLUGIN:
				getMethodPlugin().clear();
				getMethodPlugin().addAll((Collection)newValue);
				return;
			case UmaPackage.METHOD_LIBRARY__METHOD_CONFIGURATION:
				getMethodConfiguration().clear();
				getMethodConfiguration().addAll((Collection)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case UmaPackage.METHOD_LIBRARY__METHOD_PLUGIN:
				getMethodPlugin().clear();
				return;
			case UmaPackage.METHOD_LIBRARY__METHOD_CONFIGURATION:
				getMethodConfiguration().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case UmaPackage.METHOD_LIBRARY__METHOD_PLUGIN:
				return methodPlugin != null && !methodPlugin.isEmpty();
			case UmaPackage.METHOD_LIBRARY__METHOD_CONFIGURATION:
				return methodConfiguration != null && !methodConfiguration.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //MethodLibraryImpl