blob: 97d7cc649c6d0791afd148fce03e34563fe1f81c [file] [log] [blame]
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package library.impl;
import java.util.Collection;
import library.Author;
import library.Book;
import library.Library;
import library.LibraryPackage;
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>Library</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link library.impl.LibraryImpl#getBooks <em>Books</em>}</li>
* <li>{@link library.impl.LibraryImpl#getAuthors <em>Authors</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class LibraryImpl extends EObjectImpl implements Library {
/**
* The cached value of the '{@link #getBooks() <em>Books</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBooks()
* @generated
* @ordered
*/
protected EList<Book> books;
/**
* The cached value of the '{@link #getAuthors() <em>Authors</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAuthors()
* @generated
* @ordered
*/
protected EList<Author> authors;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LibraryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return LibraryPackage.Literals.LIBRARY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Book> getBooks() {
if (books == null) {
books = new EObjectContainmentEList<Book>(Book.class, this, LibraryPackage.LIBRARY__BOOKS);
}
return books;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Author> getAuthors() {
if (authors == null) {
authors = new EObjectContainmentEList<Author>(Author.class, this, LibraryPackage.LIBRARY__AUTHORS);
}
return authors;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case LibraryPackage.LIBRARY__BOOKS:
return ((InternalEList<?>)getBooks()).basicRemove(otherEnd, msgs);
case LibraryPackage.LIBRARY__AUTHORS:
return ((InternalEList<?>)getAuthors()).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 LibraryPackage.LIBRARY__BOOKS:
return getBooks();
case LibraryPackage.LIBRARY__AUTHORS:
return getAuthors();
}
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 LibraryPackage.LIBRARY__BOOKS:
getBooks().clear();
getBooks().addAll((Collection<? extends Book>)newValue);
return;
case LibraryPackage.LIBRARY__AUTHORS:
getAuthors().clear();
getAuthors().addAll((Collection<? extends Author>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LibraryPackage.LIBRARY__BOOKS:
getBooks().clear();
return;
case LibraryPackage.LIBRARY__AUTHORS:
getAuthors().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LibraryPackage.LIBRARY__BOOKS:
return books != null && !books.isEmpty();
case LibraryPackage.LIBRARY__AUTHORS:
return authors != null && !authors.isEmpty();
}
return super.eIsSet(featureID);
}
} //LibraryImpl