| /******************************************************************************* |
| * Copyright (c) 2018 Willink Transformations and others. |
| * 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: |
| * Adolfo Sanchez-Barbudo Herrera - initial API and implementation |
| *******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.qvtd.doc.miniocl.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.jdt.annotation.NonNull; |
| |
| import org.eclipse.qvtd.doc.miniocl.IterateExp; |
| import org.eclipse.qvtd.doc.miniocl.MiniOCLPackage; |
| import org.eclipse.qvtd.doc.miniocl.Variable; |
| |
| import org.eclipse.qvtd.doc.miniocl.util.Visitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Iterate Exp</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.doc.miniocl.impl.IterateExpImpl#getOwnedResult <em>Owned Result</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class IterateExpImpl extends LoopExpImpl implements IterateExp { |
| /** |
| * The cached value of the '{@link #getOwnedResult() <em>Owned Result</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedResult() |
| * @generated |
| * @ordered |
| */ |
| protected Variable ownedResult; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected IterateExpImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return MiniOCLPackage.Literals.ITERATE_EXP; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Variable getOwnedResult() { |
| return ownedResult; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwnedResult(Variable newOwnedResult, NotificationChain msgs) { |
| Variable oldOwnedResult = ownedResult; |
| ownedResult = newOwnedResult; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MiniOCLPackage.ITERATE_EXP__OWNED_RESULT, oldOwnedResult, newOwnedResult); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setOwnedResult(Variable newOwnedResult) { |
| if (newOwnedResult != ownedResult) { |
| NotificationChain msgs = null; |
| if (ownedResult != null) |
| msgs = ((InternalEObject)ownedResult).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.ITERATE_EXP__OWNED_RESULT, null, msgs); |
| if (newOwnedResult != null) |
| msgs = ((InternalEObject)newOwnedResult).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.ITERATE_EXP__OWNED_RESULT, null, msgs); |
| msgs = basicSetOwnedResult(newOwnedResult, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MiniOCLPackage.ITERATE_EXP__OWNED_RESULT, newOwnedResult, newOwnedResult)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case MiniOCLPackage.ITERATE_EXP__OWNED_RESULT: |
| return basicSetOwnedResult(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 MiniOCLPackage.ITERATE_EXP__OWNED_RESULT: |
| return getOwnedResult(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case MiniOCLPackage.ITERATE_EXP__OWNED_RESULT: |
| setOwnedResult((Variable)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case MiniOCLPackage.ITERATE_EXP__OWNED_RESULT: |
| setOwnedResult((Variable)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case MiniOCLPackage.ITERATE_EXP__OWNED_RESULT: |
| return ownedResult != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public <R> R accept(@NonNull Visitor<R> visitor) { |
| return visitor.visitIterateExp(this); |
| } |
| |
| } //IterateExpImpl |