/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.eclipse.gmf.examples.ocldriven.toe.impl;
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.gmf.examples.ocldriven.toe.Contribution;
import org.eclipse.gmf.examples.ocldriven.toe.Employee;
import org.eclipse.gmf.examples.ocldriven.toe.Project;
import org.eclipse.gmf.examples.ocldriven.toe.TOEPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Contribution</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmf.examples.ocldriven.toe.impl.ContributionImpl#getDescription <em>Description</em>}</li>
* <li>{@link org.eclipse.gmf.examples.ocldriven.toe.impl.ContributionImpl#getEmployee <em>Employee</em>}</li>
* <li>{@link org.eclipse.gmf.examples.ocldriven.toe.impl.ContributionImpl#getProject <em>Project</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ContributionImpl extends AllBaseImpl implements Contribution {
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* The cached value of the '{@link #getEmployee() <em>Employee</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEmployee()
* @generated
* @ordered
*/
protected Employee employee;
/**
* The cached value of the '{@link #getProject() <em>Project</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProject()
* @generated
* @ordered
*/
protected Project project;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ContributionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TOEPackage.Literals.CONTRIBUTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDescription() {
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDescription(String newDescription) {
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TOEPackage.CONTRIBUTION__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Employee getEmployee() {
if (employee != null && employee.eIsProxy()) {
InternalEObject oldEmployee = (InternalEObject)employee;
employee = (Employee)eResolveProxy(oldEmployee);
if (employee != oldEmployee) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, TOEPackage.CONTRIBUTION__EMPLOYEE, oldEmployee, employee));
}
}
return employee;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Employee basicGetEmployee() {
return employee;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetEmployee(Employee newEmployee, NotificationChain msgs) {
Employee oldEmployee = employee;
employee = newEmployee;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TOEPackage.CONTRIBUTION__EMPLOYEE, oldEmployee, newEmployee);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEmployee(Employee newEmployee) {
if (newEmployee != employee) {
NotificationChain msgs = null;
if (employee != null)
msgs = ((InternalEObject)employee).eInverseRemove(this, TOEPackage.EMPLOYEE__CONTRIBUTIONS, Employee.class, msgs);
if (newEmployee != null)
msgs = ((InternalEObject)newEmployee).eInverseAdd(this, TOEPackage.EMPLOYEE__CONTRIBUTIONS, Employee.class, msgs);
msgs = basicSetEmployee(newEmployee, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TOEPackage.CONTRIBUTION__EMPLOYEE, newEmployee, newEmployee));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Project getProject() {
if (project != null && project.eIsProxy()) {
InternalEObject oldProject = (InternalEObject)project;
project = (Project)eResolveProxy(oldProject);
if (project != oldProject) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, TOEPackage.CONTRIBUTION__PROJECT, oldProject, project));
}
}
return project;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Project basicGetProject() {
return project;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetProject(Project newProject, NotificationChain msgs) {
Project oldProject = project;
project = newProject;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TOEPackage.CONTRIBUTION__PROJECT, oldProject, newProject);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setProject(Project newProject) {
if (newProject != project) {
NotificationChain msgs = null;
if (project != null)
msgs = ((InternalEObject)project).eInverseRemove(this, TOEPackage.PROJECT__CONTRIBUTIONS, Project.class, msgs);
if (newProject != null)
msgs = ((InternalEObject)newProject).eInverseAdd(this, TOEPackage.PROJECT__CONTRIBUTIONS, Project.class, msgs);
msgs = basicSetProject(newProject, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TOEPackage.CONTRIBUTION__PROJECT, newProject, newProject));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TOEPackage.CONTRIBUTION__EMPLOYEE:
if (employee != null)
msgs = ((InternalEObject)employee).eInverseRemove(this, TOEPackage.EMPLOYEE__CONTRIBUTIONS, Employee.class, msgs);
return basicSetEmployee((Employee)otherEnd, msgs);
case TOEPackage.CONTRIBUTION__PROJECT:
if (project != null)
msgs = ((InternalEObject)project).eInverseRemove(this, TOEPackage.PROJECT__CONTRIBUTIONS, Project.class, msgs);
return basicSetProject((Project)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TOEPackage.CONTRIBUTION__EMPLOYEE:
return basicSetEmployee(null, msgs);
case TOEPackage.CONTRIBUTION__PROJECT:
return basicSetProject(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 TOEPackage.CONTRIBUTION__DESCRIPTION:
return getDescription();
case TOEPackage.CONTRIBUTION__EMPLOYEE:
if (resolve) return getEmployee();
return basicGetEmployee();
case TOEPackage.CONTRIBUTION__PROJECT:
if (resolve) return getProject();
return basicGetProject();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TOEPackage.CONTRIBUTION__DESCRIPTION:
setDescription((String)newValue);
return;
case TOEPackage.CONTRIBUTION__EMPLOYEE:
setEmployee((Employee)newValue);
return;
case TOEPackage.CONTRIBUTION__PROJECT:
setProject((Project)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TOEPackage.CONTRIBUTION__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case TOEPackage.CONTRIBUTION__EMPLOYEE:
setEmployee((Employee)null);
return;
case TOEPackage.CONTRIBUTION__PROJECT:
setProject((Project)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TOEPackage.CONTRIBUTION__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case TOEPackage.CONTRIBUTION__EMPLOYEE:
return employee != null;
case TOEPackage.CONTRIBUTION__PROJECT:
return project != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (description: ");
result.append(description);
result.append(')');
return result.toString();
}
} //ContributionImpl