/**
 */
package com.irtsaintexupery.fiacre.simulator.msc.msc.impl;

import com.irtsaintexupery.fiacre.simulator.msc.msc.MscPackage;
import com.irtsaintexupery.fiacre.simulator.msc.msc.SendStep;
import com.irtsaintexupery.fiacre.simulator.msc.msc.Site;

import java.util.Collection;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Send Step</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link com.irtsaintexupery.fiacre.simulator.msc.msc.impl.SendStepImpl#getSenderSites <em>Sender Sites</em>}</li>
 *   <li>{@link com.irtsaintexupery.fiacre.simulator.msc.msc.impl.SendStepImpl#getReceiverSites <em>Receiver Sites</em>}</li>
 * </ul>
 *
 * @generated
 */
public class SendStepImpl extends MicroStepImpl implements SendStep {
	/**
	 * The cached value of the '{@link #getSenderSites() <em>Sender Sites</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSenderSites()
	 * @generated
	 * @ordered
	 */
	protected EList<Site> senderSites;

	/**
	 * The cached value of the '{@link #getReceiverSites() <em>Receiver Sites</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getReceiverSites()
	 * @generated
	 * @ordered
	 */
	protected EList<Site> receiverSites;

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Site> getSenderSites() {
		if (senderSites == null) {
			senderSites = new EObjectResolvingEList<Site>(Site.class, this, MscPackage.SEND_STEP__SENDER_SITES);
		}
		return senderSites;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Site> getReceiverSites() {
		if (receiverSites == null) {
			receiverSites = new EObjectResolvingEList<Site>(Site.class, this, MscPackage.SEND_STEP__RECEIVER_SITES);
		}
		return receiverSites;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MscPackage.SEND_STEP__SENDER_SITES:
				return getSenderSites();
			case MscPackage.SEND_STEP__RECEIVER_SITES:
				return getReceiverSites();
		}
		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 MscPackage.SEND_STEP__SENDER_SITES:
				getSenderSites().clear();
				getSenderSites().addAll((Collection<? extends Site>)newValue);
				return;
			case MscPackage.SEND_STEP__RECEIVER_SITES:
				getReceiverSites().clear();
				getReceiverSites().addAll((Collection<? extends Site>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case MscPackage.SEND_STEP__SENDER_SITES:
				getSenderSites().clear();
				return;
			case MscPackage.SEND_STEP__RECEIVER_SITES:
				getReceiverSites().clear();
				return;
		}
		super.eUnset(featureID);
	}

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

} //SendStepImpl
