/** * <copyright> * </copyright> * * $Id$ */ package org.eclipse.gmf.examples.eclipsecon.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.gmf.examples.eclipsecon.EclipseconPackage; import org.eclipse.gmf.examples.eclipsecon.Presenter; import org.eclipse.gmf.examples.eclipsecon.Profile; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Presenter</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.gmf.examples.eclipsecon.impl.PresenterImpl#getPhone <em>Phone</em>}</li> * <li>{@link org.eclipse.gmf.examples.eclipsecon.impl.PresenterImpl#getProfile <em>Profile</em>}</li> * </ul> * </p> * * @generated */ public class PresenterImpl extends ParticipantImpl implements Presenter { /** * The default value of the '{@link #getPhone() <em>Phone</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getPhone() * @generated * @ordered */ protected static final int PHONE_EDEFAULT = 0; /** * The cached value of the '{@link #getPhone() <em>Phone</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getPhone() * @generated * @ordered */ protected int phone = PHONE_EDEFAULT; /** * The cached value of the '{@link #getProfile() <em>Profile</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getProfile() * @generated * @ordered */ protected Profile profile = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected PresenterImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return EclipseconPackage.Literals.PRESENTER; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getPhone() { return phone; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setPhone(int newPhone) { int oldPhone = phone; phone = newPhone; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EclipseconPackage.PRESENTER__PHONE, oldPhone, phone)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Profile getProfile() { return profile; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetProfile(Profile newProfile, NotificationChain msgs) { Profile oldProfile = profile; profile = newProfile; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EclipseconPackage.PRESENTER__PROFILE, oldProfile, newProfile); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setProfile(Profile newProfile) { if (newProfile != profile) { NotificationChain msgs = null; if (profile != null) msgs = ((InternalEObject)profile).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EclipseconPackage.PRESENTER__PROFILE, null, msgs); if (newProfile != null) msgs = ((InternalEObject)newProfile).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EclipseconPackage.PRESENTER__PROFILE, null, msgs); msgs = basicSetProfile(newProfile, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EclipseconPackage.PRESENTER__PROFILE, newProfile, newProfile)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case EclipseconPackage.PRESENTER__PROFILE: return basicSetProfile(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case EclipseconPackage.PRESENTER__PHONE: return new Integer(getPhone()); case EclipseconPackage.PRESENTER__PROFILE: return getProfile(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(int featureID, Object newValue) { switch (featureID) { case EclipseconPackage.PRESENTER__PHONE: setPhone(((Integer)newValue).intValue()); return; case EclipseconPackage.PRESENTER__PROFILE: setProfile((Profile)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(int featureID) { switch (featureID) { case EclipseconPackage.PRESENTER__PHONE: setPhone(PHONE_EDEFAULT); return; case EclipseconPackage.PRESENTER__PROFILE: setProfile((Profile)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(int featureID) { switch (featureID) { case EclipseconPackage.PRESENTER__PHONE: return phone != PHONE_EDEFAULT; case EclipseconPackage.PRESENTER__PROFILE: return profile != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (phone: "); result.append(phone); result.append(')'); return result.toString(); } } //PresenterImpl