org.eclipse.xtext.xbase.impl.XCastedExpressionImpl 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.common.types.JvmTypeReference;
import org.eclipse.xtext.xbase.XCastedExpression;
import org.eclipse.xtext.xbase.XExpression;
import org.eclipse.xtext.xbase.XbasePackage;
/**
*
* An implementation of the model object 'XCasted Expression'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.xtext.xbase.impl.XCastedExpressionImpl#getType Type}
* - {@link org.eclipse.xtext.xbase.impl.XCastedExpressionImpl#getTarget Target}
*
*
*
* @generated
*/
public class XCastedExpressionImpl extends XExpressionImpl implements XCastedExpression
{
/**
* The cached value of the '{@link #getType() Type}' containment reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected JvmTypeReference type;
/**
* The cached value of the '{@link #getTarget() Target}' containment reference.
*
*
* @see #getTarget()
* @generated
* @ordered
*/
protected XExpression target;
/**
*
*
* @generated
*/
protected XCastedExpressionImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return XbasePackage.Literals.XCASTED_EXPRESSION;
}
/**
*
*
* @generated
*/
public JvmTypeReference getType()
{
return type;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetType(JvmTypeReference newType, NotificationChain msgs)
{
JvmTypeReference oldType = type;
type = newType;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XbasePackage.XCASTED_EXPRESSION__TYPE, oldType, newType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setType(JvmTypeReference newType)
{
if (newType != type)
{
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XCASTED_EXPRESSION__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XCASTED_EXPRESSION__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XCASTED_EXPRESSION__TYPE, newType, newType));
}
/**
*
*
* @generated
*/
public XExpression getTarget()
{
return target;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetTarget(XExpression newTarget, NotificationChain msgs)
{
XExpression oldTarget = target;
target = newTarget;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XbasePackage.XCASTED_EXPRESSION__TARGET, oldTarget, newTarget);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setTarget(XExpression newTarget)
{
if (newTarget != target)
{
NotificationChain msgs = null;
if (target != null)
msgs = ((InternalEObject)target).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XCASTED_EXPRESSION__TARGET, null, msgs);
if (newTarget != null)
msgs = ((InternalEObject)newTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XCASTED_EXPRESSION__TARGET, null, msgs);
msgs = basicSetTarget(newTarget, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XCASTED_EXPRESSION__TARGET, newTarget, newTarget));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XbasePackage.XCASTED_EXPRESSION__TYPE:
return basicSetType(null, msgs);
case XbasePackage.XCASTED_EXPRESSION__TARGET:
return basicSetTarget(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case XbasePackage.XCASTED_EXPRESSION__TYPE:
return getType();
case XbasePackage.XCASTED_EXPRESSION__TARGET:
return getTarget();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case XbasePackage.XCASTED_EXPRESSION__TYPE:
setType((JvmTypeReference)newValue);
return;
case XbasePackage.XCASTED_EXPRESSION__TARGET:
setTarget((XExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XbasePackage.XCASTED_EXPRESSION__TYPE:
setType((JvmTypeReference)null);
return;
case XbasePackage.XCASTED_EXPRESSION__TARGET:
setTarget((XExpression)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XbasePackage.XCASTED_EXPRESSION__TYPE:
return type != null;
case XbasePackage.XCASTED_EXPRESSION__TARGET:
return target != null;
}
return super.eIsSet(featureID);
}
} //XCastedExpressionImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy