/** */ package com.robotoworks.mechanoid.db.sqliteModel.impl; import com.robotoworks.mechanoid.db.sqliteModel.ConfigBlock; import com.robotoworks.mechanoid.db.sqliteModel.DatabaseBlock; import com.robotoworks.mechanoid.db.sqliteModel.InitBlock; import com.robotoworks.mechanoid.db.sqliteModel.MigrationBlock; import com.robotoworks.mechanoid.db.sqliteModel.SqliteModelPackage; 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.impl.MinimalEObjectImpl; 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>Database Block</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link com.robotoworks.mechanoid.db.sqliteModel.impl.DatabaseBlockImpl#getName <em>Name</em>}</li> * <li>{@link com.robotoworks.mechanoid.db.sqliteModel.impl.DatabaseBlockImpl#getConfig <em>Config</em>}</li> * <li>{@link com.robotoworks.mechanoid.db.sqliteModel.impl.DatabaseBlockImpl#getInit <em>Init</em>}</li> * <li>{@link com.robotoworks.mechanoid.db.sqliteModel.impl.DatabaseBlockImpl#getMigrations <em>Migrations</em>}</li> * </ul> * </p> * * @generated */ public class DatabaseBlockImpl extends MinimalEObjectImpl.Container implements DatabaseBlock { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getConfig() <em>Config</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getConfig() * @generated * @ordered */ protected ConfigBlock config; /** * The cached value of the '{@link #getInit() <em>Init</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getInit() * @generated * @ordered */ protected InitBlock init; /** * The cached value of the '{@link #getMigrations() <em>Migrations</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMigrations() * @generated * @ordered */ protected EList<MigrationBlock> migrations; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DatabaseBlockImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SqliteModelPackage.Literals.DATABASE_BLOCK; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SqliteModelPackage.DATABASE_BLOCK__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ConfigBlock getConfig() { return config; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetConfig(ConfigBlock newConfig, NotificationChain msgs) { ConfigBlock oldConfig = config; config = newConfig; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SqliteModelPackage.DATABASE_BLOCK__CONFIG, oldConfig, newConfig); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setConfig(ConfigBlock newConfig) { if (newConfig != config) { NotificationChain msgs = null; if (config != null) msgs = ((InternalEObject)config).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SqliteModelPackage.DATABASE_BLOCK__CONFIG, null, msgs); if (newConfig != null) msgs = ((InternalEObject)newConfig).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SqliteModelPackage.DATABASE_BLOCK__CONFIG, null, msgs); msgs = basicSetConfig(newConfig, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SqliteModelPackage.DATABASE_BLOCK__CONFIG, newConfig, newConfig)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public InitBlock getInit() { return init; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetInit(InitBlock newInit, NotificationChain msgs) { InitBlock oldInit = init; init = newInit; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SqliteModelPackage.DATABASE_BLOCK__INIT, oldInit, newInit); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setInit(InitBlock newInit) { if (newInit != init) { NotificationChain msgs = null; if (init != null) msgs = ((InternalEObject)init).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SqliteModelPackage.DATABASE_BLOCK__INIT, null, msgs); if (newInit != null) msgs = ((InternalEObject)newInit).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SqliteModelPackage.DATABASE_BLOCK__INIT, null, msgs); msgs = basicSetInit(newInit, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SqliteModelPackage.DATABASE_BLOCK__INIT, newInit, newInit)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<MigrationBlock> getMigrations() { if (migrations == null) { migrations = new EObjectContainmentEList<MigrationBlock>(MigrationBlock.class, this, SqliteModelPackage.DATABASE_BLOCK__MIGRATIONS); } return migrations; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SqliteModelPackage.DATABASE_BLOCK__CONFIG: return basicSetConfig(null, msgs); case SqliteModelPackage.DATABASE_BLOCK__INIT: return basicSetInit(null, msgs); case SqliteModelPackage.DATABASE_BLOCK__MIGRATIONS: return ((InternalEList<?>)getMigrations()).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 SqliteModelPackage.DATABASE_BLOCK__NAME: return getName(); case SqliteModelPackage.DATABASE_BLOCK__CONFIG: return getConfig(); case SqliteModelPackage.DATABASE_BLOCK__INIT: return getInit(); case SqliteModelPackage.DATABASE_BLOCK__MIGRATIONS: return getMigrations(); } 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 SqliteModelPackage.DATABASE_BLOCK__NAME: setName((String)newValue); return; case SqliteModelPackage.DATABASE_BLOCK__CONFIG: setConfig((ConfigBlock)newValue); return; case SqliteModelPackage.DATABASE_BLOCK__INIT: setInit((InitBlock)newValue); return; case SqliteModelPackage.DATABASE_BLOCK__MIGRATIONS: getMigrations().clear(); getMigrations().addAll((Collection<? extends MigrationBlock>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SqliteModelPackage.DATABASE_BLOCK__NAME: setName(NAME_EDEFAULT); return; case SqliteModelPackage.DATABASE_BLOCK__CONFIG: setConfig((ConfigBlock)null); return; case SqliteModelPackage.DATABASE_BLOCK__INIT: setInit((InitBlock)null); return; case SqliteModelPackage.DATABASE_BLOCK__MIGRATIONS: getMigrations().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SqliteModelPackage.DATABASE_BLOCK__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case SqliteModelPackage.DATABASE_BLOCK__CONFIG: return config != null; case SqliteModelPackage.DATABASE_BLOCK__INIT: return init != null; case SqliteModelPackage.DATABASE_BLOCK__MIGRATIONS: return migrations != null && !migrations.isEmpty(); } 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(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //DatabaseBlockImpl