blob: be37eda3fb945ef345e1f43444d0b37d2e2bc32a [file] [log] [blame]
/**
* Copyright (c) 2020 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html\n\nContributors:
* Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr
* - Initial API and Implementation
*/
package org.eclipse.efm.ecore.formalml.expression.impl;
import org.eclipse.efm.ecore.formalml.datatype.DataType;
import org.eclipse.efm.ecore.formalml.expression.CastExpression;
import org.eclipse.efm.ecore.formalml.expression.ExpressionPackage;
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>Cast Expression</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.efm.ecore.formalml.expression.impl.CastExpressionImpl#getDatatype <em>Datatype</em>}</li>
* </ul>
*
* @generated
*/
public class CastExpressionImpl extends UnaryExpressionImpl implements CastExpression {
/**
* The cached value of the '{@link #getDatatype() <em>Datatype</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDatatype()
* @generated
* @ordered
*/
protected DataType datatype;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CastExpressionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionPackage.Literals.CAST_EXPRESSION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public DataType getDatatype() {
if (datatype != null && datatype.eIsProxy()) {
InternalEObject oldDatatype = (InternalEObject)datatype;
datatype = (DataType)eResolveProxy(oldDatatype);
if (datatype != oldDatatype) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ExpressionPackage.CAST_EXPRESSION__DATATYPE, oldDatatype, datatype));
}
}
return datatype;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataType basicGetDatatype() {
return datatype;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setDatatype(DataType newDatatype) {
DataType oldDatatype = datatype;
datatype = newDatatype;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.CAST_EXPRESSION__DATATYPE, oldDatatype, datatype));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ExpressionPackage.CAST_EXPRESSION__DATATYPE:
if (resolve) return getDatatype();
return basicGetDatatype();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ExpressionPackage.CAST_EXPRESSION__DATATYPE:
setDatatype((DataType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ExpressionPackage.CAST_EXPRESSION__DATATYPE:
setDatatype((DataType)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ExpressionPackage.CAST_EXPRESSION__DATATYPE:
return datatype != null;
}
return super.eIsSet(featureID);
}
} //CastExpressionImpl