| /******************************************************************************* |
| * 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 java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| 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.EObjectResolvingEList; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.CodeableConcept; |
| |
| 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.SpecimenTreatment; |
| import org.eclipse.mdht.uml.fhir.core.resource.Substance; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Specimen Treatment</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.SpecimenTreatmentImpl#getDescription <em>Description</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.SpecimenTreatmentImpl#getProcedure <em>Procedure</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.SpecimenTreatmentImpl#getAdditives <em>Additive</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SpecimenTreatmentImpl extends BackboneElementImpl implements SpecimenTreatment { |
| /** |
| * The cached value of the '{@link #getDescription() <em>Description</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDescription() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.mdht.uml.fhir.core.datatype.String description; |
| |
| /** |
| * The cached value of the '{@link #getProcedure() <em>Procedure</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getProcedure() |
| * @generated |
| * @ordered |
| */ |
| protected CodeableConcept procedure; |
| |
| /** |
| * The cached value of the '{@link #getAdditives() <em>Additive</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAdditives() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Substance> additives; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SpecimenTreatmentImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getSpecimenTreatment(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.String getDescription() { |
| if (description != null && description.eIsProxy()) { |
| InternalEObject oldDescription = (InternalEObject)description; |
| description = (org.eclipse.mdht.uml.fhir.core.datatype.String)eResolveProxy(oldDescription); |
| if (description != oldDescription) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.SPECIMEN_TREATMENT__DESCRIPTION, oldDescription, description)); |
| } |
| } |
| return description; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.String basicGetDescription() { |
| return description; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDescription(org.eclipse.mdht.uml.fhir.core.datatype.String newDescription) { |
| org.eclipse.mdht.uml.fhir.core.datatype.String oldDescription = description; |
| description = newDescription; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.SPECIMEN_TREATMENT__DESCRIPTION, oldDescription, description)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept getProcedure() { |
| if (procedure != null && procedure.eIsProxy()) { |
| InternalEObject oldProcedure = (InternalEObject)procedure; |
| procedure = (CodeableConcept)eResolveProxy(oldProcedure); |
| if (procedure != oldProcedure) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.SPECIMEN_TREATMENT__PROCEDURE, oldProcedure, procedure)); |
| } |
| } |
| return procedure; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept basicGetProcedure() { |
| return procedure; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setProcedure(CodeableConcept newProcedure) { |
| CodeableConcept oldProcedure = procedure; |
| procedure = newProcedure; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.SPECIMEN_TREATMENT__PROCEDURE, oldProcedure, procedure)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Substance> getAdditives() { |
| if (additives == null) { |
| additives = new EObjectResolvingEList<Substance>(Substance.class, this, FhirResourcePackage.SPECIMEN_TREATMENT__ADDITIVE); |
| } |
| return additives; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FhirResourcePackage.SPECIMEN_TREATMENT__DESCRIPTION: |
| if (resolve) return getDescription(); |
| return basicGetDescription(); |
| case FhirResourcePackage.SPECIMEN_TREATMENT__PROCEDURE: |
| if (resolve) return getProcedure(); |
| return basicGetProcedure(); |
| case FhirResourcePackage.SPECIMEN_TREATMENT__ADDITIVE: |
| return getAdditives(); |
| } |
| 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 FhirResourcePackage.SPECIMEN_TREATMENT__DESCRIPTION: |
| setDescription((org.eclipse.mdht.uml.fhir.core.datatype.String)newValue); |
| return; |
| case FhirResourcePackage.SPECIMEN_TREATMENT__PROCEDURE: |
| setProcedure((CodeableConcept)newValue); |
| return; |
| case FhirResourcePackage.SPECIMEN_TREATMENT__ADDITIVE: |
| getAdditives().clear(); |
| getAdditives().addAll((Collection<? extends Substance>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.SPECIMEN_TREATMENT__DESCRIPTION: |
| setDescription((org.eclipse.mdht.uml.fhir.core.datatype.String)null); |
| return; |
| case FhirResourcePackage.SPECIMEN_TREATMENT__PROCEDURE: |
| setProcedure((CodeableConcept)null); |
| return; |
| case FhirResourcePackage.SPECIMEN_TREATMENT__ADDITIVE: |
| getAdditives().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.SPECIMEN_TREATMENT__DESCRIPTION: |
| return description != null; |
| case FhirResourcePackage.SPECIMEN_TREATMENT__PROCEDURE: |
| return procedure != null; |
| case FhirResourcePackage.SPECIMEN_TREATMENT__ADDITIVE: |
| return additives != null && !additives.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //SpecimenTreatmentImpl |