/**
*/
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.CastExpression;
import org.eclipse.viatra.solver.language.solverLanguage.Expression;
import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage;
import org.eclipse.viatra.solver.language.solverLanguage.Symbol;
/**
*
* An implementation of the model object 'Cast Expression'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.CastExpressionImpl#getBody Body}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.CastExpressionImpl#getTargetType Target Type}
*
*
* @generated
*/
public class CastExpressionImpl extends ExpressionImpl implements CastExpression {
/**
* The cached value of the '{@link #getBody() Body}' containment reference.
*
*
* @see #getBody()
* @generated
* @ordered
*/
protected Expression body;
/**
* The cached value of the '{@link #getTargetType() Target Type}' reference.
*
*
* @see #getTargetType()
* @generated
* @ordered
*/
protected Symbol targetType;
/**
*
*
* @generated
*/
protected CastExpressionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return SolverLanguagePackage.Literals.CAST_EXPRESSION;
}
/**
*
*
* @generated
*/
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.CAST_EXPRESSION__BODY, oldBody, newBody);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setBody(Expression newBody) {
if (newBody != body) {
NotificationChain msgs = null;
if (body != null)
msgs = ((InternalEObject) body).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.CAST_EXPRESSION__BODY, null, msgs);
if (newBody != null)
msgs = ((InternalEObject) newBody).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.CAST_EXPRESSION__BODY, null, msgs);
msgs = basicSetBody(newBody, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.CAST_EXPRESSION__BODY, newBody,
newBody));
}
/**
*
*
* @generated
*/
public Symbol getTargetType() {
if (targetType != null && targetType.eIsProxy()) {
InternalEObject oldTargetType = (InternalEObject) targetType;
targetType = (Symbol) eResolveProxy(oldTargetType);
if (targetType != oldTargetType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE,
SolverLanguagePackage.CAST_EXPRESSION__TARGET_TYPE, oldTargetType, targetType));
}
}
return targetType;
}
/**
*
*
* @generated
*/
public Symbol basicGetTargetType() {
return targetType;
}
/**
*
*
* @generated
*/
public void setTargetType(Symbol newTargetType) {
Symbol oldTargetType = targetType;
targetType = newTargetType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.CAST_EXPRESSION__TARGET_TYPE,
oldTargetType, targetType));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SolverLanguagePackage.CAST_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.CAST_EXPRESSION__BODY:
return getBody();
case SolverLanguagePackage.CAST_EXPRESSION__TARGET_TYPE:
if (resolve)
return getTargetType();
return basicGetTargetType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SolverLanguagePackage.CAST_EXPRESSION__BODY:
setBody((Expression) newValue);
return;
case SolverLanguagePackage.CAST_EXPRESSION__TARGET_TYPE:
setTargetType((Symbol) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SolverLanguagePackage.CAST_EXPRESSION__BODY:
setBody((Expression) null);
return;
case SolverLanguagePackage.CAST_EXPRESSION__TARGET_TYPE:
setTargetType((Symbol) null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SolverLanguagePackage.CAST_EXPRESSION__BODY:
return body != null;
case SolverLanguagePackage.CAST_EXPRESSION__TARGET_TYPE:
return targetType != null;
}
return super.eIsSet(featureID);
}
} //CastExpressionImpl