org.eclipse.xtext.xbase.impl.XVariableDeclarationImpl 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.XExpression;
import org.eclipse.xtext.xbase.XVariableDeclaration;
import org.eclipse.xtext.xbase.XbasePackage;
/**
*
* An implementation of the model object 'XVariable Declaration'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.xtext.xbase.impl.XVariableDeclarationImpl#getType Type}
* - {@link org.eclipse.xtext.xbase.impl.XVariableDeclarationImpl#getName Name}
* - {@link org.eclipse.xtext.xbase.impl.XVariableDeclarationImpl#getRight Right}
* - {@link org.eclipse.xtext.xbase.impl.XVariableDeclarationImpl#isWriteable Writeable}
*
*
*
* @generated
*/
public class XVariableDeclarationImpl extends XExpressionImpl implements XVariableDeclaration
{
/**
* The cached value of the '{@link #getType() Type}' containment reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected JvmTypeReference type;
/**
* The default value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getRight() Right}' containment reference.
*
*
* @see #getRight()
* @generated
* @ordered
*/
protected XExpression right;
/**
* The default value of the '{@link #isWriteable() Writeable}' attribute.
*
*
* @see #isWriteable()
* @generated
* @ordered
*/
protected static final boolean WRITEABLE_EDEFAULT = false;
/**
* The cached value of the '{@link #isWriteable() Writeable}' attribute.
*
*
* @see #isWriteable()
* @generated
* @ordered
*/
protected boolean writeable = WRITEABLE_EDEFAULT;
/**
*
*
* @generated
*/
protected XVariableDeclarationImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return XbasePackage.Literals.XVARIABLE_DECLARATION;
}
/**
*
*
* @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.XVARIABLE_DECLARATION__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.XVARIABLE_DECLARATION__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XVARIABLE_DECLARATION__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XVARIABLE_DECLARATION__TYPE, newType, newType));
}
/**
*
*
* @generated
*/
public String getName()
{
return name;
}
/**
*
*
* @generated
*/
public void setName(String newName)
{
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XVARIABLE_DECLARATION__NAME, oldName, name));
}
/**
*
*
* @generated
*/
public XExpression getRight()
{
return right;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetRight(XExpression newRight, NotificationChain msgs)
{
XExpression oldRight = right;
right = newRight;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XbasePackage.XVARIABLE_DECLARATION__RIGHT, oldRight, newRight);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setRight(XExpression newRight)
{
if (newRight != right)
{
NotificationChain msgs = null;
if (right != null)
msgs = ((InternalEObject)right).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XVARIABLE_DECLARATION__RIGHT, null, msgs);
if (newRight != null)
msgs = ((InternalEObject)newRight).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XVARIABLE_DECLARATION__RIGHT, null, msgs);
msgs = basicSetRight(newRight, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XVARIABLE_DECLARATION__RIGHT, newRight, newRight));
}
/**
*
*
* @generated
*/
public boolean isWriteable()
{
return writeable;
}
/**
*
*
* @generated
*/
public void setWriteable(boolean newWriteable)
{
boolean oldWriteable = writeable;
writeable = newWriteable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XVARIABLE_DECLARATION__WRITEABLE, oldWriteable, writeable));
}
/**
*
*
* @generated
*/
public String getIdentifier()
{
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
*
*
* @generated
*/
public String getSimpleName()
{
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
*
*
* @generated
*/
public String getQualifiedName()
{
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
*
*
* @generated
*/
public String getQualifiedName(char innerClassDelimiter)
{
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XbasePackage.XVARIABLE_DECLARATION__TYPE:
return basicSetType(null, msgs);
case XbasePackage.XVARIABLE_DECLARATION__RIGHT:
return basicSetRight(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case XbasePackage.XVARIABLE_DECLARATION__TYPE:
return getType();
case XbasePackage.XVARIABLE_DECLARATION__NAME:
return getName();
case XbasePackage.XVARIABLE_DECLARATION__RIGHT:
return getRight();
case XbasePackage.XVARIABLE_DECLARATION__WRITEABLE:
return isWriteable();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case XbasePackage.XVARIABLE_DECLARATION__TYPE:
setType((JvmTypeReference)newValue);
return;
case XbasePackage.XVARIABLE_DECLARATION__NAME:
setName((String)newValue);
return;
case XbasePackage.XVARIABLE_DECLARATION__RIGHT:
setRight((XExpression)newValue);
return;
case XbasePackage.XVARIABLE_DECLARATION__WRITEABLE:
setWriteable((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XbasePackage.XVARIABLE_DECLARATION__TYPE:
setType((JvmTypeReference)null);
return;
case XbasePackage.XVARIABLE_DECLARATION__NAME:
setName(NAME_EDEFAULT);
return;
case XbasePackage.XVARIABLE_DECLARATION__RIGHT:
setRight((XExpression)null);
return;
case XbasePackage.XVARIABLE_DECLARATION__WRITEABLE:
setWriteable(WRITEABLE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XbasePackage.XVARIABLE_DECLARATION__TYPE:
return type != null;
case XbasePackage.XVARIABLE_DECLARATION__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case XbasePackage.XVARIABLE_DECLARATION__RIGHT:
return right != null;
case XbasePackage.XVARIABLE_DECLARATION__WRITEABLE:
return writeable != WRITEABLE_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", writeable: ");
result.append(writeable);
result.append(')');
return result.toString();
}
} //XVariableDeclarationImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy