blob: 031a5d7cbda11b4556ee9171af5ab6dc652355c2 [file] [log] [blame]
/*******************************************************************************
* 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.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.util.Visitor;
import org.eclipse.qvtd.pivot.qvtcorebase.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtcorebase.QVTcoreBasePackage;
import org.eclipse.qvtd.pivot.qvtcorebase.util.QVTcoreBaseVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Property Assignment</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.pivot.qvtcorebase.impl.PropertyAssignmentImpl#getSlotExpression <em>Slot Expression</em>}</li>
* <li>{@link org.eclipse.qvtd.pivot.qvtcorebase.impl.PropertyAssignmentImpl#getTargetProperty <em>Target Property</em>}</li>
* </ul>
*
* @generated
*/
public class PropertyAssignmentImpl extends AssignmentImpl implements PropertyAssignment {
/**
* The cached value of the '{@link #getSlotExpression() <em>Slot Expression</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSlotExpression()
* @generated
* @ordered
*/
protected OCLExpression slotExpression;
/**
* The cached value of the '{@link #getTargetProperty() <em>Target Property</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTargetProperty()
* @generated
* @ordered
*/
protected Property targetProperty;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PropertyAssignmentImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTcoreBasePackage.Literals.PROPERTY_ASSIGNMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public OCLExpression getSlotExpression() {
return slotExpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSlotExpression(OCLExpression newSlotExpression, NotificationChain msgs) {
OCLExpression oldSlotExpression = slotExpression;
slotExpression = newSlotExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QVTcoreBasePackage.PROPERTY_ASSIGNMENT__SLOT_EXPRESSION, oldSlotExpression, newSlotExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setSlotExpression(OCLExpression newSlotExpression) {
if (newSlotExpression != slotExpression) {
NotificationChain msgs = null;
if (slotExpression != null)
msgs = ((InternalEObject)slotExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QVTcoreBasePackage.PROPERTY_ASSIGNMENT__SLOT_EXPRESSION, null, msgs);
if (newSlotExpression != null)
msgs = ((InternalEObject)newSlotExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTcoreBasePackage.PROPERTY_ASSIGNMENT__SLOT_EXPRESSION, null, msgs);
msgs = basicSetSlotExpression(newSlotExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTcoreBasePackage.PROPERTY_ASSIGNMENT__SLOT_EXPRESSION, newSlotExpression, newSlotExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Property getTargetProperty() {
if (targetProperty != null && targetProperty.eIsProxy()) {
InternalEObject oldTargetProperty = (InternalEObject)targetProperty;
targetProperty = (Property)eResolveProxy(oldTargetProperty);
if (targetProperty != oldTargetProperty) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, QVTcoreBasePackage.PROPERTY_ASSIGNMENT__TARGET_PROPERTY, oldTargetProperty, targetProperty));
}
}
return targetProperty;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Property basicGetTargetProperty() {
return targetProperty;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setTargetProperty(Property newTargetProperty) {
Property oldTargetProperty = targetProperty;
targetProperty = newTargetProperty;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTcoreBasePackage.PROPERTY_ASSIGNMENT__TARGET_PROPERTY, oldTargetProperty, targetProperty));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case QVTcoreBasePackage.PROPERTY_ASSIGNMENT__SLOT_EXPRESSION:
return basicSetSlotExpression(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 QVTcoreBasePackage.PROPERTY_ASSIGNMENT__SLOT_EXPRESSION:
return getSlotExpression();
case QVTcoreBasePackage.PROPERTY_ASSIGNMENT__TARGET_PROPERTY:
if (resolve) return getTargetProperty();
return basicGetTargetProperty();
}
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.PROPERTY_ASSIGNMENT__SLOT_EXPRESSION:
setSlotExpression((OCLExpression)newValue);
return;
case QVTcoreBasePackage.PROPERTY_ASSIGNMENT__TARGET_PROPERTY:
setTargetProperty((Property)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case QVTcoreBasePackage.PROPERTY_ASSIGNMENT__SLOT_EXPRESSION:
setSlotExpression((OCLExpression)null);
return;
case QVTcoreBasePackage.PROPERTY_ASSIGNMENT__TARGET_PROPERTY:
setTargetProperty((Property)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case QVTcoreBasePackage.PROPERTY_ASSIGNMENT__SLOT_EXPRESSION:
return slotExpression != null;
case QVTcoreBasePackage.PROPERTY_ASSIGNMENT__TARGET_PROPERTY:
return targetProperty != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public @Nullable <R> R accept(@NonNull Visitor<R> visitor) {
return (R) ((QVTcoreBaseVisitor<?>)visitor).visitPropertyAssignment(this);
}
} //PropertyAssignmentImpl