/**
* generated by Xtext 2.21.0
*/
package org.eclipse.viatra.solver.language.solverLanguage.impl;
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;
import org.eclipse.viatra.solver.language.solverLanguage.Expression;
import org.eclipse.viatra.solver.language.solverLanguage.LocalVariables;
import org.eclipse.viatra.solver.language.solverLanguage.QuantifiedExpression;
import org.eclipse.viatra.solver.language.solverLanguage.Quantifier;
import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage;
/**
*
* An implementation of the model object 'Quantified Expression'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.QuantifiedExpressionImpl#getLocalVariables Local Variables}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.QuantifiedExpressionImpl#getBody Body}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.QuantifiedExpressionImpl#getQuantifier Quantifier}
*
*
* @generated
*/
public class QuantifiedExpressionImpl extends ExpressionImpl implements QuantifiedExpression {
/**
* The cached value of the '{@link #getLocalVariables() Local Variables}' containment reference.
*
*
* @see #getLocalVariables()
* @generated
* @ordered
*/
protected LocalVariables localVariables;
/**
* The cached value of the '{@link #getBody() Body}' containment reference.
*
*
* @see #getBody()
* @generated
* @ordered
*/
protected Expression body;
/**
* The default value of the '{@link #getQuantifier() Quantifier}' attribute.
*
*
* @see #getQuantifier()
* @generated
* @ordered
*/
protected static final Quantifier QUANTIFIER_EDEFAULT = Quantifier.EXISTS;
/**
* The cached value of the '{@link #getQuantifier() Quantifier}' attribute.
*
*
* @see #getQuantifier()
* @generated
* @ordered
*/
protected Quantifier quantifier = QUANTIFIER_EDEFAULT;
/**
*
*
* @generated
*/
protected QuantifiedExpressionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return SolverLanguagePackage.Literals.QUANTIFIED_EXPRESSION;
}
/**
*
*
* @generated
*/
@Override
public LocalVariables getLocalVariables() {
return localVariables;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetLocalVariables(LocalVariables newLocalVariables, NotificationChain msgs) {
LocalVariables oldLocalVariables = localVariables;
localVariables = newLocalVariables;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.QUANTIFIED_EXPRESSION__LOCAL_VARIABLES, oldLocalVariables, newLocalVariables);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setLocalVariables(LocalVariables newLocalVariables) {
if (newLocalVariables != localVariables) {
NotificationChain msgs = null;
if (localVariables != null)
msgs = ((InternalEObject)localVariables).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.QUANTIFIED_EXPRESSION__LOCAL_VARIABLES, null, msgs);
if (newLocalVariables != null)
msgs = ((InternalEObject)newLocalVariables).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.QUANTIFIED_EXPRESSION__LOCAL_VARIABLES, null, msgs);
msgs = basicSetLocalVariables(newLocalVariables, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.QUANTIFIED_EXPRESSION__LOCAL_VARIABLES, newLocalVariables, newLocalVariables));
}
/**
*
*
* @generated
*/
@Override
public Expression getBody() {
return body;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetBody(Expression newBody, NotificationChain msgs) {
Expression oldBody = body;
body = newBody;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.QUANTIFIED_EXPRESSION__BODY, oldBody, newBody);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setBody(Expression newBody) {
if (newBody != body) {
NotificationChain msgs = null;
if (body != null)
msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.QUANTIFIED_EXPRESSION__BODY, null, msgs);
if (newBody != null)
msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.QUANTIFIED_EXPRESSION__BODY, null, msgs);
msgs = basicSetBody(newBody, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.QUANTIFIED_EXPRESSION__BODY, newBody, newBody));
}
/**
*
*
* @generated
*/
@Override
public Quantifier getQuantifier() {
return quantifier;
}
/**
*
*
* @generated
*/
@Override
public void setQuantifier(Quantifier newQuantifier) {
Quantifier oldQuantifier = quantifier;
quantifier = newQuantifier == null ? QUANTIFIER_EDEFAULT : newQuantifier;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIER, oldQuantifier, quantifier));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__LOCAL_VARIABLES:
return basicSetLocalVariables(null, msgs);
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__BODY:
return basicSetBody(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__LOCAL_VARIABLES:
return getLocalVariables();
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__BODY:
return getBody();
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIER:
return getQuantifier();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__LOCAL_VARIABLES:
setLocalVariables((LocalVariables)newValue);
return;
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__BODY:
setBody((Expression)newValue);
return;
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIER:
setQuantifier((Quantifier)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__LOCAL_VARIABLES:
setLocalVariables((LocalVariables)null);
return;
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__BODY:
setBody((Expression)null);
return;
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIER:
setQuantifier(QUANTIFIER_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__LOCAL_VARIABLES:
return localVariables != null;
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__BODY:
return body != null;
case SolverLanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIER:
return quantifier != QUANTIFIER_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (quantifier: ");
result.append(quantifier);
result.append(')');
return result.toString();
}
} //QuantifiedExpressionImpl