blob: 6e014d19d2fc67a334e1b24f7f80e8a347c4831f [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2013, 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
*
* </copyright>
*/
package org.eclipse.qvtd.pivot.qvtcore.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.qvtbase.impl.PatternImpl;
import org.eclipse.qvtd.pivot.qvtcore.Assignment;
import org.eclipse.qvtd.pivot.qvtcore.BottomPattern;
import org.eclipse.qvtd.pivot.qvtcore.QVTcorePackage;
/**
* <!-- 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.qvtcore.impl.AssignmentImpl#getBottomPattern <em>Bottom Pattern</em>}</li>
* <li>{@link org.eclipse.qvtd.pivot.qvtcore.impl.AssignmentImpl#getValue <em>Value</em>}</li>
* <li>{@link org.eclipse.qvtd.pivot.qvtcore.impl.AssignmentImpl#isIsDefault <em>Is Default</em>}</li>
* <li>{@link org.eclipse.qvtd.pivot.qvtcore.impl.AssignmentImpl#isIsPartial <em>Is Partial</em>}</li>
* </ul>
*
* @generated
*/
public abstract class AssignmentImpl extends ElementImpl implements Assignment {
/**
* The number of structural features of the '<em>Assignment</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int ASSIGNMENT_FEATURE_COUNT = ElementImpl.ELEMENT_FEATURE_COUNT + 4;
/**
* The number of operations of the '<em>Assignment</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int ASSIGNMENT_OPERATION_COUNT = ElementImpl.ELEMENT_OPERATION_COUNT + 0;
/**
* 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;
/**
* The default value of the '{@link #isIsPartial() <em>Is Partial</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsPartial()
* @generated
* @ordered
*/
protected static final boolean IS_PARTIAL_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsPartial() <em>Is Partial</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsPartial()
* @generated
* @ordered
*/
protected boolean isPartial = IS_PARTIAL_EDEFAULT;
/**
* This is true if the Is Partial attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean isPartialESet;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AssignmentImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTcorePackage.Literals.ASSIGNMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public BottomPattern getBottomPattern() {
if (eContainerFeatureID() != (ElementImpl.ELEMENT_FEATURE_COUNT + 0)) return null;
return (BottomPattern)eInternalContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetBottomPattern(BottomPattern newBottomPattern, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newBottomPattern, ElementImpl.ELEMENT_FEATURE_COUNT + 0, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setBottomPattern(BottomPattern newBottomPattern) {
if (newBottomPattern != eInternalContainer() || (eContainerFeatureID() != (ElementImpl.ELEMENT_FEATURE_COUNT + 0) && 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, PatternImpl.PATTERN_FEATURE_COUNT + 2, BottomPattern.class, msgs);
msgs = basicSetBottomPattern(newBottomPattern, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ElementImpl.ELEMENT_FEATURE_COUNT + 0, 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, ElementImpl.ELEMENT_FEATURE_COUNT + 1, 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 - (ElementImpl.ELEMENT_FEATURE_COUNT + 1), null, msgs);
if (newValue != null)
msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (ElementImpl.ELEMENT_FEATURE_COUNT + 1), null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ElementImpl.ELEMENT_FEATURE_COUNT + 1, 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, ElementImpl.ELEMENT_FEATURE_COUNT + 2, 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, ElementImpl.ELEMENT_FEATURE_COUNT + 2, 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 boolean isIsPartial() {
return isPartial;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsPartial(boolean newIsPartial) {
boolean oldIsPartial = isPartial;
isPartial = newIsPartial;
boolean oldIsPartialESet = isPartialESet;
isPartialESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ElementImpl.ELEMENT_FEATURE_COUNT + 3, oldIsPartial, isPartial, !oldIsPartialESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void unsetIsPartial() {
boolean oldIsPartial = isPartial;
boolean oldIsPartialESet = isPartialESet;
isPartial = IS_PARTIAL_EDEFAULT;
isPartialESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, ElementImpl.ELEMENT_FEATURE_COUNT + 3, oldIsPartial, IS_PARTIAL_EDEFAULT, oldIsPartialESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isSetIsPartial() {
return isPartialESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@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 ElementImpl.ELEMENT_FEATURE_COUNT + 0:
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 ElementImpl.ELEMENT_FEATURE_COUNT + 0:
return basicSetBottomPattern(null, msgs);
case ElementImpl.ELEMENT_FEATURE_COUNT + 1:
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 ElementImpl.ELEMENT_FEATURE_COUNT + 0:
return eInternalContainer().eInverseRemove(this, PatternImpl.PATTERN_FEATURE_COUNT + 2, 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 ElementImpl.ELEMENT_FEATURE_COUNT + 0:
return getBottomPattern();
case ElementImpl.ELEMENT_FEATURE_COUNT + 1:
return getValue();
case ElementImpl.ELEMENT_FEATURE_COUNT + 2:
return isIsDefault();
case ElementImpl.ELEMENT_FEATURE_COUNT + 3:
return isIsPartial();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ElementImpl.ELEMENT_FEATURE_COUNT + 0:
setBottomPattern((BottomPattern)newValue);
return;
case ElementImpl.ELEMENT_FEATURE_COUNT + 1:
setValue((OCLExpression)newValue);
return;
case ElementImpl.ELEMENT_FEATURE_COUNT + 2:
setIsDefault((Boolean)newValue);
return;
case ElementImpl.ELEMENT_FEATURE_COUNT + 3:
setIsPartial((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ElementImpl.ELEMENT_FEATURE_COUNT + 0:
setBottomPattern((BottomPattern)null);
return;
case ElementImpl.ELEMENT_FEATURE_COUNT + 1:
setValue((OCLExpression)null);
return;
case ElementImpl.ELEMENT_FEATURE_COUNT + 2:
unsetIsDefault();
return;
case ElementImpl.ELEMENT_FEATURE_COUNT + 3:
unsetIsPartial();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ElementImpl.ELEMENT_FEATURE_COUNT + 0:
return getBottomPattern() != null;
case ElementImpl.ELEMENT_FEATURE_COUNT + 1:
return value != null;
case ElementImpl.ELEMENT_FEATURE_COUNT + 2:
return isSetIsDefault();
case ElementImpl.ELEMENT_FEATURE_COUNT + 3:
return isSetIsPartial();
}
return super.eIsSet(featureID);
}
} //AssignmentImpl