/** * Copyright (c) 2009 BestSolution and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * Tom Schindl - Initial API and implementation */ package org.eclipse.emf.test.databinding.emfdb.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; 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.EObjectImpl; import org.eclipse.emf.test.databinding.emfdb.B; import org.eclipse.emf.test.databinding.emfdb.D; import org.eclipse.emf.test.databinding.emfdb.EmfdbPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>B</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.emf.test.databinding.emfdb.impl.BImpl#getString <em>String</em>}</li> * <li>{@link org.eclipse.emf.test.databinding.emfdb.impl.BImpl#getD <em>D</em>}</li> * </ul> * </p> * * @generated */ public class BImpl extends EObjectImpl implements B { /** * The default value of the '{@link #getString() <em>String</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getString() * @generated * @ordered */ protected static final String STRING_EDEFAULT = null; /** * The cached value of the '{@link #getString() <em>String</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getString() * @generated * @ordered */ protected String string = STRING_EDEFAULT; /** * The cached value of the '{@link #getD() <em>D</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getD() * @generated * @ordered */ protected D d; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected BImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return EmfdbPackage.Literals.B; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getString() { return string; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setString(String newString) { String oldString = string; string = newString; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EmfdbPackage.B__STRING, oldString, string)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public D getD() { return d; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetD(D newD, NotificationChain msgs) { D oldD = d; d = newD; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EmfdbPackage.B__D, oldD, newD); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setD(D newD) { if (newD != d) { NotificationChain msgs = null; if (d != null) msgs = ((InternalEObject)d).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EmfdbPackage.B__D, null, msgs); if (newD != null) msgs = ((InternalEObject)newD).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EmfdbPackage.B__D, null, msgs); msgs = basicSetD(newD, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EmfdbPackage.B__D, newD, newD)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case EmfdbPackage.B__D: return basicSetD(null, 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 EmfdbPackage.B__STRING: return getString(); case EmfdbPackage.B__D: return getD(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case EmfdbPackage.B__STRING: setString((String)newValue); return; case EmfdbPackage.B__D: setD((D)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case EmfdbPackage.B__STRING: setString(STRING_EDEFAULT); return; case EmfdbPackage.B__D: setD((D)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case EmfdbPackage.B__STRING: return STRING_EDEFAULT == null ? string != null : !STRING_EDEFAULT.equals(string); case EmfdbPackage.B__D: return d != null; } 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(" (string: "); result.append(string); result.append(')'); return result.toString(); } } //BImpl