| /** |
| */ |
| 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.MedicationContent; |
| import org.hl7.fhir.Reference; |
| import org.hl7.fhir.SimpleQuantity; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Medication Content</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.hl7.fhir.impl.MedicationContentImpl#getItem <em>Item</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.MedicationContentImpl#getAmount <em>Amount</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MedicationContentImpl extends BackboneElementImpl implements MedicationContent { |
| /** |
| * The cached value of the '{@link #getItem() <em>Item</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getItem() |
| * @generated |
| * @ordered |
| */ |
| protected Reference item; |
| |
| /** |
| * The cached value of the '{@link #getAmount() <em>Amount</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAmount() |
| * @generated |
| * @ordered |
| */ |
| protected SimpleQuantity amount; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MedicationContentImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirPackage.eINSTANCE.getMedicationContent(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Reference getItem() { |
| return item; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetItem(Reference newItem, NotificationChain msgs) { |
| Reference oldItem = item; |
| item = newItem; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_CONTENT__ITEM, oldItem, newItem); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setItem(Reference newItem) { |
| if (newItem != item) { |
| NotificationChain msgs = null; |
| if (item != null) |
| msgs = ((InternalEObject)item).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_CONTENT__ITEM, null, msgs); |
| if (newItem != null) |
| msgs = ((InternalEObject)newItem).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_CONTENT__ITEM, null, msgs); |
| msgs = basicSetItem(newItem, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_CONTENT__ITEM, newItem, newItem)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SimpleQuantity getAmount() { |
| return amount; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetAmount(SimpleQuantity newAmount, NotificationChain msgs) { |
| SimpleQuantity oldAmount = amount; |
| amount = newAmount; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_CONTENT__AMOUNT, oldAmount, newAmount); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setAmount(SimpleQuantity newAmount) { |
| if (newAmount != amount) { |
| NotificationChain msgs = null; |
| if (amount != null) |
| msgs = ((InternalEObject)amount).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_CONTENT__AMOUNT, null, msgs); |
| if (newAmount != null) |
| msgs = ((InternalEObject)newAmount).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_CONTENT__AMOUNT, null, msgs); |
| msgs = basicSetAmount(newAmount, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_CONTENT__AMOUNT, newAmount, newAmount)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirPackage.MEDICATION_CONTENT__ITEM: |
| return basicSetItem(null, msgs); |
| case FhirPackage.MEDICATION_CONTENT__AMOUNT: |
| return basicSetAmount(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.MEDICATION_CONTENT__ITEM: |
| return getItem(); |
| case FhirPackage.MEDICATION_CONTENT__AMOUNT: |
| return getAmount(); |
| } |
| 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.MEDICATION_CONTENT__ITEM: |
| setItem((Reference)newValue); |
| return; |
| case FhirPackage.MEDICATION_CONTENT__AMOUNT: |
| setAmount((SimpleQuantity)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirPackage.MEDICATION_CONTENT__ITEM: |
| setItem((Reference)null); |
| return; |
| case FhirPackage.MEDICATION_CONTENT__AMOUNT: |
| setAmount((SimpleQuantity)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirPackage.MEDICATION_CONTENT__ITEM: |
| return item != null; |
| case FhirPackage.MEDICATION_CONTENT__AMOUNT: |
| return amount != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //MedicationContentImpl |