| /******************************************************************************* |
| * 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.CollectionRange; |
| import org.eclipse.qvtd.doc.miniocl.MiniOCLPackage; |
| import org.eclipse.qvtd.doc.miniocl.OCLExpression; |
| |
| import org.eclipse.qvtd.doc.miniocl.util.Visitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Collection Range</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.doc.miniocl.impl.CollectionRangeImpl#getOwnedFirst <em>Owned First</em>}</li> |
| * <li>{@link org.eclipse.qvtd.doc.miniocl.impl.CollectionRangeImpl#getOwnedLast <em>Owned Last</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class CollectionRangeImpl extends CollectionLiteralPartImpl implements CollectionRange { |
| /** |
| * The cached value of the '{@link #getOwnedFirst() <em>Owned First</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedFirst() |
| * @generated |
| * @ordered |
| */ |
| protected OCLExpression ownedFirst; |
| |
| /** |
| * The cached value of the '{@link #getOwnedLast() <em>Owned Last</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedLast() |
| * @generated |
| * @ordered |
| */ |
| protected OCLExpression ownedLast; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CollectionRangeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return MiniOCLPackage.Literals.COLLECTION_RANGE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public OCLExpression getOwnedFirst() { |
| return ownedFirst; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwnedFirst(OCLExpression newOwnedFirst, NotificationChain msgs) { |
| OCLExpression oldOwnedFirst = ownedFirst; |
| ownedFirst = newOwnedFirst; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MiniOCLPackage.COLLECTION_RANGE__OWNED_FIRST, oldOwnedFirst, newOwnedFirst); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setOwnedFirst(OCLExpression newOwnedFirst) { |
| if (newOwnedFirst != ownedFirst) { |
| NotificationChain msgs = null; |
| if (ownedFirst != null) |
| msgs = ((InternalEObject)ownedFirst).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.COLLECTION_RANGE__OWNED_FIRST, null, msgs); |
| if (newOwnedFirst != null) |
| msgs = ((InternalEObject)newOwnedFirst).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.COLLECTION_RANGE__OWNED_FIRST, null, msgs); |
| msgs = basicSetOwnedFirst(newOwnedFirst, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MiniOCLPackage.COLLECTION_RANGE__OWNED_FIRST, newOwnedFirst, newOwnedFirst)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public OCLExpression getOwnedLast() { |
| return ownedLast; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwnedLast(OCLExpression newOwnedLast, NotificationChain msgs) { |
| OCLExpression oldOwnedLast = ownedLast; |
| ownedLast = newOwnedLast; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MiniOCLPackage.COLLECTION_RANGE__OWNED_LAST, oldOwnedLast, newOwnedLast); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setOwnedLast(OCLExpression newOwnedLast) { |
| if (newOwnedLast != ownedLast) { |
| NotificationChain msgs = null; |
| if (ownedLast != null) |
| msgs = ((InternalEObject)ownedLast).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.COLLECTION_RANGE__OWNED_LAST, null, msgs); |
| if (newOwnedLast != null) |
| msgs = ((InternalEObject)newOwnedLast).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.COLLECTION_RANGE__OWNED_LAST, null, msgs); |
| msgs = basicSetOwnedLast(newOwnedLast, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MiniOCLPackage.COLLECTION_RANGE__OWNED_LAST, newOwnedLast, newOwnedLast)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case MiniOCLPackage.COLLECTION_RANGE__OWNED_FIRST: |
| return basicSetOwnedFirst(null, msgs); |
| case MiniOCLPackage.COLLECTION_RANGE__OWNED_LAST: |
| return basicSetOwnedLast(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.COLLECTION_RANGE__OWNED_FIRST: |
| return getOwnedFirst(); |
| case MiniOCLPackage.COLLECTION_RANGE__OWNED_LAST: |
| return getOwnedLast(); |
| } |
| 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.COLLECTION_RANGE__OWNED_FIRST: |
| setOwnedFirst((OCLExpression)newValue); |
| return; |
| case MiniOCLPackage.COLLECTION_RANGE__OWNED_LAST: |
| setOwnedLast((OCLExpression)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case MiniOCLPackage.COLLECTION_RANGE__OWNED_FIRST: |
| setOwnedFirst((OCLExpression)null); |
| return; |
| case MiniOCLPackage.COLLECTION_RANGE__OWNED_LAST: |
| setOwnedLast((OCLExpression)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case MiniOCLPackage.COLLECTION_RANGE__OWNED_FIRST: |
| return ownedFirst != null; |
| case MiniOCLPackage.COLLECTION_RANGE__OWNED_LAST: |
| return ownedLast != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public <R> R accept(@NonNull Visitor<R> visitor) { |
| return visitor.visitCollectionRange(this); |
| } |
| |
| } //CollectionRangeImpl |