| /** |
| */ |
| package org.hl7.fhir.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.hl7.fhir.CodeableConcept; |
| import org.hl7.fhir.FhirPackage; |
| import org.hl7.fhir.MedicationContent; |
| import org.hl7.fhir.MedicationPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Medication Package</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.hl7.fhir.impl.MedicationPackageImpl#getContainer <em>Container</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.MedicationPackageImpl#getContent <em>Content</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MedicationPackageImpl extends BackboneElementImpl implements MedicationPackage { |
| /** |
| * The cached value of the '{@link #getContainer() <em>Container</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getContainer() |
| * @generated |
| * @ordered |
| */ |
| protected CodeableConcept container; |
| |
| /** |
| * The cached value of the '{@link #getContent() <em>Content</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getContent() |
| * @generated |
| * @ordered |
| */ |
| protected EList<MedicationContent> content; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MedicationPackageImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirPackage.eINSTANCE.getMedicationPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept getContainer() { |
| return container; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetContainer(CodeableConcept newContainer, NotificationChain msgs) { |
| CodeableConcept oldContainer = container; |
| container = newContainer; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_PACKAGE__CONTAINER, oldContainer, newContainer); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setContainer(CodeableConcept newContainer) { |
| if (newContainer != container) { |
| NotificationChain msgs = null; |
| if (container != null) |
| msgs = ((InternalEObject)container).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_PACKAGE__CONTAINER, null, msgs); |
| if (newContainer != null) |
| msgs = ((InternalEObject)newContainer).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_PACKAGE__CONTAINER, null, msgs); |
| msgs = basicSetContainer(newContainer, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_PACKAGE__CONTAINER, newContainer, newContainer)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<MedicationContent> getContent() { |
| if (content == null) { |
| content = new EObjectContainmentEList<MedicationContent>(MedicationContent.class, this, FhirPackage.MEDICATION_PACKAGE__CONTENT); |
| } |
| return content; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirPackage.MEDICATION_PACKAGE__CONTAINER: |
| return basicSetContainer(null, msgs); |
| case FhirPackage.MEDICATION_PACKAGE__CONTENT: |
| return ((InternalEList<?>)getContent()).basicRemove(otherEnd, 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_PACKAGE__CONTAINER: |
| return getContainer(); |
| case FhirPackage.MEDICATION_PACKAGE__CONTENT: |
| return getContent(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FhirPackage.MEDICATION_PACKAGE__CONTAINER: |
| setContainer((CodeableConcept)newValue); |
| return; |
| case FhirPackage.MEDICATION_PACKAGE__CONTENT: |
| getContent().clear(); |
| getContent().addAll((Collection<? extends MedicationContent>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirPackage.MEDICATION_PACKAGE__CONTAINER: |
| setContainer((CodeableConcept)null); |
| return; |
| case FhirPackage.MEDICATION_PACKAGE__CONTENT: |
| getContent().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirPackage.MEDICATION_PACKAGE__CONTAINER: |
| return container != null; |
| case FhirPackage.MEDICATION_PACKAGE__CONTENT: |
| return content != null && !content.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //MedicationPackageImpl |