| /** |
| */ |
| package org.hl7.fhir.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.hl7.fhir.FhirPackage; |
| import org.hl7.fhir.Ratio; |
| import org.hl7.fhir.Reference; |
| import org.hl7.fhir.SubstanceIngredient; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Substance Ingredient</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.hl7.fhir.impl.SubstanceIngredientImpl#getQuantity <em>Quantity</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.SubstanceIngredientImpl#getSubstance <em>Substance</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SubstanceIngredientImpl extends BackboneElementImpl implements SubstanceIngredient { |
| /** |
| * The cached value of the '{@link #getQuantity() <em>Quantity</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getQuantity() |
| * @generated |
| * @ordered |
| */ |
| protected Ratio quantity; |
| |
| /** |
| * The cached value of the '{@link #getSubstance() <em>Substance</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSubstance() |
| * @generated |
| * @ordered |
| */ |
| protected Reference substance; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SubstanceIngredientImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirPackage.eINSTANCE.getSubstanceIngredient(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Ratio getQuantity() { |
| return quantity; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetQuantity(Ratio newQuantity, NotificationChain msgs) { |
| Ratio oldQuantity = quantity; |
| quantity = newQuantity; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.SUBSTANCE_INGREDIENT__QUANTITY, oldQuantity, newQuantity); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setQuantity(Ratio newQuantity) { |
| if (newQuantity != quantity) { |
| NotificationChain msgs = null; |
| if (quantity != null) |
| msgs = ((InternalEObject)quantity).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.SUBSTANCE_INGREDIENT__QUANTITY, null, msgs); |
| if (newQuantity != null) |
| msgs = ((InternalEObject)newQuantity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.SUBSTANCE_INGREDIENT__QUANTITY, null, msgs); |
| msgs = basicSetQuantity(newQuantity, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.SUBSTANCE_INGREDIENT__QUANTITY, newQuantity, newQuantity)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Reference getSubstance() { |
| return substance; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSubstance(Reference newSubstance, NotificationChain msgs) { |
| Reference oldSubstance = substance; |
| substance = newSubstance; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.SUBSTANCE_INGREDIENT__SUBSTANCE, oldSubstance, newSubstance); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSubstance(Reference newSubstance) { |
| if (newSubstance != substance) { |
| NotificationChain msgs = null; |
| if (substance != null) |
| msgs = ((InternalEObject)substance).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.SUBSTANCE_INGREDIENT__SUBSTANCE, null, msgs); |
| if (newSubstance != null) |
| msgs = ((InternalEObject)newSubstance).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.SUBSTANCE_INGREDIENT__SUBSTANCE, null, msgs); |
| msgs = basicSetSubstance(newSubstance, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.SUBSTANCE_INGREDIENT__SUBSTANCE, newSubstance, newSubstance)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirPackage.SUBSTANCE_INGREDIENT__QUANTITY: |
| return basicSetQuantity(null, msgs); |
| case FhirPackage.SUBSTANCE_INGREDIENT__SUBSTANCE: |
| return basicSetSubstance(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 FhirPackage.SUBSTANCE_INGREDIENT__QUANTITY: |
| return getQuantity(); |
| case FhirPackage.SUBSTANCE_INGREDIENT__SUBSTANCE: |
| return getSubstance(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FhirPackage.SUBSTANCE_INGREDIENT__QUANTITY: |
| setQuantity((Ratio)newValue); |
| return; |
| case FhirPackage.SUBSTANCE_INGREDIENT__SUBSTANCE: |
| setSubstance((Reference)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirPackage.SUBSTANCE_INGREDIENT__QUANTITY: |
| setQuantity((Ratio)null); |
| return; |
| case FhirPackage.SUBSTANCE_INGREDIENT__SUBSTANCE: |
| setSubstance((Reference)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirPackage.SUBSTANCE_INGREDIENT__QUANTITY: |
| return quantity != null; |
| case FhirPackage.SUBSTANCE_INGREDIENT__SUBSTANCE: |
| return substance != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //SubstanceIngredientImpl |