| /** |
| * Copyright (c) 2008, 2021 Obeo. |
| * |
| * 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 |
| * |
| * Contributors: |
| * Obeo - initial API and implementation |
| */ |
| package org.eclipse.acceleo.impl; |
| |
| import org.eclipse.acceleo.AcceleoPackage; |
| import org.eclipse.acceleo.Binding; |
| import org.eclipse.acceleo.Block; |
| import org.eclipse.acceleo.Expression; |
| import org.eclipse.acceleo.ForStatement; |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object '<em><b>For Statement</b></em>'. <!-- |
| * end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.acceleo.impl.ForStatementImpl#getBinding <em>Binding</em>}</li> |
| * <li>{@link org.eclipse.acceleo.impl.ForStatementImpl#getSeparator <em>Separator</em>}</li> |
| * <li>{@link org.eclipse.acceleo.impl.ForStatementImpl#getBody <em>Body</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ForStatementImpl extends MinimalEObjectImpl.Container implements ForStatement { |
| /** |
| * The cached value of the '{@link #getBinding() <em>Binding</em>}' containment reference. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getBinding() |
| * @generated |
| * @ordered |
| */ |
| protected Binding binding; |
| |
| /** |
| * The cached value of the '{@link #getSeparator() <em>Separator</em>}' containment reference. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getSeparator() |
| * @generated |
| * @ordered |
| */ |
| protected Expression separator; |
| |
| /** |
| * The cached value of the '{@link #getBody() <em>Body</em>}' containment reference. <!-- begin-user-doc |
| * --> <!-- end-user-doc --> |
| * |
| * @see #getBody() |
| * @generated |
| * @ordered |
| */ |
| protected Block body; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected ForStatementImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AcceleoPackage.Literals.FOR_STATEMENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Binding getBinding() { |
| return binding; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetBinding(Binding newBinding, NotificationChain msgs) { |
| Binding oldBinding = binding; |
| binding = newBinding; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, |
| AcceleoPackage.FOR_STATEMENT__BINDING, oldBinding, newBinding); |
| if (msgs == null) |
| msgs = notification; |
| else |
| msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void setBinding(Binding newBinding) { |
| if (newBinding != binding) { |
| NotificationChain msgs = null; |
| if (binding != null) |
| msgs = ((InternalEObject)binding).eInverseRemove(this, EOPPOSITE_FEATURE_BASE |
| - AcceleoPackage.FOR_STATEMENT__BINDING, null, msgs); |
| if (newBinding != null) |
| msgs = ((InternalEObject)newBinding).eInverseAdd(this, EOPPOSITE_FEATURE_BASE |
| - AcceleoPackage.FOR_STATEMENT__BINDING, null, msgs); |
| msgs = basicSetBinding(newBinding, msgs); |
| if (msgs != null) |
| msgs.dispatch(); |
| } else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AcceleoPackage.FOR_STATEMENT__BINDING, |
| newBinding, newBinding)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Expression getSeparator() { |
| return separator; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetSeparator(Expression newSeparator, NotificationChain msgs) { |
| Expression oldSeparator = separator; |
| separator = newSeparator; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, |
| AcceleoPackage.FOR_STATEMENT__SEPARATOR, oldSeparator, newSeparator); |
| if (msgs == null) |
| msgs = notification; |
| else |
| msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void setSeparator(Expression newSeparator) { |
| if (newSeparator != separator) { |
| NotificationChain msgs = null; |
| if (separator != null) |
| msgs = ((InternalEObject)separator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE |
| - AcceleoPackage.FOR_STATEMENT__SEPARATOR, null, msgs); |
| if (newSeparator != null) |
| msgs = ((InternalEObject)newSeparator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE |
| - AcceleoPackage.FOR_STATEMENT__SEPARATOR, null, msgs); |
| msgs = basicSetSeparator(newSeparator, msgs); |
| if (msgs != null) |
| msgs.dispatch(); |
| } else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AcceleoPackage.FOR_STATEMENT__SEPARATOR, |
| newSeparator, newSeparator)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Block getBody() { |
| return body; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetBody(Block newBody, NotificationChain msgs) { |
| Block oldBody = body; |
| body = newBody; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, |
| AcceleoPackage.FOR_STATEMENT__BODY, oldBody, newBody); |
| if (msgs == null) |
| msgs = notification; |
| else |
| msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void setBody(Block newBody) { |
| if (newBody != body) { |
| NotificationChain msgs = null; |
| if (body != null) |
| msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE |
| - AcceleoPackage.FOR_STATEMENT__BODY, null, msgs); |
| if (newBody != null) |
| msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE |
| - AcceleoPackage.FOR_STATEMENT__BODY, null, msgs); |
| msgs = basicSetBody(newBody, msgs); |
| if (msgs != null) |
| msgs.dispatch(); |
| } else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AcceleoPackage.FOR_STATEMENT__BODY, newBody, |
| newBody)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AcceleoPackage.FOR_STATEMENT__BINDING: |
| return basicSetBinding(null, msgs); |
| case AcceleoPackage.FOR_STATEMENT__SEPARATOR: |
| return basicSetSeparator(null, msgs); |
| case AcceleoPackage.FOR_STATEMENT__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 AcceleoPackage.FOR_STATEMENT__BINDING: |
| return getBinding(); |
| case AcceleoPackage.FOR_STATEMENT__SEPARATOR: |
| return getSeparator(); |
| case AcceleoPackage.FOR_STATEMENT__BODY: |
| return getBody(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case AcceleoPackage.FOR_STATEMENT__BINDING: |
| setBinding((Binding)newValue); |
| return; |
| case AcceleoPackage.FOR_STATEMENT__SEPARATOR: |
| setSeparator((Expression)newValue); |
| return; |
| case AcceleoPackage.FOR_STATEMENT__BODY: |
| setBody((Block)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AcceleoPackage.FOR_STATEMENT__BINDING: |
| setBinding((Binding)null); |
| return; |
| case AcceleoPackage.FOR_STATEMENT__SEPARATOR: |
| setSeparator((Expression)null); |
| return; |
| case AcceleoPackage.FOR_STATEMENT__BODY: |
| setBody((Block)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AcceleoPackage.FOR_STATEMENT__BINDING: |
| return binding != null; |
| case AcceleoPackage.FOR_STATEMENT__SEPARATOR: |
| return separator != null; |
| case AcceleoPackage.FOR_STATEMENT__BODY: |
| return body != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } // ForStatementImpl |