diff options
Diffstat (limited to 'hibernate/org.eclipse.emf.teneo.hibernate.examples/src/org/eclipse/emf/teneo/hibernate/examples/extlibrary/impl/CirculatingItemImpl.java')
-rwxr-xr-x | hibernate/org.eclipse.emf.teneo.hibernate.examples/src/org/eclipse/emf/teneo/hibernate/examples/extlibrary/impl/CirculatingItemImpl.java | 275 |
1 files changed, 275 insertions, 0 deletions
diff --git a/hibernate/org.eclipse.emf.teneo.hibernate.examples/src/org/eclipse/emf/teneo/hibernate/examples/extlibrary/impl/CirculatingItemImpl.java b/hibernate/org.eclipse.emf.teneo.hibernate.examples/src/org/eclipse/emf/teneo/hibernate/examples/extlibrary/impl/CirculatingItemImpl.java new file mode 100755 index 000000000..e4e9c304e --- /dev/null +++ b/hibernate/org.eclipse.emf.teneo.hibernate.examples/src/org/eclipse/emf/teneo/hibernate/examples/extlibrary/impl/CirculatingItemImpl.java @@ -0,0 +1,275 @@ +/** + * <copyright> + * </copyright> + * + * $Id: CirculatingItemImpl.java,v 1.2 2010/03/02 06:08:38 mtaal Exp $ + */ +package org.eclipse.emf.teneo.hibernate.examples.extlibrary.impl; + +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.util.EObjectWithInverseResolvingEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.emf.teneo.hibernate.examples.extlibrary.Borrower; +import org.eclipse.emf.teneo.hibernate.examples.extlibrary.CirculatingItem; +import org.eclipse.emf.teneo.hibernate.examples.extlibrary.ExtlibraryPackage; +import org.eclipse.emf.teneo.hibernate.examples.extlibrary.Lendable; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Circulating Item</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.teneo.hibernate.examples.extlibrary.impl.CirculatingItemImpl#getCopies <em>Copies</em>}</li> + * <li>{@link org.eclipse.emf.teneo.hibernate.examples.extlibrary.impl.CirculatingItemImpl#getBorrowers <em>Borrowers</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public abstract class CirculatingItemImpl extends ItemImpl implements CirculatingItem { + /** + * The default value of the '{@link #getCopies() <em>Copies</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCopies() + * @generated + * @ordered + */ + protected static final int COPIES_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getCopies() <em>Copies</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCopies() + * @generated + * @ordered + */ + protected int copies = COPIES_EDEFAULT; + + /** + * The cached value of the '{@link #getBorrowers() <em>Borrowers</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getBorrowers() + * @generated + * @ordered + */ + protected EList<Borrower> borrowers; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CirculatingItemImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return ExtlibraryPackage.Literals.CIRCULATING_ITEM; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public int getCopies() { + return copies; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setCopies(int newCopies) { + int oldCopies = copies; + copies = newCopies; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ExtlibraryPackage.CIRCULATING_ITEM__COPIES, oldCopies, copies)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Borrower> getBorrowers() { + if (borrowers == null) { + borrowers = new EObjectWithInverseResolvingEList.ManyInverse<Borrower>(Borrower.class, this, ExtlibraryPackage.CIRCULATING_ITEM__BORROWERS, ExtlibraryPackage.BORROWER__BORROWED); + } + return borrowers; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ExtlibraryPackage.CIRCULATING_ITEM__BORROWERS: + return ((InternalEList<InternalEObject>)(InternalEList<?>)getBorrowers()).basicAdd(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 ExtlibraryPackage.CIRCULATING_ITEM__BORROWERS: + return ((InternalEList<?>)getBorrowers()).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 ExtlibraryPackage.CIRCULATING_ITEM__COPIES: + return getCopies(); + case ExtlibraryPackage.CIRCULATING_ITEM__BORROWERS: + return getBorrowers(); + } + 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 ExtlibraryPackage.CIRCULATING_ITEM__COPIES: + setCopies((Integer)newValue); + return; + case ExtlibraryPackage.CIRCULATING_ITEM__BORROWERS: + getBorrowers().clear(); + getBorrowers().addAll((Collection<? extends Borrower>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ExtlibraryPackage.CIRCULATING_ITEM__COPIES: + setCopies(COPIES_EDEFAULT); + return; + case ExtlibraryPackage.CIRCULATING_ITEM__BORROWERS: + getBorrowers().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ExtlibraryPackage.CIRCULATING_ITEM__COPIES: + return copies != COPIES_EDEFAULT; + case ExtlibraryPackage.CIRCULATING_ITEM__BORROWERS: + return borrowers != null && !borrowers.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { + if (baseClass == Lendable.class) { + switch (derivedFeatureID) { + case ExtlibraryPackage.CIRCULATING_ITEM__COPIES: return ExtlibraryPackage.LENDABLE__COPIES; + case ExtlibraryPackage.CIRCULATING_ITEM__BORROWERS: return ExtlibraryPackage.LENDABLE__BORROWERS; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { + if (baseClass == Lendable.class) { + switch (baseFeatureID) { + case ExtlibraryPackage.LENDABLE__COPIES: return ExtlibraryPackage.CIRCULATING_ITEM__COPIES; + case ExtlibraryPackage.LENDABLE__BORROWERS: return ExtlibraryPackage.CIRCULATING_ITEM__BORROWERS; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (copies: "); + result.append(copies); + result.append(')'); + return result.toString(); + } + +} //CirculatingItemImpl |