| /******************************************************************************* |
| * 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.jdt.annotation.NonNull; |
| 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.qvtd.pivot.qvtrelation.SharedVariable; |
| import org.eclipse.qvtd.xtext.qvtrelationcs.DefaultValueCS; |
| 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>Default Value CS</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtrelationcs.impl.DefaultValueCSImpl#getOwnedInitExpression <em>Owned Init Expression</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtrelationcs.impl.DefaultValueCSImpl#getPropertyId <em>Property Id</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class DefaultValueCSImpl extends ModelElementCSImpl implements DefaultValueCS { |
| /** |
| * The number of structural features of the '<em>Default Value CS</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int DEFAULT_VALUE_CS_FEATURE_COUNT = ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2; |
| |
| /** |
| * The cached value of the '{@link #getOwnedInitExpression() <em>Owned Init Expression</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedInitExpression() |
| * @generated |
| * @ordered |
| */ |
| protected ExpCS ownedInitExpression; |
| |
| /** |
| * The cached value of the '{@link #getPropertyId() <em>Property Id</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPropertyId() |
| * @generated |
| * @ordered |
| */ |
| protected SharedVariable propertyId; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected DefaultValueCSImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return QVTrelationCSPackage.Literals.DEFAULT_VALUE_CS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public ExpCS getOwnedInitExpression() { |
| return ownedInitExpression; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwnedInitExpression(ExpCS newOwnedInitExpression, NotificationChain msgs) { |
| ExpCS oldOwnedInitExpression = ownedInitExpression; |
| ownedInitExpression = newOwnedInitExpression; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0, oldOwnedInitExpression, newOwnedInitExpression); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOwnedInitExpression(ExpCS newOwnedInitExpression) { |
| if (newOwnedInitExpression != ownedInitExpression) { |
| NotificationChain msgs = null; |
| if (ownedInitExpression != null) |
| msgs = ((InternalEObject)ownedInitExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0), null, msgs); |
| if (newOwnedInitExpression != null) |
| msgs = ((InternalEObject)newOwnedInitExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0), null, msgs); |
| msgs = basicSetOwnedInitExpression(newOwnedInitExpression, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0, newOwnedInitExpression, newOwnedInitExpression)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public SharedVariable getPropertyId() { |
| if (propertyId != null && propertyId.eIsProxy()) { |
| InternalEObject oldPropertyId = (InternalEObject)propertyId; |
| propertyId = (SharedVariable)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 SharedVariable basicGetPropertyId() { |
| return propertyId; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setPropertyId(SharedVariable newPropertyId) { |
| SharedVariable 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 NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| return basicSetOwnedInitExpression(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 getOwnedInitExpression(); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| if (resolve) return getPropertyId(); |
| return basicGetPropertyId(); |
| } |
| 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: |
| setOwnedInitExpression((ExpCS)newValue); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| setPropertyId((SharedVariable)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: |
| setOwnedInitExpression((ExpCS)null); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| setPropertyId((SharedVariable)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 ownedInitExpression != null; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| return propertyId != 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).visitDefaultValueCS(this); |
| } |
| } //DefaultValueCSImpl |