/** * Copyright (c) 2011 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Obeo - initial API and implementation */ package org.obeonetwork.dsl.database.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.EObject; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.util.InternalEList; import org.obeonetwork.dsl.database.AbstractTable; import org.obeonetwork.dsl.database.Column; import org.obeonetwork.dsl.database.DatabasePackage; import org.obeonetwork.dsl.database.TableContainer; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Abstract Table</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.obeonetwork.dsl.database.impl.AbstractTableImpl#getColumns <em>Columns</em>}</li> * <li>{@link org.obeonetwork.dsl.database.impl.AbstractTableImpl#getOwner <em>Owner</em>}</li> * </ul> * </p> * * @generated */ public abstract class AbstractTableImpl extends NamedElementImpl implements AbstractTable { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2011 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AbstractTableImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return DatabasePackage.Literals.ABSTRACT_TABLE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") public EList<Column> getColumns() { return (EList<Column>)eDynamicGet(DatabasePackage.ABSTRACT_TABLE__COLUMNS, DatabasePackage.Literals.ABSTRACT_TABLE__COLUMNS, true, true); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TableContainer getOwner() { return (TableContainer)eDynamicGet(DatabasePackage.ABSTRACT_TABLE__OWNER, DatabasePackage.Literals.ABSTRACT_TABLE__OWNER, true, true); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetOwner(TableContainer newOwner, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newOwner, DatabasePackage.ABSTRACT_TABLE__OWNER, msgs); return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setOwner(TableContainer newOwner) { eDynamicSet(DatabasePackage.ABSTRACT_TABLE__OWNER, DatabasePackage.Literals.ABSTRACT_TABLE__OWNER, newOwner); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DatabasePackage.ABSTRACT_TABLE__COLUMNS: return ((InternalEList<InternalEObject>)(InternalEList<?>)getColumns()).basicAdd(otherEnd, msgs); case DatabasePackage.ABSTRACT_TABLE__OWNER: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetOwner((TableContainer)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 DatabasePackage.ABSTRACT_TABLE__COLUMNS: return ((InternalEList<?>)getColumns()).basicRemove(otherEnd, msgs); case DatabasePackage.ABSTRACT_TABLE__OWNER: return basicSetOwner(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case DatabasePackage.ABSTRACT_TABLE__OWNER: return eInternalContainer().eInverseRemove(this, DatabasePackage.TABLE_CONTAINER__TABLES, TableContainer.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case DatabasePackage.ABSTRACT_TABLE__COLUMNS: return getColumns(); case DatabasePackage.ABSTRACT_TABLE__OWNER: return getOwner(); } 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 DatabasePackage.ABSTRACT_TABLE__COLUMNS: getColumns().clear(); getColumns().addAll((Collection<? extends Column>)newValue); return; case DatabasePackage.ABSTRACT_TABLE__OWNER: setOwner((TableContainer)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case DatabasePackage.ABSTRACT_TABLE__COLUMNS: getColumns().clear(); return; case DatabasePackage.ABSTRACT_TABLE__OWNER: setOwner((TableContainer)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public boolean eIsSet(int featureID) { switch (featureID) { case DatabasePackage.ABSTRACT_TABLE__COLUMNS: return !getColumns().isEmpty(); case DatabasePackage.ABSTRACT_TABLE__OWNER: return getOwner() != null; } return super.eIsSet(featureID); } } //AbstractTableImpl