/*******************************************************************************
* Copyright (c) 2009 Jeff McAffer, Ed Merks and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v1.0
* which accompanies this distribution. The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License
* is available at http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Jeff McAffer and Ed Merks - initial API and implementation
*******************************************************************************/
package org.eclipse.examples.toast.backend.data.internal;
import java.net.URI;
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.EObjectImpl;
import org.eclipse.examples.toast.backend.data.IAddress;
import org.eclipse.examples.toast.backend.data.IDriver;
import org.eclipse.examples.toast.backend.data.IToastBackEndDataPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Driver</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.examples.toast.backend.data.internal.Driver#getAddress <em>Address</em>}</li>
* <li>{@link org.eclipse.examples.toast.backend.data.internal.Driver#getFirstName <em>First Name</em>}</li>
* <li>{@link org.eclipse.examples.toast.backend.data.internal.Driver#getImage <em>Image</em>}</li>
* <li>{@link org.eclipse.examples.toast.backend.data.internal.Driver#getLastName <em>Last Name</em>}</li>
* <li>{@link org.eclipse.examples.toast.backend.data.internal.Driver#getId <em>Id</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class Driver extends EObjectImpl implements IDriver {
/**
* The cached value of the '{@link #getAddress() <em>Address</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAddress()
* @generated
* @ordered
*/
protected IAddress address;
/**
* The default value of the '{@link #getFirstName() <em>First Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFirstName()
* @generated
* @ordered
*/
protected static final String FIRST_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getFirstName() <em>First Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFirstName()
* @generated
* @ordered
*/
protected String firstName = FIRST_NAME_EDEFAULT;
/**
* The default value of the '{@link #getImage() <em>Image</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getImage()
* @generated
* @ordered
*/
protected static final URI IMAGE_EDEFAULT = null;
/**
* The cached value of the '{@link #getImage() <em>Image</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getImage()
* @generated
* @ordered
*/
protected URI image = IMAGE_EDEFAULT;
/**
* The default value of the '{@link #getLastName() <em>Last Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLastName()
* @generated
* @ordered
*/
protected static final String LAST_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getLastName() <em>Last Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLastName()
* @generated
* @ordered
*/
protected String lastName = LAST_NAME_EDEFAULT;
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final int ID_EDEFAULT = 0;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected int id = ID_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Driver() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return IToastBackEndDataPackage.Literals.DRIVER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IAddress getAddress() {
return address;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetAddress(IAddress newAddress, NotificationChain msgs) {
IAddress oldAddress = address;
address = newAddress;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IToastBackEndDataPackage.DRIVER__ADDRESS, oldAddress, newAddress);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAddress(IAddress newAddress) {
if (newAddress != address) {
NotificationChain msgs = null;
if (address != null)
msgs = ((InternalEObject)address).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IToastBackEndDataPackage.DRIVER__ADDRESS, null, msgs);
if (newAddress != null)
msgs = ((InternalEObject)newAddress).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IToastBackEndDataPackage.DRIVER__ADDRESS, null, msgs);
msgs = basicSetAddress(newAddress, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IToastBackEndDataPackage.DRIVER__ADDRESS, newAddress, newAddress));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFirstName() {
return firstName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFirstName(String newFirstName) {
String oldFirstName = firstName;
firstName = newFirstName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IToastBackEndDataPackage.DRIVER__FIRST_NAME, oldFirstName, firstName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public URI getImage() {
return image;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setImage(URI newImage) {
URI oldImage = image;
image = newImage;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IToastBackEndDataPackage.DRIVER__IMAGE, oldImage, image));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLastName() {
return lastName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLastName(String newLastName) {
String oldLastName = lastName;
lastName = newLastName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IToastBackEndDataPackage.DRIVER__LAST_NAME, oldLastName, lastName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getId() {
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(int newId) {
int oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IToastBackEndDataPackage.DRIVER__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case IToastBackEndDataPackage.DRIVER__ADDRESS:
return basicSetAddress(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 IToastBackEndDataPackage.DRIVER__ADDRESS:
return getAddress();
case IToastBackEndDataPackage.DRIVER__FIRST_NAME:
return getFirstName();
case IToastBackEndDataPackage.DRIVER__IMAGE:
return getImage();
case IToastBackEndDataPackage.DRIVER__LAST_NAME:
return getLastName();
case IToastBackEndDataPackage.DRIVER__ID:
return getId();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case IToastBackEndDataPackage.DRIVER__ADDRESS:
setAddress((IAddress)newValue);
return;
case IToastBackEndDataPackage.DRIVER__FIRST_NAME:
setFirstName((String)newValue);
return;
case IToastBackEndDataPackage.DRIVER__IMAGE:
setImage((URI)newValue);
return;
case IToastBackEndDataPackage.DRIVER__LAST_NAME:
setLastName((String)newValue);
return;
case IToastBackEndDataPackage.DRIVER__ID:
setId((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case IToastBackEndDataPackage.DRIVER__ADDRESS:
setAddress((IAddress)null);
return;
case IToastBackEndDataPackage.DRIVER__FIRST_NAME:
setFirstName(FIRST_NAME_EDEFAULT);
return;
case IToastBackEndDataPackage.DRIVER__IMAGE:
setImage(IMAGE_EDEFAULT);
return;
case IToastBackEndDataPackage.DRIVER__LAST_NAME:
setLastName(LAST_NAME_EDEFAULT);
return;
case IToastBackEndDataPackage.DRIVER__ID:
setId(ID_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case IToastBackEndDataPackage.DRIVER__ADDRESS:
return address != null;
case IToastBackEndDataPackage.DRIVER__FIRST_NAME:
return FIRST_NAME_EDEFAULT == null ? firstName != null : !FIRST_NAME_EDEFAULT.equals(firstName);
case IToastBackEndDataPackage.DRIVER__IMAGE:
return IMAGE_EDEFAULT == null ? image != null : !IMAGE_EDEFAULT.equals(image);
case IToastBackEndDataPackage.DRIVER__LAST_NAME:
return LAST_NAME_EDEFAULT == null ? lastName != null : !LAST_NAME_EDEFAULT.equals(lastName);
case IToastBackEndDataPackage.DRIVER__ID:
return id != ID_EDEFAULT;
}
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(" (firstName: ");
result.append(firstName);
result.append(", image: ");
result.append(image);
result.append(", lastName: ");
result.append(lastName);
result.append(", id: ");
result.append(id);
result.append(')');
return result.toString();
}
} //Driver