/**
 */
package logicalSpecification.impl;

import logicalSpecification.LogicalSpecificationPackage;
import logicalSpecification.NotOperator;
import logicalSpecification.Operator;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

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>Not
 * Operator</b></em>'. <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 * <li>{@link logicalSpecification.impl.NotOperatorImpl#getArgument
 * <em>Argument</em>}</li>
 * </ul>
 *
 * @generated
 */
public class NotOperatorImpl extends LogicalOperatorImpl implements NotOperator {
	/**
	 * The cached value of the '{@link #getArgument() <em>Argument</em>}'
	 * containment reference. <!-- begin-user-doc --> <!-- end-user-doc -->
	 *
	 * @see #getArgument()
	 * @generated
	 * @ordered
	 */
	protected Operator argument;

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

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

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 *
	 * @generated
	 */
	public Operator getArgument() {
		return argument;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 *
	 * @generated
	 */
	public NotificationChain basicSetArgument(Operator newArgument, NotificationChain msgs) {
		Operator oldArgument = argument;
		argument = newArgument;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
					LogicalSpecificationPackage.NOT_OPERATOR__ARGUMENT, oldArgument, newArgument);
			if (msgs == null)
				msgs = notification;
			else
				msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 *
	 * @generated
	 */
	public void setArgument(Operator newArgument) {
		if (newArgument != argument) {
			NotificationChain msgs = null;
			if (argument != null)
				msgs = ((InternalEObject) argument).eInverseRemove(this,
						LogicalSpecificationPackage.OPERATOR__NOT_OPERATOR, Operator.class, msgs);
			if (newArgument != null)
				msgs = ((InternalEObject) newArgument).eInverseAdd(this,
						LogicalSpecificationPackage.OPERATOR__NOT_OPERATOR, Operator.class, msgs);
			msgs = basicSetArgument(newArgument, msgs);
			if (msgs != null)
				msgs.dispatch();
		} else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, LogicalSpecificationPackage.NOT_OPERATOR__ARGUMENT,
					newArgument, newArgument));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 *
	 * @generated
	 */
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
		case LogicalSpecificationPackage.NOT_OPERATOR__ARGUMENT:
			if (argument != null)
				msgs = ((InternalEObject) argument).eInverseRemove(this,
						EOPPOSITE_FEATURE_BASE - LogicalSpecificationPackage.NOT_OPERATOR__ARGUMENT, null, msgs);
			return basicSetArgument((Operator) otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 *
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
		case LogicalSpecificationPackage.NOT_OPERATOR__ARGUMENT:
			return basicSetArgument(null, 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 LogicalSpecificationPackage.NOT_OPERATOR__ARGUMENT:
			return getArgument();
		}
		return super.eGet(featureID, resolve, coreType);
	}

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

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 *
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case LogicalSpecificationPackage.NOT_OPERATOR__ARGUMENT:
			setArgument((Operator) null);
			return;
		}
		super.eUnset(featureID);
	}

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

	public boolean equals(NotOperator op2) {
		if (op2 != null)
			return this.getArgument().equals(op2.getArgument());
		return false;
	}

	public boolean guarantees(Operator op2) {
		if (op2 != null) {
			if (this != op2)
				return this.getArgument().guarantees(op2);
			return true;
		}
		return false;
	}
} // NotOperatorImpl
