/**
* <copyright>
* </copyright>
*
* $Id: AddressBookImpl.java,v 1.1 2009/05/27 11:45:48 htraetteb Exp $
*/
package org.eclipse.e4.tm.examples.contacts.impl;
import java.util.Collection;
import org.eclipse.e4.tm.examples.contacts.AddressBook;
import org.eclipse.e4.tm.examples.contacts.Contact;
import org.eclipse.e4.tm.examples.contacts.ContactsPackage;
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.EObjectImpl;
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>Address Book</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.e4.tm.examples.contacts.impl.AddressBookImpl#getContacts <em>Contacts</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class AddressBookImpl extends EObjectImpl implements AddressBook {
/**
* The cached value of the '{@link #getContacts() <em>Contacts</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContacts()
* @generated
* @ordered
*/
protected EList<Contact> contacts;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AddressBookImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ContactsPackage.Literals.ADDRESS_BOOK;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Contact> getContacts() {
if (contacts == null) {
contacts = new EObjectContainmentEList<Contact>(Contact.class, this, ContactsPackage.ADDRESS_BOOK__CONTACTS);
}
return contacts;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ContactsPackage.ADDRESS_BOOK__CONTACTS:
return ((InternalEList<?>)getContacts()).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 ContactsPackage.ADDRESS_BOOK__CONTACTS:
return getContacts();
}
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 ContactsPackage.ADDRESS_BOOK__CONTACTS:
getContacts().clear();
getContacts().addAll((Collection<? extends Contact>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ContactsPackage.ADDRESS_BOOK__CONTACTS:
getContacts().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ContactsPackage.ADDRESS_BOOK__CONTACTS:
return contacts != null && !contacts.isEmpty();
}
return super.eIsSet(featureID);
}
} //AddressBookImpl