/** * <copyright> * </copyright> * * $Id$ */ package org.eclipse.buckminster.model.common.impl; import java.util.List; import org.eclipse.buckminster.model.common.CommonPackage; import org.eclipse.buckminster.model.common.RxPart; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; /** * <!-- begin-user-doc --> An implementation of the model object ' * <em><b>Rx Part</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.buckminster.model.common.impl.RxPartImpl#getName <em> * Name</em>}</li> * <li>{@link org.eclipse.buckminster.model.common.impl.RxPartImpl#isOptional * <em>Optional</em>}</li> * </ul> * </p> * * @generated */ public abstract class RxPartImpl extends EObjectImpl implements RxPart { /** * 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 default value of the '{@link #isOptional() <em>Optional</em>}' * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #isOptional() * @generated * @ordered */ protected static final boolean OPTIONAL_EDEFAULT = false; /** * The cached value of the '{@link #isOptional() <em>Optional</em>}' * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #isOptional() * @generated * @ordered */ protected boolean optional = OPTIONAL_EDEFAULT; /** * This is true if the Optional attribute has been set. <!-- begin-user-doc * --> <!-- end-user-doc --> * * @generated * @ordered */ protected boolean optionalESet; /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected RxPartImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated NOT */ @Override public abstract void addPattern(StringBuilder collector, List<RxPart> namedParts); /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case CommonPackage.RX_PART__NAME: return getName(); case CommonPackage.RX_PART__OPTIONAL: return isOptional(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case CommonPackage.RX_PART__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case CommonPackage.RX_PART__OPTIONAL: return isSetOptional(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case CommonPackage.RX_PART__NAME: setName((String) newValue); return; case CommonPackage.RX_PART__OPTIONAL: setOptional((Boolean) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case CommonPackage.RX_PART__NAME: setName(NAME_EDEFAULT); return; case CommonPackage.RX_PART__OPTIONAL: unsetOptional(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public String getName() { return name; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public boolean isOptional() { return optional; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public boolean isSetOptional() { return optionalESet; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.RX_PART__NAME, oldName, name)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void setOptional(boolean newOptional) { boolean oldOptional = optional; optional = newOptional; boolean oldOptionalESet = optionalESet; optionalESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.RX_PART__OPTIONAL, oldOptional, optional, !oldOptionalESet)); } /** * <!-- 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(", optional: "); if (optionalESet) result.append(optional); else result.append("<unset>"); result.append(')'); return result.toString(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void unsetOptional() { boolean oldOptional = optional; boolean oldOptionalESet = optionalESet; optional = OPTIONAL_EDEFAULT; optionalESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, CommonPackage.RX_PART__OPTIONAL, oldOptional, OPTIONAL_EDEFAULT, oldOptionalESet)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override protected EClass eStaticClass() { return CommonPackage.Literals.RX_PART; } } // RxPartImpl