blob: 4f4a3f56e970ceb3b34726805826e9dd6c3885fe [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.qvttemplate.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.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.internal.LiteralExpImpl;
import org.eclipse.qvtd.pivot.qvttemplate.QVTtemplatePackage;
import org.eclipse.qvtd.pivot.qvttemplate.TemplateExp;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Template Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.pivot.qvttemplate.impl.TemplateExpImpl#getBindsTo <em>Binds To</em>}</li>
* <li>{@link org.eclipse.qvtd.pivot.qvttemplate.impl.TemplateExpImpl#getWhere <em>Where</em>}</li>
* </ul>
*
* @generated
*/
public abstract class TemplateExpImpl extends LiteralExpImpl implements TemplateExp {
/**
* The cached value of the '{@link #getBindsTo() <em>Binds To</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBindsTo()
* @generated
* @ordered
*/
protected Variable bindsTo;
/**
* The cached value of the '{@link #getWhere() <em>Where</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getWhere()
* @generated
* @ordered
*/
protected OCLExpression where;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TemplateExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTtemplatePackage.Literals.TEMPLATE_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Variable getBindsTo() {
if (bindsTo != null && bindsTo.eIsProxy()) {
InternalEObject oldBindsTo = (InternalEObject)bindsTo;
bindsTo = (Variable)eResolveProxy(oldBindsTo);
if (bindsTo != oldBindsTo) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, QVTtemplatePackage.TEMPLATE_EXP__BINDS_TO, oldBindsTo, bindsTo));
}
}
return bindsTo;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Variable basicGetBindsTo() {
return bindsTo;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setBindsTo(Variable newBindsTo) {
Variable oldBindsTo = bindsTo;
bindsTo = newBindsTo;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTtemplatePackage.TEMPLATE_EXP__BINDS_TO, oldBindsTo, bindsTo));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public OCLExpression getWhere() {
return where;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetWhere(OCLExpression newWhere, NotificationChain msgs) {
OCLExpression oldWhere = where;
where = newWhere;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QVTtemplatePackage.TEMPLATE_EXP__WHERE, oldWhere, newWhere);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setWhere(OCLExpression newWhere) {
if (newWhere != where) {
NotificationChain msgs = null;
if (where != null)
msgs = ((InternalEObject)where).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QVTtemplatePackage.TEMPLATE_EXP__WHERE, null, msgs);
if (newWhere != null)
msgs = ((InternalEObject)newWhere).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTtemplatePackage.TEMPLATE_EXP__WHERE, null, msgs);
msgs = basicSetWhere(newWhere, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTtemplatePackage.TEMPLATE_EXP__WHERE, newWhere, newWhere));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case QVTtemplatePackage.TEMPLATE_EXP__WHERE:
return basicSetWhere(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 QVTtemplatePackage.TEMPLATE_EXP__BINDS_TO:
if (resolve) return getBindsTo();
return basicGetBindsTo();
case QVTtemplatePackage.TEMPLATE_EXP__WHERE:
return getWhere();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case QVTtemplatePackage.TEMPLATE_EXP__BINDS_TO:
setBindsTo((Variable)newValue);
return;
case QVTtemplatePackage.TEMPLATE_EXP__WHERE:
setWhere((OCLExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case QVTtemplatePackage.TEMPLATE_EXP__BINDS_TO:
setBindsTo((Variable)null);
return;
case QVTtemplatePackage.TEMPLATE_EXP__WHERE:
setWhere((OCLExpression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case QVTtemplatePackage.TEMPLATE_EXP__BINDS_TO:
return bindsTo != null;
case QVTtemplatePackage.TEMPLATE_EXP__WHERE:
return where != null;
}
return super.eIsSet(featureID);
}
} //TemplateExpImpl