blob: ca179976f6ec46d553695b318fbb380896f126cf [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.AdverseEventCausality;
import org.hl7.fhir.AdverseEventSuspectEntity;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.Reference;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Adverse Event Suspect Entity</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.AdverseEventSuspectEntityImpl#getInstance <em>Instance</em>}</li>
* <li>{@link org.hl7.fhir.impl.AdverseEventSuspectEntityImpl#getCausality <em>Causality</em>}</li>
* </ul>
*
* @generated
*/
public class AdverseEventSuspectEntityImpl extends BackboneElementImpl implements AdverseEventSuspectEntity {
/**
* The cached value of the '{@link #getInstance() <em>Instance</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInstance()
* @generated
* @ordered
*/
protected Reference instance;
/**
* The cached value of the '{@link #getCausality() <em>Causality</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCausality()
* @generated
* @ordered
*/
protected EList<AdverseEventCausality> causality;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AdverseEventSuspectEntityImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getAdverseEventSuspectEntity();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Reference getInstance() {
return instance;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetInstance(Reference newInstance, NotificationChain msgs) {
Reference oldInstance = instance;
instance = newInstance;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__INSTANCE, oldInstance, newInstance);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInstance(Reference newInstance) {
if (newInstance != instance) {
NotificationChain msgs = null;
if (instance != null)
msgs = ((InternalEObject)instance).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__INSTANCE, null, msgs);
if (newInstance != null)
msgs = ((InternalEObject)newInstance).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__INSTANCE, null, msgs);
msgs = basicSetInstance(newInstance, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__INSTANCE, newInstance, newInstance));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<AdverseEventCausality> getCausality() {
if (causality == null) {
causality = new EObjectContainmentEList<AdverseEventCausality>(AdverseEventCausality.class, this, FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__CAUSALITY);
}
return causality;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__INSTANCE:
return basicSetInstance(null, msgs);
case FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__CAUSALITY:
return ((InternalEList<?>)getCausality()).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.ADVERSE_EVENT_SUSPECT_ENTITY__INSTANCE:
return getInstance();
case FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__CAUSALITY:
return getCausality();
}
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.ADVERSE_EVENT_SUSPECT_ENTITY__INSTANCE:
setInstance((Reference)newValue);
return;
case FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__CAUSALITY:
getCausality().clear();
getCausality().addAll((Collection<? extends AdverseEventCausality>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__INSTANCE:
setInstance((Reference)null);
return;
case FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__CAUSALITY:
getCausality().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__INSTANCE:
return instance != null;
case FhirPackage.ADVERSE_EVENT_SUSPECT_ENTITY__CAUSALITY:
return causality != null && !causality.isEmpty();
}
return super.eIsSet(featureID);
}
} //AdverseEventSuspectEntityImpl