/**
* <copyright>
* </copyright>
*
*/
package org.applause.lang.applauseDsl.impl;
import org.applause.lang.applauseDsl.ApplauseDslPackage;
import org.applause.lang.applauseDsl.CollectionExpression;
import org.applause.lang.applauseDsl.CollectionIterator;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Collection Iterator</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.applause.lang.applauseDsl.impl.CollectionIteratorImpl#getCollection <em>Collection</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class CollectionIteratorImpl extends VariableDeclarationImpl implements CollectionIterator
{
/**
* The cached value of the '{@link #getCollection() <em>Collection</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCollection()
* @generated
* @ordered
*/
protected CollectionExpression collection;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CollectionIteratorImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ApplauseDslPackage.Literals.COLLECTION_ITERATOR;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CollectionExpression getCollection()
{
return collection;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCollection(CollectionExpression newCollection, NotificationChain msgs)
{
CollectionExpression oldCollection = collection;
collection = newCollection;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ApplauseDslPackage.COLLECTION_ITERATOR__COLLECTION, oldCollection, newCollection);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCollection(CollectionExpression newCollection)
{
if (newCollection != collection)
{
NotificationChain msgs = null;
if (collection != null)
msgs = ((InternalEObject)collection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ApplauseDslPackage.COLLECTION_ITERATOR__COLLECTION, null, msgs);
if (newCollection != null)
msgs = ((InternalEObject)newCollection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ApplauseDslPackage.COLLECTION_ITERATOR__COLLECTION, null, msgs);
msgs = basicSetCollection(newCollection, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ApplauseDslPackage.COLLECTION_ITERATOR__COLLECTION, newCollection, newCollection));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case ApplauseDslPackage.COLLECTION_ITERATOR__COLLECTION:
return basicSetCollection(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 ApplauseDslPackage.COLLECTION_ITERATOR__COLLECTION:
return getCollection();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case ApplauseDslPackage.COLLECTION_ITERATOR__COLLECTION:
setCollection((CollectionExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ApplauseDslPackage.COLLECTION_ITERATOR__COLLECTION:
setCollection((CollectionExpression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ApplauseDslPackage.COLLECTION_ITERATOR__COLLECTION:
return collection != null;
}
return super.eIsSet(featureID);
}
} //CollectionIteratorImpl