RDL-Editor/com.minres.rdl.parent/com.minres.rdl/src-gen/com/minres/rdl/rdl/impl/InstanceRefImpl.java

265 lines
6.2 KiB
Java

/**
* generated by Xtext 2.26.0
*/
package com.minres.rdl.rdl.impl;
import com.minres.rdl.rdl.Entity;
import com.minres.rdl.rdl.InstanceRef;
import com.minres.rdl.rdl.RdlPackage;
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.emf.ecore.impl.MinimalEObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Instance Ref</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link com.minres.rdl.rdl.impl.InstanceRefImpl#getInstance <em>Instance</em>}</li>
* <li>{@link com.minres.rdl.rdl.impl.InstanceRefImpl#getTail <em>Tail</em>}</li>
* </ul>
*
* @generated
*/
public class InstanceRefImpl extends MinimalEObjectImpl.Container implements InstanceRef
{
/**
* The cached value of the '{@link #getInstance() <em>Instance</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInstance()
* @generated
* @ordered
*/
protected Entity instance;
/**
* The cached value of the '{@link #getTail() <em>Tail</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTail()
* @generated
* @ordered
*/
protected InstanceRef tail;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected InstanceRefImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return RdlPackage.Literals.INSTANCE_REF;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Entity getInstance()
{
if (instance != null && instance.eIsProxy())
{
InternalEObject oldInstance = (InternalEObject)instance;
instance = (Entity)eResolveProxy(oldInstance);
if (instance != oldInstance)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RdlPackage.INSTANCE_REF__INSTANCE, oldInstance, instance));
}
}
return instance;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Entity basicGetInstance()
{
return instance;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setInstance(Entity newInstance)
{
Entity oldInstance = instance;
instance = newInstance;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RdlPackage.INSTANCE_REF__INSTANCE, oldInstance, instance));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public InstanceRef getTail()
{
return tail;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTail(InstanceRef newTail, NotificationChain msgs)
{
InstanceRef oldTail = tail;
tail = newTail;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RdlPackage.INSTANCE_REF__TAIL, oldTail, newTail);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setTail(InstanceRef newTail)
{
if (newTail != tail)
{
NotificationChain msgs = null;
if (tail != null)
msgs = ((InternalEObject)tail).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RdlPackage.INSTANCE_REF__TAIL, null, msgs);
if (newTail != null)
msgs = ((InternalEObject)newTail).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RdlPackage.INSTANCE_REF__TAIL, null, msgs);
msgs = basicSetTail(newTail, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RdlPackage.INSTANCE_REF__TAIL, newTail, newTail));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case RdlPackage.INSTANCE_REF__TAIL:
return basicSetTail(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case RdlPackage.INSTANCE_REF__INSTANCE:
if (resolve) return getInstance();
return basicGetInstance();
case RdlPackage.INSTANCE_REF__TAIL:
return getTail();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case RdlPackage.INSTANCE_REF__INSTANCE:
setInstance((Entity)newValue);
return;
case RdlPackage.INSTANCE_REF__TAIL:
setTail((InstanceRef)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case RdlPackage.INSTANCE_REF__INSTANCE:
setInstance((Entity)null);
return;
case RdlPackage.INSTANCE_REF__TAIL:
setTail((InstanceRef)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case RdlPackage.INSTANCE_REF__INSTANCE:
return instance != null;
case RdlPackage.INSTANCE_REF__TAIL:
return tail != null;
}
return super.eIsSet(featureID);
}
} //InstanceRefImpl