| /******************************************************************************* |
| * Copyright (c) 2012, 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 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.qvtd.xtext.qvtrelationcs.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.emf.ecore.util.EcoreUtil; |
| import org.eclipse.jdt.annotation.NonNull; |
| import org.eclipse.ocl.pivot.Property; |
| import org.eclipse.ocl.xtext.basecs.PathNameCS; |
| import org.eclipse.ocl.xtext.basecs.impl.ModelElementCSImpl; |
| import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor; |
| import org.eclipse.ocl.xtext.essentialoclcs.ExpCS; |
| import org.eclipse.ocl.xtext.essentialoclcs.impl.ExpCSImpl; |
| import org.eclipse.qvtd.xtext.qvtrelationcs.ObjectTemplateCS; |
| import org.eclipse.qvtd.xtext.qvtrelationcs.PropertyTemplateCS; |
| import org.eclipse.qvtd.xtext.qvtrelationcs.QVTrelationCSPackage; |
| import org.eclipse.qvtd.xtext.qvtrelationcs.util.QVTrelationCSVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Property Template CS</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtrelationcs.impl.PropertyTemplateCSImpl#getOwningObjectTemplate <em>Owning Object Template</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtrelationcs.impl.PropertyTemplateCSImpl#getPropertyId <em>Property Id</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtrelationcs.impl.PropertyTemplateCSImpl#getOwnedOppositePropertyId <em>Owned Opposite Property Id</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtrelationcs.impl.PropertyTemplateCSImpl#getOwnedExpression <em>Owned Expression</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class PropertyTemplateCSImpl extends ModelElementCSImpl implements PropertyTemplateCS { |
| /** |
| * The number of structural features of the '<em>Property Template CS</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int PROPERTY_TEMPLATE_CS_FEATURE_COUNT = ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4; |
| |
| /** |
| * The cached value of the '{@link #getPropertyId() <em>Property Id</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPropertyId() |
| * @generated |
| * @ordered |
| */ |
| protected Property propertyId; |
| |
| /** |
| * The cached value of the '{@link #getOwnedOppositePropertyId() <em>Owned Opposite Property Id</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedOppositePropertyId() |
| * @generated |
| * @ordered |
| */ |
| protected PathNameCS ownedOppositePropertyId; |
| |
| /** |
| * The cached value of the '{@link #getOwnedExpression() <em>Owned Expression</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedExpression() |
| * @generated |
| * @ordered |
| */ |
| protected ExpCS ownedExpression; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PropertyTemplateCSImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return QVTrelationCSPackage.Literals.PROPERTY_TEMPLATE_CS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public ObjectTemplateCS getOwningObjectTemplate() { |
| if (eContainerFeatureID() != (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0)) return null; |
| return (ObjectTemplateCS)eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwningObjectTemplate(ObjectTemplateCS newOwningObjectTemplate, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject)newOwningObjectTemplate, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOwningObjectTemplate(ObjectTemplateCS newOwningObjectTemplate) { |
| if (newOwningObjectTemplate != eInternalContainer() || (eContainerFeatureID() != (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0) && newOwningObjectTemplate != null)) { |
| if (EcoreUtil.isAncestor(this, newOwningObjectTemplate)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newOwningObjectTemplate != null) |
| msgs = ((InternalEObject)newOwningObjectTemplate).eInverseAdd(this, ExpCSImpl.EXP_CS_FEATURE_COUNT + 3, ObjectTemplateCS.class, msgs); |
| msgs = basicSetOwningObjectTemplate(newOwningObjectTemplate, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0, newOwningObjectTemplate, newOwningObjectTemplate)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Property getPropertyId() { |
| if (propertyId != null && propertyId.eIsProxy()) { |
| InternalEObject oldPropertyId = (InternalEObject)propertyId; |
| propertyId = (Property)eResolveProxy(oldPropertyId); |
| if (propertyId != oldPropertyId) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1, oldPropertyId, propertyId)); |
| } |
| } |
| return propertyId; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Property basicGetPropertyId() { |
| return propertyId; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setPropertyId(Property newPropertyId) { |
| Property oldPropertyId = propertyId; |
| propertyId = newPropertyId; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1, oldPropertyId, propertyId)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public PathNameCS getOwnedOppositePropertyId() { |
| return ownedOppositePropertyId; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwnedOppositePropertyId(PathNameCS newOwnedOppositePropertyId, NotificationChain msgs) { |
| PathNameCS oldOwnedOppositePropertyId = ownedOppositePropertyId; |
| ownedOppositePropertyId = newOwnedOppositePropertyId; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2, oldOwnedOppositePropertyId, newOwnedOppositePropertyId); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOwnedOppositePropertyId(PathNameCS newOwnedOppositePropertyId) { |
| if (newOwnedOppositePropertyId != ownedOppositePropertyId) { |
| NotificationChain msgs = null; |
| if (ownedOppositePropertyId != null) |
| msgs = ((InternalEObject)ownedOppositePropertyId).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2), null, msgs); |
| if (newOwnedOppositePropertyId != null) |
| msgs = ((InternalEObject)newOwnedOppositePropertyId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2), null, msgs); |
| msgs = basicSetOwnedOppositePropertyId(newOwnedOppositePropertyId, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2, newOwnedOppositePropertyId, newOwnedOppositePropertyId)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public ExpCS getOwnedExpression() { |
| return ownedExpression; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwnedExpression(ExpCS newOwnedExpression, NotificationChain msgs) { |
| ExpCS oldOwnedExpression = ownedExpression; |
| ownedExpression = newOwnedExpression; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3, oldOwnedExpression, newOwnedExpression); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOwnedExpression(ExpCS newOwnedExpression) { |
| if (newOwnedExpression != ownedExpression) { |
| NotificationChain msgs = null; |
| if (ownedExpression != null) |
| msgs = ((InternalEObject)ownedExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3), null, msgs); |
| if (newOwnedExpression != null) |
| msgs = ((InternalEObject)newOwnedExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3), null, msgs); |
| msgs = basicSetOwnedExpression(newOwnedExpression, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3, newOwnedExpression, newOwnedExpression)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetOwningObjectTemplate((ObjectTemplateCS)otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- 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 basicSetOwningObjectTemplate(null, msgs); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2: |
| return basicSetOwnedOppositePropertyId(null, msgs); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3: |
| return basicSetOwnedExpression(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch (eContainerFeatureID()) { |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| return eInternalContainer().eInverseRemove(this, ExpCSImpl.EXP_CS_FEATURE_COUNT + 3, ObjectTemplateCS.class, msgs); |
| } |
| return super.eBasicRemoveFromContainerFeature(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 getOwningObjectTemplate(); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| if (resolve) return getPropertyId(); |
| return basicGetPropertyId(); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2: |
| return getOwnedOppositePropertyId(); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3: |
| return getOwnedExpression(); |
| } |
| 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: |
| setOwningObjectTemplate((ObjectTemplateCS)newValue); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| setPropertyId((Property)newValue); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2: |
| setOwnedOppositePropertyId((PathNameCS)newValue); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3: |
| setOwnedExpression((ExpCS)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: |
| setOwningObjectTemplate((ObjectTemplateCS)null); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| setPropertyId((Property)null); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2: |
| setOwnedOppositePropertyId((PathNameCS)null); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3: |
| setOwnedExpression((ExpCS)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 getOwningObjectTemplate() != null; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| return propertyId != null; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2: |
| return ownedOppositePropertyId != null; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3: |
| return ownedExpression != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public <R> R accept(@NonNull BaseCSVisitor<R> visitor) { |
| return (R) ((QVTrelationCSVisitor<?>)visitor).visitPropertyTemplateCS(this); |
| } |
| } //PropertyTemplateCSImpl |