blob: 0880ce8014d1f85d02e26b547fc652371b1cd3eb [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 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 v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Adolfo Sanchez-Barbudo Herrera - initial API and implementation
*******************************************************************************/
/**
*/
package org.eclipse.qvtd.doc.miniocl.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.qvtd.doc.miniocl.LetExp;
import org.eclipse.qvtd.doc.miniocl.MiniOCLPackage;
import org.eclipse.qvtd.doc.miniocl.OCLExpression;
import org.eclipse.qvtd.doc.miniocl.Variable;
import org.eclipse.qvtd.doc.miniocl.util.Visitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Let Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.doc.miniocl.impl.LetExpImpl#getOwnedIn <em>Owned In</em>}</li>
* <li>{@link org.eclipse.qvtd.doc.miniocl.impl.LetExpImpl#getOwnedVariable <em>Owned Variable</em>}</li>
* </ul>
*
* @generated
*/
public class LetExpImpl extends OCLExpressionImpl implements LetExp {
/**
* The cached value of the '{@link #getOwnedIn() <em>Owned In</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedIn()
* @generated
* @ordered
*/
protected OCLExpression ownedIn;
/**
* The cached value of the '{@link #getOwnedVariable() <em>Owned Variable</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedVariable()
* @generated
* @ordered
*/
protected Variable ownedVariable;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LetExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return MiniOCLPackage.Literals.LET_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OCLExpression getOwnedIn() {
return ownedIn;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedIn(OCLExpression newOwnedIn, NotificationChain msgs) {
OCLExpression oldOwnedIn = ownedIn;
ownedIn = newOwnedIn;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MiniOCLPackage.LET_EXP__OWNED_IN, oldOwnedIn, newOwnedIn);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOwnedIn(OCLExpression newOwnedIn) {
if (newOwnedIn != ownedIn) {
NotificationChain msgs = null;
if (ownedIn != null)
msgs = ((InternalEObject)ownedIn).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.LET_EXP__OWNED_IN, null, msgs);
if (newOwnedIn != null)
msgs = ((InternalEObject)newOwnedIn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.LET_EXP__OWNED_IN, null, msgs);
msgs = basicSetOwnedIn(newOwnedIn, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MiniOCLPackage.LET_EXP__OWNED_IN, newOwnedIn, newOwnedIn));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Variable getOwnedVariable() {
return ownedVariable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedVariable(Variable newOwnedVariable, NotificationChain msgs) {
Variable oldOwnedVariable = ownedVariable;
ownedVariable = newOwnedVariable;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MiniOCLPackage.LET_EXP__OWNED_VARIABLE, oldOwnedVariable, newOwnedVariable);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOwnedVariable(Variable newOwnedVariable) {
if (newOwnedVariable != ownedVariable) {
NotificationChain msgs = null;
if (ownedVariable != null)
msgs = ((InternalEObject)ownedVariable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.LET_EXP__OWNED_VARIABLE, null, msgs);
if (newOwnedVariable != null)
msgs = ((InternalEObject)newOwnedVariable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.LET_EXP__OWNED_VARIABLE, null, msgs);
msgs = basicSetOwnedVariable(newOwnedVariable, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MiniOCLPackage.LET_EXP__OWNED_VARIABLE, newOwnedVariable, newOwnedVariable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case MiniOCLPackage.LET_EXP__OWNED_IN:
return basicSetOwnedIn(null, msgs);
case MiniOCLPackage.LET_EXP__OWNED_VARIABLE:
return basicSetOwnedVariable(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 MiniOCLPackage.LET_EXP__OWNED_IN:
return getOwnedIn();
case MiniOCLPackage.LET_EXP__OWNED_VARIABLE:
return getOwnedVariable();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case MiniOCLPackage.LET_EXP__OWNED_IN:
setOwnedIn((OCLExpression)newValue);
return;
case MiniOCLPackage.LET_EXP__OWNED_VARIABLE:
setOwnedVariable((Variable)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case MiniOCLPackage.LET_EXP__OWNED_IN:
setOwnedIn((OCLExpression)null);
return;
case MiniOCLPackage.LET_EXP__OWNED_VARIABLE:
setOwnedVariable((Variable)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case MiniOCLPackage.LET_EXP__OWNED_IN:
return ownedIn != null;
case MiniOCLPackage.LET_EXP__OWNED_VARIABLE:
return ownedVariable != null;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public <R> R accept(@NonNull Visitor<R> visitor) {
return visitor.visitLetExp(this);
}
} //LetExpImpl