/**
*/
package linkedList.impl;
import linkedList.Element;
import linkedList.LinkedListPackage;
import linkedList.List;
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;
/**
*
* An implementation of the model object 'List'.
*
*
* The following features are implemented:
*
*
* - {@link linkedList.impl.ListImpl#getFirst First}
*
*
* @generated
*/
public class ListImpl extends MinimalEObjectImpl.Container implements List {
/**
* The cached value of the '{@link #getFirst() First}' containment reference.
*
*
* @see #getFirst()
* @generated
* @ordered
*/
protected Element first;
/**
*
*
* @generated
*/
protected ListImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return LinkedListPackage.Literals.LIST;
}
/**
*
*
* @generated
*/
public Element getFirst() {
return first;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetFirst(Element newFirst, NotificationChain msgs) {
Element oldFirst = first;
first = newFirst;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LinkedListPackage.LIST__FIRST, oldFirst, newFirst);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setFirst(Element newFirst) {
if (newFirst != first) {
NotificationChain msgs = null;
if (first != null)
msgs = ((InternalEObject)first).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LinkedListPackage.LIST__FIRST, null, msgs);
if (newFirst != null)
msgs = ((InternalEObject)newFirst).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LinkedListPackage.LIST__FIRST, null, msgs);
msgs = basicSetFirst(newFirst, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LinkedListPackage.LIST__FIRST, newFirst, newFirst));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case LinkedListPackage.LIST__FIRST:
return basicSetFirst(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case LinkedListPackage.LIST__FIRST:
return getFirst();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case LinkedListPackage.LIST__FIRST:
setFirst((Element)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LinkedListPackage.LIST__FIRST:
setFirst((Element)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LinkedListPackage.LIST__FIRST:
return first != null;
}
return super.eIsSet(featureID);
}
} //ListImpl