blob: 15c83fe906cef2d4e3926fcaced4855982371e4a [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.qvtd.doc.miniocl.LoopExp;
import org.eclipse.qvtd.doc.miniocl.MiniOCLPackage;
import org.eclipse.qvtd.doc.miniocl.OCLExpression;
import org.eclipse.qvtd.doc.miniocl.Variable;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Loop Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.doc.miniocl.impl.LoopExpImpl#getOwnedIterator <em>Owned Iterator</em>}</li>
* <li>{@link org.eclipse.qvtd.doc.miniocl.impl.LoopExpImpl#getOwnedBody <em>Owned Body</em>}</li>
* </ul>
*
* @generated
*/
public abstract class LoopExpImpl extends CallExpImpl implements LoopExp {
/**
* The cached value of the '{@link #getOwnedIterator() <em>Owned Iterator</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedIterator()
* @generated
* @ordered
*/
protected Variable ownedIterator;
/**
* The cached value of the '{@link #getOwnedBody() <em>Owned Body</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedBody()
* @generated
* @ordered
*/
protected OCLExpression ownedBody;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LoopExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return MiniOCLPackage.Literals.LOOP_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Variable getOwnedIterator() {
return ownedIterator;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedIterator(Variable newOwnedIterator, NotificationChain msgs) {
Variable oldOwnedIterator = ownedIterator;
ownedIterator = newOwnedIterator;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MiniOCLPackage.LOOP_EXP__OWNED_ITERATOR, oldOwnedIterator, newOwnedIterator);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOwnedIterator(Variable newOwnedIterator) {
if (newOwnedIterator != ownedIterator) {
NotificationChain msgs = null;
if (ownedIterator != null)
msgs = ((InternalEObject)ownedIterator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.LOOP_EXP__OWNED_ITERATOR, null, msgs);
if (newOwnedIterator != null)
msgs = ((InternalEObject)newOwnedIterator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MiniOCLPackage.LOOP_EXP__OWNED_ITERATOR, null, msgs);
msgs = basicSetOwnedIterator(newOwnedIterator, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MiniOCLPackage.LOOP_EXP__OWNED_ITERATOR, newOwnedIterator, newOwnedIterator));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OCLExpression getOwnedBody() {
if (ownedBody != null && ownedBody.eIsProxy()) {
InternalEObject oldOwnedBody = (InternalEObject)ownedBody;
ownedBody = (OCLExpression)eResolveProxy(oldOwnedBody);
if (ownedBody != oldOwnedBody) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, MiniOCLPackage.LOOP_EXP__OWNED_BODY, oldOwnedBody, ownedBody));
}
}
return ownedBody;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OCLExpression basicGetOwnedBody() {
return ownedBody;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOwnedBody(OCLExpression newOwnedBody) {
OCLExpression oldOwnedBody = ownedBody;
ownedBody = newOwnedBody;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MiniOCLPackage.LOOP_EXP__OWNED_BODY, oldOwnedBody, ownedBody));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case MiniOCLPackage.LOOP_EXP__OWNED_ITERATOR:
return basicSetOwnedIterator(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.LOOP_EXP__OWNED_ITERATOR:
return getOwnedIterator();
case MiniOCLPackage.LOOP_EXP__OWNED_BODY:
if (resolve) return getOwnedBody();
return basicGetOwnedBody();
}
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.LOOP_EXP__OWNED_ITERATOR:
setOwnedIterator((Variable)newValue);
return;
case MiniOCLPackage.LOOP_EXP__OWNED_BODY:
setOwnedBody((OCLExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case MiniOCLPackage.LOOP_EXP__OWNED_ITERATOR:
setOwnedIterator((Variable)null);
return;
case MiniOCLPackage.LOOP_EXP__OWNED_BODY:
setOwnedBody((OCLExpression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case MiniOCLPackage.LOOP_EXP__OWNED_ITERATOR:
return ownedIterator != null;
case MiniOCLPackage.LOOP_EXP__OWNED_BODY:
return ownedBody != null;
}
return super.eIsSet(featureID);
}
} //LoopExpImpl