org.eclipse.xtext.impl.CrossReferenceImpl Maven / Gradle / Ivy
/**
*
*
*
* $Id: CrossReferenceImpl.java,v 1.8 2010/04/06 14:10:06 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.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.xtext.AbstractElement;
import org.eclipse.xtext.CrossReference;
import org.eclipse.xtext.TypeRef;
import org.eclipse.xtext.XtextPackage;
/**
*
* An implementation of the model object 'Cross Reference'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.xtext.impl.CrossReferenceImpl#getType Type}
* - {@link org.eclipse.xtext.impl.CrossReferenceImpl#getTerminal Terminal}
*
*
*
* @generated
*/
public class CrossReferenceImpl extends AbstractElementImpl implements CrossReference {
/**
* The cached value of the '{@link #getType() Type}' containment reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected TypeRef type;
/**
* The cached value of the '{@link #getTerminal() Terminal}' containment reference.
*
*
* @see #getTerminal()
* @generated
* @ordered
*/
protected AbstractElement terminal;
/**
*
*
* @generated
*/
protected CrossReferenceImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return XtextPackage.Literals.CROSS_REFERENCE;
}
/**
*
*
* @generated
*/
public TypeRef getType() {
return type;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetType(TypeRef newType, NotificationChain msgs) {
TypeRef oldType = type;
type = newType;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.CROSS_REFERENCE__TYPE, oldType, newType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setType(TypeRef newType) {
if (newType != type) {
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.CROSS_REFERENCE__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.CROSS_REFERENCE__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.CROSS_REFERENCE__TYPE, newType, newType));
}
/**
*
*
* @generated
*/
public AbstractElement getTerminal() {
return terminal;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetTerminal(AbstractElement newTerminal, NotificationChain msgs) {
AbstractElement oldTerminal = terminal;
terminal = newTerminal;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.CROSS_REFERENCE__TERMINAL, oldTerminal, newTerminal);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setTerminal(AbstractElement newTerminal) {
if (newTerminal != terminal) {
NotificationChain msgs = null;
if (terminal != null)
msgs = ((InternalEObject)terminal).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.CROSS_REFERENCE__TERMINAL, null, msgs);
if (newTerminal != null)
msgs = ((InternalEObject)newTerminal).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.CROSS_REFERENCE__TERMINAL, null, msgs);
msgs = basicSetTerminal(newTerminal, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.CROSS_REFERENCE__TERMINAL, newTerminal, newTerminal));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case XtextPackage.CROSS_REFERENCE__TYPE:
return basicSetType(null, msgs);
case XtextPackage.CROSS_REFERENCE__TERMINAL:
return basicSetTerminal(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case XtextPackage.CROSS_REFERENCE__TYPE:
return getType();
case XtextPackage.CROSS_REFERENCE__TERMINAL:
return getTerminal();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case XtextPackage.CROSS_REFERENCE__TYPE:
setType((TypeRef)newValue);
return;
case XtextPackage.CROSS_REFERENCE__TERMINAL:
setTerminal((AbstractElement)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case XtextPackage.CROSS_REFERENCE__TYPE:
setType((TypeRef)null);
return;
case XtextPackage.CROSS_REFERENCE__TERMINAL:
setTerminal((AbstractElement)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case XtextPackage.CROSS_REFERENCE__TYPE:
return type != null;
case XtextPackage.CROSS_REFERENCE__TERMINAL:
return terminal != null;
}
return super.eIsSet(featureID);
}
} //CrossReferenceImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy