org.eclipse.xtext.xbase.impl.XIfExpressionImpl 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.XExpression;
import org.eclipse.xtext.xbase.XIfExpression;
import org.eclipse.xtext.xbase.XbasePackage;
/**
*
* An implementation of the model object 'XIf Expression'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.xtext.xbase.impl.XIfExpressionImpl#getIf If}
* - {@link org.eclipse.xtext.xbase.impl.XIfExpressionImpl#getThen Then}
* - {@link org.eclipse.xtext.xbase.impl.XIfExpressionImpl#getElse Else}
*
*
* @generated
*/
public class XIfExpressionImpl extends XExpressionImpl implements XIfExpression
{
/**
* The cached value of the '{@link #getIf() If}' containment reference.
*
*
* @see #getIf()
* @generated
* @ordered
*/
protected XExpression if_;
/**
* The cached value of the '{@link #getThen() Then}' containment reference.
*
*
* @see #getThen()
* @generated
* @ordered
*/
protected XExpression then;
/**
* The cached value of the '{@link #getElse() Else}' containment reference.
*
*
* @see #getElse()
* @generated
* @ordered
*/
protected XExpression else_;
/**
*
*
* @generated
*/
protected XIfExpressionImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return XbasePackage.Literals.XIF_EXPRESSION;
}
/**
*
*
* @generated
*/
public XExpression getIf()
{
return if_;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetIf(XExpression newIf, NotificationChain msgs)
{
XExpression oldIf = if_;
if_ = newIf;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XbasePackage.XIF_EXPRESSION__IF, oldIf, newIf);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setIf(XExpression newIf)
{
if (newIf != if_)
{
NotificationChain msgs = null;
if (if_ != null)
msgs = ((InternalEObject)if_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XIF_EXPRESSION__IF, null, msgs);
if (newIf != null)
msgs = ((InternalEObject)newIf).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XIF_EXPRESSION__IF, null, msgs);
msgs = basicSetIf(newIf, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XIF_EXPRESSION__IF, newIf, newIf));
}
/**
*
*
* @generated
*/
public XExpression getThen()
{
return then;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetThen(XExpression newThen, NotificationChain msgs)
{
XExpression oldThen = then;
then = newThen;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XbasePackage.XIF_EXPRESSION__THEN, oldThen, newThen);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setThen(XExpression newThen)
{
if (newThen != then)
{
NotificationChain msgs = null;
if (then != null)
msgs = ((InternalEObject)then).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XIF_EXPRESSION__THEN, null, msgs);
if (newThen != null)
msgs = ((InternalEObject)newThen).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XIF_EXPRESSION__THEN, null, msgs);
msgs = basicSetThen(newThen, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XIF_EXPRESSION__THEN, newThen, newThen));
}
/**
*
*
* @generated
*/
public XExpression getElse()
{
return else_;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetElse(XExpression newElse, NotificationChain msgs)
{
XExpression oldElse = else_;
else_ = newElse;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XbasePackage.XIF_EXPRESSION__ELSE, oldElse, newElse);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setElse(XExpression newElse)
{
if (newElse != else_)
{
NotificationChain msgs = null;
if (else_ != null)
msgs = ((InternalEObject)else_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XIF_EXPRESSION__ELSE, null, msgs);
if (newElse != null)
msgs = ((InternalEObject)newElse).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XIF_EXPRESSION__ELSE, null, msgs);
msgs = basicSetElse(newElse, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XIF_EXPRESSION__ELSE, newElse, newElse));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XbasePackage.XIF_EXPRESSION__IF:
return basicSetIf(null, msgs);
case XbasePackage.XIF_EXPRESSION__THEN:
return basicSetThen(null, msgs);
case XbasePackage.XIF_EXPRESSION__ELSE:
return basicSetElse(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case XbasePackage.XIF_EXPRESSION__IF:
return getIf();
case XbasePackage.XIF_EXPRESSION__THEN:
return getThen();
case XbasePackage.XIF_EXPRESSION__ELSE:
return getElse();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case XbasePackage.XIF_EXPRESSION__IF:
setIf((XExpression)newValue);
return;
case XbasePackage.XIF_EXPRESSION__THEN:
setThen((XExpression)newValue);
return;
case XbasePackage.XIF_EXPRESSION__ELSE:
setElse((XExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XbasePackage.XIF_EXPRESSION__IF:
setIf((XExpression)null);
return;
case XbasePackage.XIF_EXPRESSION__THEN:
setThen((XExpression)null);
return;
case XbasePackage.XIF_EXPRESSION__ELSE:
setElse((XExpression)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XbasePackage.XIF_EXPRESSION__IF:
return if_ != null;
case XbasePackage.XIF_EXPRESSION__THEN:
return then != null;
case XbasePackage.XIF_EXPRESSION__ELSE:
return else_ != null;
}
return super.eIsSet(featureID);
}
} //XIfExpressionImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy