/**
*/
package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.QuantifiedExpression;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Term;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Variable;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
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.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Quantified Expression'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.QuantifiedExpressionImpl#getQuantifiedVariables Quantified Variables}
* - {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.QuantifiedExpressionImpl#getExpression Expression}
*
*
* @generated
*/
public abstract class QuantifiedExpressionImpl extends TermImpl implements QuantifiedExpression {
/**
* The cached value of the '{@link #getQuantifiedVariables() Quantified Variables}' containment reference list.
*
*
* @see #getQuantifiedVariables()
* @generated
* @ordered
*/
protected EList quantifiedVariables;
/**
* The cached value of the '{@link #getExpression() Expression}' containment reference.
*
*
* @see #getExpression()
* @generated
* @ordered
*/
protected Term expression;
/**
*
*
* @generated
*/
protected QuantifiedExpressionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return LogiclanguagePackage.Literals.QUANTIFIED_EXPRESSION;
}
/**
*
*
* @generated
*/
public EList getQuantifiedVariables() {
if (quantifiedVariables == null) {
quantifiedVariables = new EObjectContainmentEList(Variable.class, this, LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES);
}
return quantifiedVariables;
}
/**
*
*
* @generated
*/
public Term getExpression() {
return expression;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetExpression(Term newExpression, NotificationChain msgs) {
Term oldExpression = expression;
expression = newExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION, oldExpression, newExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setExpression(Term newExpression) {
if (newExpression != expression) {
NotificationChain msgs = null;
if (expression != null)
msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION, null, msgs);
if (newExpression != null)
msgs = ((InternalEObject)newExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION, null, msgs);
msgs = basicSetExpression(newExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION, newExpression, newExpression));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES:
return ((InternalEList>)getQuantifiedVariables()).basicRemove(otherEnd, msgs);
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION:
return basicSetExpression(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES:
return getQuantifiedVariables();
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION:
return getExpression();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES:
getQuantifiedVariables().clear();
getQuantifiedVariables().addAll((Collection extends Variable>)newValue);
return;
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION:
setExpression((Term)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES:
getQuantifiedVariables().clear();
return;
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION:
setExpression((Term)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES:
return quantifiedVariables != null && !quantifiedVariables.isEmpty();
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION:
return expression != null;
}
return super.eIsSet(featureID);
}
} //QuantifiedExpressionImpl