/*
 *
 * This source file belongs to the MDD4SOA suite developed at the Institute of 
 * Computer Science, Programming and Software Engineering, of the Ludwig-Maximilians-
 * Universität München, Germany. 
 * 
 * http://www.pst.ifi.lmu.de/
 * http://www.mdd4soa.eu/
 *
 * See the enclosed LICENSE file for licensing information.
 *
 */
package de.lmu.ifi.pst.mdd4soa.transform.impl.iom.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;

import de.lmu.ifi.pst.mdd4soa.transform.impl.iom.Compensate;
import de.lmu.ifi.pst.mdd4soa.transform.impl.iom.IOMPackage;
import de.lmu.ifi.pst.mdd4soa.transform.impl.iom.ServiceActivity;

/**
 * <!-- begin-user-doc --> An implementation of the model object '
 * <em><b>Compensate ServiceActivity</b></em>'. <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.lmu.ifi.pst.mdd4soa.transform.impl.iom.impl.CompensateImpl#getServiceActivity <em>Service Activity</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class CompensateImpl extends SimpleElementImpl implements Compensate {
	/**
	 * The cached value of the '{@link #getServiceActivity() <em>Service Activity</em>}' reference.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getServiceActivity()
	 * @generated
	 * @ordered
	 */
	protected ServiceActivity serviceActivity;

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ServiceActivity getServiceActivity() {
		if (serviceActivity != null && serviceActivity.eIsProxy()) {
			InternalEObject oldServiceActivity = (InternalEObject)serviceActivity;
			serviceActivity = (ServiceActivity)eResolveProxy(oldServiceActivity);
			if (serviceActivity != oldServiceActivity) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, IOMPackage.COMPENSATE__SERVICE_ACTIVITY, oldServiceActivity, serviceActivity));
			}
		}
		return serviceActivity;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ServiceActivity basicGetServiceActivity() {
		return serviceActivity;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setServiceActivity(ServiceActivity newServiceActivity) {
		ServiceActivity oldServiceActivity = serviceActivity;
		serviceActivity = newServiceActivity;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, IOMPackage.COMPENSATE__SERVICE_ACTIVITY, oldServiceActivity, serviceActivity));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case IOMPackage.COMPENSATE__SERVICE_ACTIVITY:
				if (resolve) return getServiceActivity();
				return basicGetServiceActivity();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case IOMPackage.COMPENSATE__SERVICE_ACTIVITY:
				setServiceActivity((ServiceActivity)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case IOMPackage.COMPENSATE__SERVICE_ACTIVITY:
				setServiceActivity((ServiceActivity)null);
				return;
		}
		super.eUnset(featureID);
	}

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

} // CompensateImpl
