blob: 89a86cc21cc798281a2eabfa3cdf0379ca9af02c [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.CodeableConcept;
import org.hl7.fhir.CompositionEvent;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.Period;
import org.hl7.fhir.Reference;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Composition Event</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.CompositionEventImpl#getCode <em>Code</em>}</li>
* <li>{@link org.hl7.fhir.impl.CompositionEventImpl#getPeriod <em>Period</em>}</li>
* <li>{@link org.hl7.fhir.impl.CompositionEventImpl#getDetail <em>Detail</em>}</li>
* </ul>
*
* @generated
*/
public class CompositionEventImpl extends BackboneElementImpl implements CompositionEvent {
/**
* The cached value of the '{@link #getCode() <em>Code</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCode()
* @generated
* @ordered
*/
protected EList<CodeableConcept> code;
/**
* The cached value of the '{@link #getPeriod() <em>Period</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPeriod()
* @generated
* @ordered
*/
protected Period period;
/**
* The cached value of the '{@link #getDetail() <em>Detail</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDetail()
* @generated
* @ordered
*/
protected EList<Reference> detail;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CompositionEventImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getCompositionEvent();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<CodeableConcept> getCode() {
if (code == null) {
code = new EObjectContainmentEList<CodeableConcept>(CodeableConcept.class, this, FhirPackage.COMPOSITION_EVENT__CODE);
}
return code;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Period getPeriod() {
return period;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetPeriod(Period newPeriod, NotificationChain msgs) {
Period oldPeriod = period;
period = newPeriod;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.COMPOSITION_EVENT__PERIOD, oldPeriod, newPeriod);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPeriod(Period newPeriod) {
if (newPeriod != period) {
NotificationChain msgs = null;
if (period != null)
msgs = ((InternalEObject)period).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.COMPOSITION_EVENT__PERIOD, null, msgs);
if (newPeriod != null)
msgs = ((InternalEObject)newPeriod).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.COMPOSITION_EVENT__PERIOD, null, msgs);
msgs = basicSetPeriod(newPeriod, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.COMPOSITION_EVENT__PERIOD, newPeriod, newPeriod));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Reference> getDetail() {
if (detail == null) {
detail = new EObjectContainmentEList<Reference>(Reference.class, this, FhirPackage.COMPOSITION_EVENT__DETAIL);
}
return detail;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.COMPOSITION_EVENT__CODE:
return ((InternalEList<?>)getCode()).basicRemove(otherEnd, msgs);
case FhirPackage.COMPOSITION_EVENT__PERIOD:
return basicSetPeriod(null, msgs);
case FhirPackage.COMPOSITION_EVENT__DETAIL:
return ((InternalEList<?>)getDetail()).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.COMPOSITION_EVENT__CODE:
return getCode();
case FhirPackage.COMPOSITION_EVENT__PERIOD:
return getPeriod();
case FhirPackage.COMPOSITION_EVENT__DETAIL:
return getDetail();
}
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.COMPOSITION_EVENT__CODE:
getCode().clear();
getCode().addAll((Collection<? extends CodeableConcept>)newValue);
return;
case FhirPackage.COMPOSITION_EVENT__PERIOD:
setPeriod((Period)newValue);
return;
case FhirPackage.COMPOSITION_EVENT__DETAIL:
getDetail().clear();
getDetail().addAll((Collection<? extends Reference>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.COMPOSITION_EVENT__CODE:
getCode().clear();
return;
case FhirPackage.COMPOSITION_EVENT__PERIOD:
setPeriod((Period)null);
return;
case FhirPackage.COMPOSITION_EVENT__DETAIL:
getDetail().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.COMPOSITION_EVENT__CODE:
return code != null && !code.isEmpty();
case FhirPackage.COMPOSITION_EVENT__PERIOD:
return period != null;
case FhirPackage.COMPOSITION_EVENT__DETAIL:
return detail != null && !detail.isEmpty();
}
return super.eIsSet(featureID);
}
} //CompositionEventImpl