blob: de07c1c230879055816eaab7aa2514f60c2ecd29 [file] [log] [blame]
/**
*/
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.Attachment;
import org.hl7.fhir.BodySite;
import org.hl7.fhir.CodeableConcept;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.Identifier;
import org.hl7.fhir.Reference;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Body Site</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.BodySiteImpl#getPatient <em>Patient</em>}</li>
* <li>{@link org.hl7.fhir.impl.BodySiteImpl#getIdentifier <em>Identifier</em>}</li>
* <li>{@link org.hl7.fhir.impl.BodySiteImpl#getCode <em>Code</em>}</li>
* <li>{@link org.hl7.fhir.impl.BodySiteImpl#getModifier <em>Modifier</em>}</li>
* <li>{@link org.hl7.fhir.impl.BodySiteImpl#getDescription <em>Description</em>}</li>
* <li>{@link org.hl7.fhir.impl.BodySiteImpl#getImage <em>Image</em>}</li>
* </ul>
*
* @generated
*/
public class BodySiteImpl extends DomainResourceImpl implements BodySite {
/**
* The cached value of the '{@link #getPatient() <em>Patient</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPatient()
* @generated
* @ordered
*/
protected Reference patient;
/**
* The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIdentifier()
* @generated
* @ordered
*/
protected EList<Identifier> identifier;
/**
* The cached value of the '{@link #getCode() <em>Code</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCode()
* @generated
* @ordered
*/
protected CodeableConcept code;
/**
* The cached value of the '{@link #getModifier() <em>Modifier</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModifier()
* @generated
* @ordered
*/
protected EList<CodeableConcept> modifier;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected org.hl7.fhir.String description;
/**
* The cached value of the '{@link #getImage() <em>Image</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getImage()
* @generated
* @ordered
*/
protected EList<Attachment> image;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BodySiteImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getBodySite();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Reference getPatient() {
return patient;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetPatient(Reference newPatient, NotificationChain msgs) {
Reference oldPatient = patient;
patient = newPatient;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.BODY_SITE__PATIENT, oldPatient, newPatient);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPatient(Reference newPatient) {
if (newPatient != patient) {
NotificationChain msgs = null;
if (patient != null)
msgs = ((InternalEObject)patient).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.BODY_SITE__PATIENT, null, msgs);
if (newPatient != null)
msgs = ((InternalEObject)newPatient).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.BODY_SITE__PATIENT, null, msgs);
msgs = basicSetPatient(newPatient, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.BODY_SITE__PATIENT, newPatient, newPatient));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Identifier> getIdentifier() {
if (identifier == null) {
identifier = new EObjectContainmentEList<Identifier>(Identifier.class, this, FhirPackage.BODY_SITE__IDENTIFIER);
}
return identifier;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CodeableConcept getCode() {
return code;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCode(CodeableConcept newCode, NotificationChain msgs) {
CodeableConcept oldCode = code;
code = newCode;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.BODY_SITE__CODE, oldCode, newCode);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCode(CodeableConcept newCode) {
if (newCode != code) {
NotificationChain msgs = null;
if (code != null)
msgs = ((InternalEObject)code).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.BODY_SITE__CODE, null, msgs);
if (newCode != null)
msgs = ((InternalEObject)newCode).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.BODY_SITE__CODE, null, msgs);
msgs = basicSetCode(newCode, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.BODY_SITE__CODE, newCode, newCode));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<CodeableConcept> getModifier() {
if (modifier == null) {
modifier = new EObjectContainmentEList<CodeableConcept>(CodeableConcept.class, this, FhirPackage.BODY_SITE__MODIFIER);
}
return modifier;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public org.hl7.fhir.String getDescription() {
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDescription(org.hl7.fhir.String newDescription, NotificationChain msgs) {
org.hl7.fhir.String oldDescription = description;
description = newDescription;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.BODY_SITE__DESCRIPTION, oldDescription, newDescription);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDescription(org.hl7.fhir.String newDescription) {
if (newDescription != description) {
NotificationChain msgs = null;
if (description != null)
msgs = ((InternalEObject)description).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.BODY_SITE__DESCRIPTION, null, msgs);
if (newDescription != null)
msgs = ((InternalEObject)newDescription).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.BODY_SITE__DESCRIPTION, null, msgs);
msgs = basicSetDescription(newDescription, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.BODY_SITE__DESCRIPTION, newDescription, newDescription));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Attachment> getImage() {
if (image == null) {
image = new EObjectContainmentEList<Attachment>(Attachment.class, this, FhirPackage.BODY_SITE__IMAGE);
}
return image;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.BODY_SITE__PATIENT:
return basicSetPatient(null, msgs);
case FhirPackage.BODY_SITE__IDENTIFIER:
return ((InternalEList<?>)getIdentifier()).basicRemove(otherEnd, msgs);
case FhirPackage.BODY_SITE__CODE:
return basicSetCode(null, msgs);
case FhirPackage.BODY_SITE__MODIFIER:
return ((InternalEList<?>)getModifier()).basicRemove(otherEnd, msgs);
case FhirPackage.BODY_SITE__DESCRIPTION:
return basicSetDescription(null, msgs);
case FhirPackage.BODY_SITE__IMAGE:
return ((InternalEList<?>)getImage()).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.BODY_SITE__PATIENT:
return getPatient();
case FhirPackage.BODY_SITE__IDENTIFIER:
return getIdentifier();
case FhirPackage.BODY_SITE__CODE:
return getCode();
case FhirPackage.BODY_SITE__MODIFIER:
return getModifier();
case FhirPackage.BODY_SITE__DESCRIPTION:
return getDescription();
case FhirPackage.BODY_SITE__IMAGE:
return getImage();
}
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.BODY_SITE__PATIENT:
setPatient((Reference)newValue);
return;
case FhirPackage.BODY_SITE__IDENTIFIER:
getIdentifier().clear();
getIdentifier().addAll((Collection<? extends Identifier>)newValue);
return;
case FhirPackage.BODY_SITE__CODE:
setCode((CodeableConcept)newValue);
return;
case FhirPackage.BODY_SITE__MODIFIER:
getModifier().clear();
getModifier().addAll((Collection<? extends CodeableConcept>)newValue);
return;
case FhirPackage.BODY_SITE__DESCRIPTION:
setDescription((org.hl7.fhir.String)newValue);
return;
case FhirPackage.BODY_SITE__IMAGE:
getImage().clear();
getImage().addAll((Collection<? extends Attachment>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.BODY_SITE__PATIENT:
setPatient((Reference)null);
return;
case FhirPackage.BODY_SITE__IDENTIFIER:
getIdentifier().clear();
return;
case FhirPackage.BODY_SITE__CODE:
setCode((CodeableConcept)null);
return;
case FhirPackage.BODY_SITE__MODIFIER:
getModifier().clear();
return;
case FhirPackage.BODY_SITE__DESCRIPTION:
setDescription((org.hl7.fhir.String)null);
return;
case FhirPackage.BODY_SITE__IMAGE:
getImage().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.BODY_SITE__PATIENT:
return patient != null;
case FhirPackage.BODY_SITE__IDENTIFIER:
return identifier != null && !identifier.isEmpty();
case FhirPackage.BODY_SITE__CODE:
return code != null;
case FhirPackage.BODY_SITE__MODIFIER:
return modifier != null && !modifier.isEmpty();
case FhirPackage.BODY_SITE__DESCRIPTION:
return description != null;
case FhirPackage.BODY_SITE__IMAGE:
return image != null && !image.isEmpty();
}
return super.eIsSet(featureID);
}
} //BodySiteImpl