/** */ package org.xtext.xrobot.dsl.xRobotDSL.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.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.xtext.common.types.JvmTypeReference; import org.eclipse.xtext.xbase.XExpression; import org.xtext.xrobot.dsl.xRobotDSL.Variable; import org.xtext.xrobot.dsl.xRobotDSL.XRobotDSLPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Variable</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.xtext.xrobot.dsl.xRobotDSL.impl.VariableImpl#getType <em>Type</em>}</li> * <li>{@link org.xtext.xrobot.dsl.xRobotDSL.impl.VariableImpl#getName <em>Name</em>}</li> * <li>{@link org.xtext.xrobot.dsl.xRobotDSL.impl.VariableImpl#getInitializer <em>Initializer</em>}</li> * </ul> * * @generated */ public class VariableImpl extends MinimalEObjectImpl.Container implements Variable { /** * The cached value of the '{@link #getType() <em>Type</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected JvmTypeReference type; /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getInitializer() <em>Initializer</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getInitializer() * @generated * @ordered */ protected XExpression initializer; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected VariableImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return XRobotDSLPackage.Literals.VARIABLE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public JvmTypeReference getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetType(JvmTypeReference newType, NotificationChain msgs) { JvmTypeReference oldType = type; type = newType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XRobotDSLPackage.VARIABLE__TYPE, oldType, newType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(JvmTypeReference newType) { if (newType != type) { NotificationChain msgs = null; if (type != null) msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XRobotDSLPackage.VARIABLE__TYPE, null, msgs); if (newType != null) msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XRobotDSLPackage.VARIABLE__TYPE, null, msgs); msgs = basicSetType(newType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, XRobotDSLPackage.VARIABLE__TYPE, newType, newType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, XRobotDSLPackage.VARIABLE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public XExpression getInitializer() { return initializer; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetInitializer(XExpression newInitializer, NotificationChain msgs) { XExpression oldInitializer = initializer; initializer = newInitializer; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XRobotDSLPackage.VARIABLE__INITIALIZER, oldInitializer, newInitializer); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setInitializer(XExpression newInitializer) { if (newInitializer != initializer) { NotificationChain msgs = null; if (initializer != null) msgs = ((InternalEObject)initializer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XRobotDSLPackage.VARIABLE__INITIALIZER, null, msgs); if (newInitializer != null) msgs = ((InternalEObject)newInitializer).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XRobotDSLPackage.VARIABLE__INITIALIZER, null, msgs); msgs = basicSetInitializer(newInitializer, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, XRobotDSLPackage.VARIABLE__INITIALIZER, newInitializer, newInitializer)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case XRobotDSLPackage.VARIABLE__TYPE: return basicSetType(null, msgs); case XRobotDSLPackage.VARIABLE__INITIALIZER: return basicSetInitializer(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 XRobotDSLPackage.VARIABLE__TYPE: return getType(); case XRobotDSLPackage.VARIABLE__NAME: return getName(); case XRobotDSLPackage.VARIABLE__INITIALIZER: return getInitializer(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case XRobotDSLPackage.VARIABLE__TYPE: setType((JvmTypeReference)newValue); return; case XRobotDSLPackage.VARIABLE__NAME: setName((String)newValue); return; case XRobotDSLPackage.VARIABLE__INITIALIZER: setInitializer((XExpression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case XRobotDSLPackage.VARIABLE__TYPE: setType((JvmTypeReference)null); return; case XRobotDSLPackage.VARIABLE__NAME: setName(NAME_EDEFAULT); return; case XRobotDSLPackage.VARIABLE__INITIALIZER: setInitializer((XExpression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case XRobotDSLPackage.VARIABLE__TYPE: return type != null; case XRobotDSLPackage.VARIABLE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case XRobotDSLPackage.VARIABLE__INITIALIZER: return initializer != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //VariableImpl