/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package fr.femtost.disc.eclipse.vhdlamsmetamodel.vhdlams.impl;

import fr.femtost.disc.eclipse.vhdlamsmetamodel.vhdlams.BranchQuantity;
import fr.femtost.disc.eclipse.vhdlamsmetamodel.vhdlams.Terminal;
import fr.femtost.disc.eclipse.vhdlamsmetamodel.vhdlams.Variable;
import fr.femtost.disc.eclipse.vhdlamsmetamodel.vhdlams.VhdlamsPackage;

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;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Branch Quantity</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fr.femtost.disc.eclipse.vhdlamsmetamodel.vhdlams.impl.BranchQuantityImpl#getPlus_terminal <em>Plus terminal</em>}</li>
 *   <li>{@link fr.femtost.disc.eclipse.vhdlamsmetamodel.vhdlams.impl.BranchQuantityImpl#getMinus_terminal <em>Minus terminal</em>}</li>
 *   <li>{@link fr.femtost.disc.eclipse.vhdlamsmetamodel.vhdlams.impl.BranchQuantityImpl#getThrough <em>Through</em>}</li>
 *   <li>{@link fr.femtost.disc.eclipse.vhdlamsmetamodel.vhdlams.impl.BranchQuantityImpl#getAcross <em>Across</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BranchQuantityImpl extends QuantityImpl implements BranchQuantity {
	/**
	 * The cached value of the '{@link #getPlus_terminal() <em>Plus terminal</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPlus_terminal()
	 * @generated
	 * @ordered
	 */
	protected Terminal plus_terminal;

	/**
	 * The cached value of the '{@link #getMinus_terminal() <em>Minus terminal</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMinus_terminal()
	 * @generated
	 * @ordered
	 */
	protected Terminal minus_terminal;

	/**
	 * The cached value of the '{@link #getThrough() <em>Through</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getThrough()
	 * @generated
	 * @ordered
	 */
	protected Variable through;

	/**
	 * The cached value of the '{@link #getAcross() <em>Across</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAcross()
	 * @generated
	 * @ordered
	 */
	protected Variable across;

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Terminal getPlus_terminal() {
		if (plus_terminal != null && plus_terminal.eIsProxy()) {
			InternalEObject oldPlus_terminal = (InternalEObject)plus_terminal;
			plus_terminal = (Terminal)eResolveProxy(oldPlus_terminal);
			if (plus_terminal != oldPlus_terminal) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, VhdlamsPackage.BRANCH_QUANTITY__PLUS_TERMINAL, oldPlus_terminal, plus_terminal));
			}
		}
		return plus_terminal;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Terminal basicGetPlus_terminal() {
		return plus_terminal;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPlus_terminal(Terminal newPlus_terminal) {
		Terminal oldPlus_terminal = plus_terminal;
		plus_terminal = newPlus_terminal;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, VhdlamsPackage.BRANCH_QUANTITY__PLUS_TERMINAL, oldPlus_terminal, plus_terminal));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Terminal getMinus_terminal() {
		if (minus_terminal != null && minus_terminal.eIsProxy()) {
			InternalEObject oldMinus_terminal = (InternalEObject)minus_terminal;
			minus_terminal = (Terminal)eResolveProxy(oldMinus_terminal);
			if (minus_terminal != oldMinus_terminal) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, VhdlamsPackage.BRANCH_QUANTITY__MINUS_TERMINAL, oldMinus_terminal, minus_terminal));
			}
		}
		return minus_terminal;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Terminal basicGetMinus_terminal() {
		return minus_terminal;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMinus_terminal(Terminal newMinus_terminal) {
		Terminal oldMinus_terminal = minus_terminal;
		minus_terminal = newMinus_terminal;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, VhdlamsPackage.BRANCH_QUANTITY__MINUS_TERMINAL, oldMinus_terminal, minus_terminal));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Variable getThrough() {
		if (through != null && through.eIsProxy()) {
			InternalEObject oldThrough = (InternalEObject)through;
			through = (Variable)eResolveProxy(oldThrough);
			if (through != oldThrough) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, VhdlamsPackage.BRANCH_QUANTITY__THROUGH, oldThrough, through));
			}
		}
		return through;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Variable basicGetThrough() {
		return through;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setThrough(Variable newThrough) {
		Variable oldThrough = through;
		through = newThrough;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, VhdlamsPackage.BRANCH_QUANTITY__THROUGH, oldThrough, through));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Variable getAcross() {
		if (across != null && across.eIsProxy()) {
			InternalEObject oldAcross = (InternalEObject)across;
			across = (Variable)eResolveProxy(oldAcross);
			if (across != oldAcross) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, VhdlamsPackage.BRANCH_QUANTITY__ACROSS, oldAcross, across));
			}
		}
		return across;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Variable basicGetAcross() {
		return across;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAcross(Variable newAcross) {
		Variable oldAcross = across;
		across = newAcross;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, VhdlamsPackage.BRANCH_QUANTITY__ACROSS, oldAcross, across));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case VhdlamsPackage.BRANCH_QUANTITY__PLUS_TERMINAL:
				if (resolve) return getPlus_terminal();
				return basicGetPlus_terminal();
			case VhdlamsPackage.BRANCH_QUANTITY__MINUS_TERMINAL:
				if (resolve) return getMinus_terminal();
				return basicGetMinus_terminal();
			case VhdlamsPackage.BRANCH_QUANTITY__THROUGH:
				if (resolve) return getThrough();
				return basicGetThrough();
			case VhdlamsPackage.BRANCH_QUANTITY__ACROSS:
				if (resolve) return getAcross();
				return basicGetAcross();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case VhdlamsPackage.BRANCH_QUANTITY__PLUS_TERMINAL:
				setPlus_terminal((Terminal)newValue);
				return;
			case VhdlamsPackage.BRANCH_QUANTITY__MINUS_TERMINAL:
				setMinus_terminal((Terminal)newValue);
				return;
			case VhdlamsPackage.BRANCH_QUANTITY__THROUGH:
				setThrough((Variable)newValue);
				return;
			case VhdlamsPackage.BRANCH_QUANTITY__ACROSS:
				setAcross((Variable)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case VhdlamsPackage.BRANCH_QUANTITY__PLUS_TERMINAL:
				setPlus_terminal((Terminal)null);
				return;
			case VhdlamsPackage.BRANCH_QUANTITY__MINUS_TERMINAL:
				setMinus_terminal((Terminal)null);
				return;
			case VhdlamsPackage.BRANCH_QUANTITY__THROUGH:
				setThrough((Variable)null);
				return;
			case VhdlamsPackage.BRANCH_QUANTITY__ACROSS:
				setAcross((Variable)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case VhdlamsPackage.BRANCH_QUANTITY__PLUS_TERMINAL:
				return plus_terminal != null;
			case VhdlamsPackage.BRANCH_QUANTITY__MINUS_TERMINAL:
				return minus_terminal != null;
			case VhdlamsPackage.BRANCH_QUANTITY__THROUGH:
				return through != null;
			case VhdlamsPackage.BRANCH_QUANTITY__ACROSS:
				return across != null;
		}
		return super.eIsSet(featureID);
	}

} //BranchQuantityImpl
