/**
*/
package org.xtext.builddsl.build.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.xtext.xbase.XExpression;
import org.xtext.builddsl.build.BuildPackage;
import org.xtext.builddsl.build.Task;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Task</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.xtext.builddsl.build.impl.TaskImpl#getDepends <em>Depends</em>}</li>
* <li>{@link org.xtext.builddsl.build.impl.TaskImpl#getAction <em>Action</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class TaskImpl extends DeclarationImpl implements Task
{
/**
* The cached value of the '{@link #getDepends() <em>Depends</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDepends()
* @generated
* @ordered
*/
protected EList<Task> depends;
/**
* The cached value of the '{@link #getAction() <em>Action</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAction()
* @generated
* @ordered
*/
protected XExpression action;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TaskImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return BuildPackage.Literals.TASK;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Task> getDepends()
{
if (depends == null)
{
depends = new EObjectResolvingEList<Task>(Task.class, this, BuildPackage.TASK__DEPENDS);
}
return depends;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public XExpression getAction()
{
return action;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetAction(XExpression newAction, NotificationChain msgs)
{
XExpression oldAction = action;
action = newAction;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BuildPackage.TASK__ACTION, oldAction, newAction);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAction(XExpression newAction)
{
if (newAction != action)
{
NotificationChain msgs = null;
if (action != null)
msgs = ((InternalEObject)action).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - BuildPackage.TASK__ACTION, null, msgs);
if (newAction != null)
msgs = ((InternalEObject)newAction).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - BuildPackage.TASK__ACTION, null, msgs);
msgs = basicSetAction(newAction, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BuildPackage.TASK__ACTION, newAction, newAction));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case BuildPackage.TASK__ACTION:
return basicSetAction(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 BuildPackage.TASK__DEPENDS:
return getDepends();
case BuildPackage.TASK__ACTION:
return getAction();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case BuildPackage.TASK__DEPENDS:
getDepends().clear();
getDepends().addAll((Collection<? extends Task>)newValue);
return;
case BuildPackage.TASK__ACTION:
setAction((XExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case BuildPackage.TASK__DEPENDS:
getDepends().clear();
return;
case BuildPackage.TASK__ACTION:
setAction((XExpression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case BuildPackage.TASK__DEPENDS:
return depends != null && !depends.isEmpty();
case BuildPackage.TASK__ACTION:
return action != null;
}
return super.eIsSet(featureID);
}
} //TaskImpl