/** */ package com.opcoach.project.impl; import com.opcoach.project.Person; import com.opcoach.project.Project; import com.opcoach.project.ProjectPackage; import com.opcoach.project.MProjectPackage; import com.opcoach.project.Task; import java.lang.reflect.InvocationTargetException; 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.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Project</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link com.opcoach.project.impl.MProjectImpl#getName <em>Name</em>}</li> * <li>{@link com.opcoach.project.impl.MProjectImpl#getTasks <em>Tasks</em>}</li> * <li>{@link com.opcoach.project.impl.MProjectImpl#getChief <em>Chief</em>}</li> * </ul> * </p> * * @generated */ public class MProjectImpl extends MinimalEObjectImpl.Container implements Project { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getTasks() <em>Tasks</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTasks() * @generated * @ordered */ protected EList<Task> tasks; /** * The cached value of the '{@link #getChief() <em>Chief</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getChief() * @generated * @ordered */ protected Person chief; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected MProjectImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return MProjectPackage.Literals.PROJECT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MProjectPackage.PROJECT__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Task> getTasks() { if (tasks == null) { tasks = new EObjectContainmentEList<Task>(Task.class, this, ProjectPackage.PROJECT__TASKS); } return tasks; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Person getChief() { if (chief != null && chief.eIsProxy()) { InternalEObject oldChief = (InternalEObject)chief; chief = (Person)eResolveProxy(oldChief); if (chief != oldChief) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, MProjectPackage.PROJECT__CHIEF, oldChief, chief)); } } return chief; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Person basicGetChief() { return chief; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setChief(Person newChief) { Person oldChief = chief; chief = newChief; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MProjectPackage.PROJECT__CHIEF, oldChief, chief)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Task findFirstTask(Person p) { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case MProjectPackage.PROJECT__TASKS: return ((InternalEList<?>)getTasks()).basicRemove(otherEnd, 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 MProjectPackage.PROJECT__NAME: return getName(); case MProjectPackage.PROJECT__TASKS: return getTasks(); case MProjectPackage.PROJECT__CHIEF: if (resolve) return getChief(); return basicGetChief(); } 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 MProjectPackage.PROJECT__NAME: setName((String)newValue); return; case MProjectPackage.PROJECT__TASKS: getTasks().clear(); getTasks().addAll((Collection<? extends Task>)newValue); return; case MProjectPackage.PROJECT__CHIEF: setChief((Person)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case MProjectPackage.PROJECT__NAME: setName(NAME_EDEFAULT); return; case MProjectPackage.PROJECT__TASKS: getTasks().clear(); return; case MProjectPackage.PROJECT__CHIEF: setChief((Person)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case MProjectPackage.PROJECT__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case MProjectPackage.PROJECT__TASKS: return tasks != null && !tasks.isEmpty(); case MProjectPackage.PROJECT__CHIEF: return chief != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { switch (operationID) { case MProjectPackage.PROJECT___FIND_FIRST_TASK__MPERSON: return findFirstTask((Person)arguments.get(0)); } return super.eInvoke(operationID, arguments); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //MProjectImpl