| /******************************************************************************* |
| * Copyright (c) 2016 David Carlson and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * David Carlson (Clinical Cloud Solutions, LLC) - initial API and implementation |
| *******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.mdht.uml.fhir.core.resource.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.SimpleQuantity; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.impl.BackboneElementImpl; |
| |
| import org.eclipse.mdht.uml.fhir.core.resource.FhirResourcePackage; |
| import org.eclipse.mdht.uml.fhir.core.resource.Medication; |
| import org.eclipse.mdht.uml.fhir.core.resource.MedicationPackageContent; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Medication Package Content</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.MedicationPackageContentImpl#getItem <em>Item</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.MedicationPackageContentImpl#getAmount <em>Amount</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MedicationPackageContentImpl extends BackboneElementImpl implements MedicationPackageContent { |
| /** |
| * The cached value of the '{@link #getItem() <em>Item</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getItem() |
| * @generated |
| * @ordered |
| */ |
| protected Medication item; |
| |
| /** |
| * The cached value of the '{@link #getAmount() <em>Amount</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAmount() |
| * @generated |
| * @ordered |
| */ |
| protected SimpleQuantity amount; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MedicationPackageContentImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getMedicationPackageContent(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Medication getItem() { |
| if (item != null && item.eIsProxy()) { |
| InternalEObject oldItem = (InternalEObject)item; |
| item = (Medication)eResolveProxy(oldItem); |
| if (item != oldItem) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.MEDICATION_PACKAGE_CONTENT__ITEM, oldItem, item)); |
| } |
| } |
| return item; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Medication basicGetItem() { |
| return item; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setItem(Medication newItem) { |
| Medication oldItem = item; |
| item = newItem; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.MEDICATION_PACKAGE_CONTENT__ITEM, oldItem, item)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SimpleQuantity getAmount() { |
| if (amount != null && amount.eIsProxy()) { |
| InternalEObject oldAmount = (InternalEObject)amount; |
| amount = (SimpleQuantity)eResolveProxy(oldAmount); |
| if (amount != oldAmount) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.MEDICATION_PACKAGE_CONTENT__AMOUNT, oldAmount, amount)); |
| } |
| } |
| return amount; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SimpleQuantity basicGetAmount() { |
| return amount; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setAmount(SimpleQuantity newAmount) { |
| SimpleQuantity oldAmount = amount; |
| amount = newAmount; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.MEDICATION_PACKAGE_CONTENT__AMOUNT, oldAmount, amount)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FhirResourcePackage.MEDICATION_PACKAGE_CONTENT__ITEM: |
| if (resolve) return getItem(); |
| return basicGetItem(); |
| case FhirResourcePackage.MEDICATION_PACKAGE_CONTENT__AMOUNT: |
| if (resolve) return getAmount(); |
| return basicGetAmount(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FhirResourcePackage.MEDICATION_PACKAGE_CONTENT__ITEM: |
| setItem((Medication)newValue); |
| return; |
| case FhirResourcePackage.MEDICATION_PACKAGE_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 FhirResourcePackage.MEDICATION_PACKAGE_CONTENT__ITEM: |
| setItem((Medication)null); |
| return; |
| case FhirResourcePackage.MEDICATION_PACKAGE_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 FhirResourcePackage.MEDICATION_PACKAGE_CONTENT__ITEM: |
| return item != null; |
| case FhirResourcePackage.MEDICATION_PACKAGE_CONTENT__AMOUNT: |
| return amount != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //MedicationPackageContentImpl |