/** */ package org.example.xbase.entities.entities.impl; 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.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.xtext.common.types.JvmFormalParameter; import org.eclipse.xtext.common.types.JvmTypeReference; import org.eclipse.xtext.xbase.XExpression; import org.example.xbase.entities.entities.EntitiesPackage; import org.example.xbase.entities.entities.Operation; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Operation</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.example.xbase.entities.entities.impl.OperationImpl#getType <em>Type</em>}</li> * <li>{@link org.example.xbase.entities.entities.impl.OperationImpl#getName <em>Name</em>}</li> * <li>{@link org.example.xbase.entities.entities.impl.OperationImpl#getParams <em>Params</em>}</li> * <li>{@link org.example.xbase.entities.entities.impl.OperationImpl#getBody <em>Body</em>}</li> * </ul> * </p> * * @generated */ public class OperationImpl extends MinimalEObjectImpl.Container implements Operation { /** * 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 #getParams() <em>Params</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getParams() * @generated * @ordered */ protected EList<JvmFormalParameter> params; /** * The cached value of the '{@link #getBody() <em>Body</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getBody() * @generated * @ordered */ protected XExpression body; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected OperationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return EntitiesPackage.Literals.OPERATION; } /** * <!-- 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, EntitiesPackage.OPERATION__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 - EntitiesPackage.OPERATION__TYPE, null, msgs); if (newType != null) msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.OPERATION__TYPE, null, msgs); msgs = basicSetType(newType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EntitiesPackage.OPERATION__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, EntitiesPackage.OPERATION__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<JvmFormalParameter> getParams() { if (params == null) { params = new EObjectContainmentEList<JvmFormalParameter>(JvmFormalParameter.class, this, EntitiesPackage.OPERATION__PARAMS); } return params; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public XExpression getBody() { return body; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetBody(XExpression newBody, NotificationChain msgs) { XExpression oldBody = body; body = newBody; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntitiesPackage.OPERATION__BODY, oldBody, newBody); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setBody(XExpression newBody) { if (newBody != body) { NotificationChain msgs = null; if (body != null) msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.OPERATION__BODY, null, msgs); if (newBody != null) msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.OPERATION__BODY, null, msgs); msgs = basicSetBody(newBody, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EntitiesPackage.OPERATION__BODY, newBody, newBody)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case EntitiesPackage.OPERATION__TYPE: return basicSetType(null, msgs); case EntitiesPackage.OPERATION__PARAMS: return ((InternalEList<?>)getParams()).basicRemove(otherEnd, msgs); case EntitiesPackage.OPERATION__BODY: return basicSetBody(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 EntitiesPackage.OPERATION__TYPE: return getType(); case EntitiesPackage.OPERATION__NAME: return getName(); case EntitiesPackage.OPERATION__PARAMS: return getParams(); case EntitiesPackage.OPERATION__BODY: return getBody(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case EntitiesPackage.OPERATION__TYPE: setType((JvmTypeReference)newValue); return; case EntitiesPackage.OPERATION__NAME: setName((String)newValue); return; case EntitiesPackage.OPERATION__PARAMS: getParams().clear(); getParams().addAll((Collection<? extends JvmFormalParameter>)newValue); return; case EntitiesPackage.OPERATION__BODY: setBody((XExpression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case EntitiesPackage.OPERATION__TYPE: setType((JvmTypeReference)null); return; case EntitiesPackage.OPERATION__NAME: setName(NAME_EDEFAULT); return; case EntitiesPackage.OPERATION__PARAMS: getParams().clear(); return; case EntitiesPackage.OPERATION__BODY: setBody((XExpression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case EntitiesPackage.OPERATION__TYPE: return type != null; case EntitiesPackage.OPERATION__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case EntitiesPackage.OPERATION__PARAMS: return params != null && !params.isEmpty(); case EntitiesPackage.OPERATION__BODY: return body != 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(); } } //OperationImpl