org.eclipse.xtext.impl.EnumLiteralDeclarationImpl Maven / Gradle / Ivy
/**
*
*
*
* $Id: EnumLiteralDeclarationImpl.java,v 1.1 2010/04/06 14:09:51 sefftinge Exp $
*/
package org.eclipse.xtext.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.EEnumLiteral;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.xtext.EnumLiteralDeclaration;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.XtextPackage;
/**
*
* An implementation of the model object 'Enum Literal Declaration'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.xtext.impl.EnumLiteralDeclarationImpl#getEnumLiteral Enum Literal}
* - {@link org.eclipse.xtext.impl.EnumLiteralDeclarationImpl#getLiteral Literal}
*
*
*
* @generated
*/
public class EnumLiteralDeclarationImpl extends AbstractElementImpl implements EnumLiteralDeclaration {
/**
* The cached value of the '{@link #getEnumLiteral() Enum Literal}' reference.
*
*
* @see #getEnumLiteral()
* @generated
* @ordered
*/
protected EEnumLiteral enumLiteral;
/**
* The cached value of the '{@link #getLiteral() Literal}' containment reference.
*
*
* @see #getLiteral()
* @generated
* @ordered
*/
protected Keyword literal;
/**
*
*
* @generated
*/
protected EnumLiteralDeclarationImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return XtextPackage.Literals.ENUM_LITERAL_DECLARATION;
}
/**
*
*
* @generated
*/
public EEnumLiteral getEnumLiteral() {
if (enumLiteral != null && enumLiteral.eIsProxy()) {
InternalEObject oldEnumLiteral = (InternalEObject)enumLiteral;
enumLiteral = (EEnumLiteral)eResolveProxy(oldEnumLiteral);
if (enumLiteral != oldEnumLiteral) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, XtextPackage.ENUM_LITERAL_DECLARATION__ENUM_LITERAL, oldEnumLiteral, enumLiteral));
}
}
return enumLiteral;
}
/**
*
*
* @generated
*/
public EEnumLiteral basicGetEnumLiteral() {
return enumLiteral;
}
/**
*
*
* @generated
*/
public void setEnumLiteral(EEnumLiteral newEnumLiteral) {
EEnumLiteral oldEnumLiteral = enumLiteral;
enumLiteral = newEnumLiteral;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.ENUM_LITERAL_DECLARATION__ENUM_LITERAL, oldEnumLiteral, enumLiteral));
}
/**
*
*
* @generated
*/
public Keyword getLiteral() {
return literal;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetLiteral(Keyword newLiteral, NotificationChain msgs) {
Keyword oldLiteral = literal;
literal = newLiteral;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.ENUM_LITERAL_DECLARATION__LITERAL, oldLiteral, newLiteral);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setLiteral(Keyword newLiteral) {
if (newLiteral != literal) {
NotificationChain msgs = null;
if (literal != null)
msgs = ((InternalEObject)literal).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.ENUM_LITERAL_DECLARATION__LITERAL, null, msgs);
if (newLiteral != null)
msgs = ((InternalEObject)newLiteral).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.ENUM_LITERAL_DECLARATION__LITERAL, null, msgs);
msgs = basicSetLiteral(newLiteral, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.ENUM_LITERAL_DECLARATION__LITERAL, newLiteral, newLiteral));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case XtextPackage.ENUM_LITERAL_DECLARATION__LITERAL:
return basicSetLiteral(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case XtextPackage.ENUM_LITERAL_DECLARATION__ENUM_LITERAL:
if (resolve) return getEnumLiteral();
return basicGetEnumLiteral();
case XtextPackage.ENUM_LITERAL_DECLARATION__LITERAL:
return getLiteral();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case XtextPackage.ENUM_LITERAL_DECLARATION__ENUM_LITERAL:
setEnumLiteral((EEnumLiteral)newValue);
return;
case XtextPackage.ENUM_LITERAL_DECLARATION__LITERAL:
setLiteral((Keyword)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case XtextPackage.ENUM_LITERAL_DECLARATION__ENUM_LITERAL:
setEnumLiteral((EEnumLiteral)null);
return;
case XtextPackage.ENUM_LITERAL_DECLARATION__LITERAL:
setLiteral((Keyword)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case XtextPackage.ENUM_LITERAL_DECLARATION__ENUM_LITERAL:
return enumLiteral != null;
case XtextPackage.ENUM_LITERAL_DECLARATION__LITERAL:
return literal != null;
}
return super.eIsSet(featureID);
}
} //EnumLiteralDeclarationImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy