| /******************************************************************************* |
| * Copyright (c) 2011, 2015 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: |
| * E.D.Willink - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.qvtd.pivot.qvtcorebase.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.ocl.pivot.OCLExpression; |
| import org.eclipse.ocl.pivot.internal.ElementImpl; |
| import org.eclipse.qvtd.pivot.qvtcorebase.Assignment; |
| import org.eclipse.qvtd.pivot.qvtcorebase.BottomPattern; |
| import org.eclipse.qvtd.pivot.qvtcorebase.QVTcoreBasePackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Assignment</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtcorebase.impl.AssignmentImpl#getBottomPattern <em>Bottom Pattern</em>}</li> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtcorebase.impl.AssignmentImpl#getValue <em>Value</em>}</li> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtcorebase.impl.AssignmentImpl#isIsDefault <em>Is Default</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class AssignmentImpl extends ElementImpl implements Assignment { |
| /** |
| * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValue() |
| * @generated |
| * @ordered |
| */ |
| protected OCLExpression value; |
| |
| /** |
| * The default value of the '{@link #isIsDefault() <em>Is Default</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isIsDefault() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean IS_DEFAULT_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isIsDefault() <em>Is Default</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isIsDefault() |
| * @generated |
| * @ordered |
| */ |
| protected boolean isDefault = IS_DEFAULT_EDEFAULT; |
| |
| /** |
| * This is true if the Is Default attribute has been set. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| protected boolean isDefaultESet; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected AssignmentImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return QVTcoreBasePackage.Literals.ASSIGNMENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public BottomPattern getBottomPattern() { |
| if (eContainerFeatureID() != QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN) return null; |
| return (BottomPattern)eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetBottomPattern(BottomPattern newBottomPattern, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject)newBottomPattern, QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setBottomPattern(BottomPattern newBottomPattern) { |
| if (newBottomPattern != eInternalContainer() || (eContainerFeatureID() != QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN && newBottomPattern != null)) { |
| if (EcoreUtil.isAncestor(this, newBottomPattern)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newBottomPattern != null) |
| msgs = ((InternalEObject)newBottomPattern).eInverseAdd(this, QVTcoreBasePackage.BOTTOM_PATTERN__ASSIGNMENT, BottomPattern.class, msgs); |
| msgs = basicSetBottomPattern(newBottomPattern, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN, newBottomPattern, newBottomPattern)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public OCLExpression getValue() { |
| return value; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetValue(OCLExpression newValue, NotificationChain msgs) { |
| OCLExpression oldValue = value; |
| value = newValue; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QVTcoreBasePackage.ASSIGNMENT__VALUE, oldValue, newValue); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setValue(OCLExpression newValue) { |
| if (newValue != value) { |
| NotificationChain msgs = null; |
| if (value != null) |
| msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QVTcoreBasePackage.ASSIGNMENT__VALUE, null, msgs); |
| if (newValue != null) |
| msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTcoreBasePackage.ASSIGNMENT__VALUE, null, msgs); |
| msgs = basicSetValue(newValue, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, QVTcoreBasePackage.ASSIGNMENT__VALUE, newValue, newValue)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean isIsDefault() { |
| return isDefault; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setIsDefault(boolean newIsDefault) { |
| boolean oldIsDefault = isDefault; |
| isDefault = newIsDefault; |
| boolean oldIsDefaultESet = isDefaultESet; |
| isDefaultESet = true; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, QVTcoreBasePackage.ASSIGNMENT__IS_DEFAULT, oldIsDefault, isDefault, !oldIsDefaultESet)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void unsetIsDefault() { |
| boolean oldIsDefault = isDefault; |
| boolean oldIsDefaultESet = isDefaultESet; |
| isDefault = IS_DEFAULT_EDEFAULT; |
| isDefaultESet = false; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.UNSET, QVTcoreBasePackage.ASSIGNMENT__IS_DEFAULT, oldIsDefault, IS_DEFAULT_EDEFAULT, oldIsDefaultESet)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean isSetIsDefault() { |
| return isDefaultESet; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| return super.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetBottomPattern((BottomPattern)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 QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN: |
| return basicSetBottomPattern(null, msgs); |
| case QVTcoreBasePackage.ASSIGNMENT__VALUE: |
| return basicSetValue(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch (eContainerFeatureID()) { |
| case QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN: |
| return eInternalContainer().eInverseRemove(this, QVTcoreBasePackage.BOTTOM_PATTERN__ASSIGNMENT, BottomPattern.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 QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN: |
| return getBottomPattern(); |
| case QVTcoreBasePackage.ASSIGNMENT__VALUE: |
| return getValue(); |
| case QVTcoreBasePackage.ASSIGNMENT__IS_DEFAULT: |
| return isIsDefault(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN: |
| setBottomPattern((BottomPattern)newValue); |
| return; |
| case QVTcoreBasePackage.ASSIGNMENT__VALUE: |
| setValue((OCLExpression)newValue); |
| return; |
| case QVTcoreBasePackage.ASSIGNMENT__IS_DEFAULT: |
| setIsDefault((Boolean)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN: |
| setBottomPattern((BottomPattern)null); |
| return; |
| case QVTcoreBasePackage.ASSIGNMENT__VALUE: |
| setValue((OCLExpression)null); |
| return; |
| case QVTcoreBasePackage.ASSIGNMENT__IS_DEFAULT: |
| unsetIsDefault(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case QVTcoreBasePackage.ASSIGNMENT__BOTTOM_PATTERN: |
| return getBottomPattern() != null; |
| case QVTcoreBasePackage.ASSIGNMENT__VALUE: |
| return value != null; |
| case QVTcoreBasePackage.ASSIGNMENT__IS_DEFAULT: |
| return isSetIsDefault(); |
| } |
| return super.eIsSet(featureID); |
| } |
| } //AssignmentImpl |