| /******************************************************************************* |
| * 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.Period; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.impl.BackboneElementImpl; |
| |
| import org.eclipse.mdht.uml.fhir.core.resource.EncounterParticipant; |
| import org.eclipse.mdht.uml.fhir.core.resource.FhirResourcePackage; |
| import org.eclipse.mdht.uml.fhir.core.resource.Resource; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Encounter Participant</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.EncounterParticipantImpl#getTypes <em>Type</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.EncounterParticipantImpl#getPeriod <em>Period</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.EncounterParticipantImpl#getIndividual <em>Individual</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class EncounterParticipantImpl extends BackboneElementImpl implements EncounterParticipant { |
| /** |
| * The cached value of the '{@link #getTypes() <em>Type</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTypes() |
| * @generated |
| * @ordered |
| */ |
| protected EList<CodeableConcept> types; |
| |
| /** |
| * The cached value of the '{@link #getPeriod() <em>Period</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPeriod() |
| * @generated |
| * @ordered |
| */ |
| protected Period period; |
| |
| /** |
| * The cached value of the '{@link #getIndividual() <em>Individual</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIndividual() |
| * @generated |
| * @ordered |
| */ |
| protected Resource individual; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EncounterParticipantImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getEncounterParticipant(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<CodeableConcept> getTypes() { |
| if (types == null) { |
| types = new EObjectResolvingEList<CodeableConcept>(CodeableConcept.class, this, FhirResourcePackage.ENCOUNTER_PARTICIPANT__TYPE); |
| } |
| return types; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Period getPeriod() { |
| if (period != null && period.eIsProxy()) { |
| InternalEObject oldPeriod = (InternalEObject)period; |
| period = (Period)eResolveProxy(oldPeriod); |
| if (period != oldPeriod) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ENCOUNTER_PARTICIPANT__PERIOD, oldPeriod, period)); |
| } |
| } |
| return period; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Period basicGetPeriod() { |
| return period; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPeriod(Period newPeriod) { |
| Period oldPeriod = period; |
| period = newPeriod; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ENCOUNTER_PARTICIPANT__PERIOD, oldPeriod, period)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource getIndividual() { |
| if (individual != null && individual.eIsProxy()) { |
| InternalEObject oldIndividual = (InternalEObject)individual; |
| individual = (Resource)eResolveProxy(oldIndividual); |
| if (individual != oldIndividual) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ENCOUNTER_PARTICIPANT__INDIVIDUAL, oldIndividual, individual)); |
| } |
| } |
| return individual; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource basicGetIndividual() { |
| return individual; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setIndividual(Resource newIndividual) { |
| Resource oldIndividual = individual; |
| individual = newIndividual; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ENCOUNTER_PARTICIPANT__INDIVIDUAL, oldIndividual, individual)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__TYPE: |
| return getTypes(); |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__PERIOD: |
| if (resolve) return getPeriod(); |
| return basicGetPeriod(); |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__INDIVIDUAL: |
| if (resolve) return getIndividual(); |
| return basicGetIndividual(); |
| } |
| 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.ENCOUNTER_PARTICIPANT__TYPE: |
| getTypes().clear(); |
| getTypes().addAll((Collection<? extends CodeableConcept>)newValue); |
| return; |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__PERIOD: |
| setPeriod((Period)newValue); |
| return; |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__INDIVIDUAL: |
| setIndividual((Resource)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__TYPE: |
| getTypes().clear(); |
| return; |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__PERIOD: |
| setPeriod((Period)null); |
| return; |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__INDIVIDUAL: |
| setIndividual((Resource)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__TYPE: |
| return types != null && !types.isEmpty(); |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__PERIOD: |
| return period != null; |
| case FhirResourcePackage.ENCOUNTER_PARTICIPANT__INDIVIDUAL: |
| return individual != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //EncounterParticipantImpl |