| /******************************************************************************* |
| * Copyright (c) 2012, 2019 Willink Transformations and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * E.D.Willink - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.ocl.xtext.completeoclcs.impl; |
| |
| import java.util.Collections; |
| import java.util.List; |
| |
| 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.ocl.pivot.Element; |
| import org.eclipse.ocl.pivot.internal.manager.PivotMetamodelManager; |
| import org.eclipse.ocl.xtext.basecs.PathNameCS; |
| import org.eclipse.ocl.xtext.basecs.impl.ModelElementCSImpl; |
| import org.eclipse.ocl.xtext.completeoclcs.CompleteOCLCSPackage; |
| import org.eclipse.ocl.xtext.completeoclcs.PathNameDeclCS; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Named Element Decl CS</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.ocl.xtext.completeoclcs.impl.PathNameDeclCSImpl#getOwnedPathName <em>Owned Path Name</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class PathNameDeclCSImpl |
| extends ModelElementCSImpl |
| implements PathNameDeclCS { |
| |
| /** |
| * The number of structural features of the '<em>Path Name Decl CS</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int PATH_NAME_DECL_CS_FEATURE_COUNT = ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1; |
| /** |
| * The cached value of the '{@link #getOwnedPathName() <em>Owned Path Name</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedPathName() |
| * @generated |
| * @ordered |
| */ |
| protected PathNameCS ownedPathName; |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PathNameDeclCSImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return CompleteOCLCSPackage.Literals.PATH_NAME_DECL_CS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public PathNameCS getOwnedPathName() { |
| return ownedPathName; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwnedPathName(PathNameCS newOwnedPathName, NotificationChain msgs) |
| { |
| PathNameCS oldOwnedPathName = ownedPathName; |
| ownedPathName = newOwnedPathName; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0, oldOwnedPathName, newOwnedPathName); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOwnedPathName(PathNameCS newOwnedPathName) { |
| if (newOwnedPathName != ownedPathName) |
| { |
| NotificationChain msgs = null; |
| if (ownedPathName != null) |
| msgs = ((InternalEObject)ownedPathName).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0), null, msgs); |
| if (newOwnedPathName != null) |
| msgs = ((InternalEObject)newOwnedPathName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0), null, msgs); |
| msgs = basicSetOwnedPathName(newOwnedPathName, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0, newOwnedPathName, newOwnedPathName)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) |
| { |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| return basicSetOwnedPathName(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 ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| return getOwnedPathName(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) |
| { |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| setOwnedPathName((PathNameCS)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) |
| { |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| setOwnedPathName((PathNameCS)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) |
| { |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| return ownedPathName != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public @NonNull Iterable<Element> getMorePivots() { |
| if (ownedPathName == null) { |
| return PivotMetamodelManager.EMPTY_ELEMENT_LIST; |
| } |
| Element pElement = ownedPathName.getReferredElement(); |
| if ((pElement == null) || pElement.eIsProxy()) { |
| return PivotMetamodelManager.EMPTY_ELEMENT_LIST; |
| } |
| @NonNull List<Element> singletonList = Collections |
| .<Element> singletonList(pElement); |
| return singletonList; |
| } |
| } //NamedElementDeclCSImpl |