org.eclipse.xtext.xbase.impl.XAbstractWhileExpressionImpl Maven / Gradle / Ivy
/**
* Copyright (c) 2011 itemis AG (http://www.itemis.eu) 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
*/
package org.eclipse.xtext.xbase.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.xtext.xbase.XAbstractWhileExpression;
import org.eclipse.xtext.xbase.XExpression;
import org.eclipse.xtext.xbase.XbasePackage;
/**
*
* An implementation of the model object 'XAbstract While Expression'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.xtext.xbase.impl.XAbstractWhileExpressionImpl#getPredicate Predicate}
* - {@link org.eclipse.xtext.xbase.impl.XAbstractWhileExpressionImpl#getBody Body}
*
*
*
* @generated
*/
public abstract class XAbstractWhileExpressionImpl extends XExpressionImpl implements XAbstractWhileExpression
{
/**
* The cached value of the '{@link #getPredicate() Predicate}' containment reference.
*
*
* @see #getPredicate()
* @generated
* @ordered
*/
protected XExpression predicate;
/**
* The cached value of the '{@link #getBody() Body}' containment reference.
*
*
* @see #getBody()
* @generated
* @ordered
*/
protected XExpression body;
/**
*
*
* @generated
*/
protected XAbstractWhileExpressionImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION;
}
/**
*
*
* @generated
*/
public XExpression getPredicate()
{
return predicate;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetPredicate(XExpression newPredicate, NotificationChain msgs)
{
XExpression oldPredicate = predicate;
predicate = newPredicate;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XbasePackage.XABSTRACT_WHILE_EXPRESSION__PREDICATE, oldPredicate, newPredicate);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setPredicate(XExpression newPredicate)
{
if (newPredicate != predicate)
{
NotificationChain msgs = null;
if (predicate != null)
msgs = ((InternalEObject)predicate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XABSTRACT_WHILE_EXPRESSION__PREDICATE, null, msgs);
if (newPredicate != null)
msgs = ((InternalEObject)newPredicate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XABSTRACT_WHILE_EXPRESSION__PREDICATE, null, msgs);
msgs = basicSetPredicate(newPredicate, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XABSTRACT_WHILE_EXPRESSION__PREDICATE, newPredicate, newPredicate));
}
/**
*
*
* @generated
*/
public XExpression getBody()
{
return body;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetBody(XExpression newBody, NotificationChain msgs)
{
XExpression oldBody = body;
body = newBody;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY, oldBody, newBody);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setBody(XExpression newBody)
{
if (newBody != body)
{
NotificationChain msgs = null;
if (body != null)
msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY, null, msgs);
if (newBody != null)
msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY, null, msgs);
msgs = basicSetBody(newBody, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY, newBody, newBody));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XbasePackage.XABSTRACT_WHILE_EXPRESSION__PREDICATE:
return basicSetPredicate(null, msgs);
case XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY:
return basicSetBody(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case XbasePackage.XABSTRACT_WHILE_EXPRESSION__PREDICATE:
return getPredicate();
case XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY:
return getBody();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case XbasePackage.XABSTRACT_WHILE_EXPRESSION__PREDICATE:
setPredicate((XExpression)newValue);
return;
case XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY:
setBody((XExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XbasePackage.XABSTRACT_WHILE_EXPRESSION__PREDICATE:
setPredicate((XExpression)null);
return;
case XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY:
setBody((XExpression)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XbasePackage.XABSTRACT_WHILE_EXPRESSION__PREDICATE:
return predicate != null;
case XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY:
return body != null;
}
return super.eIsSet(featureID);
}
} //XAbstractWhileExpressionImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy