blob: 6a42a9b15121160538d860090137753e5472e1e1 [file] [log] [blame]
/**
*/
package org.hl7.fhir.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.hl7.fhir.CarePlanRelatedPlan;
import org.hl7.fhir.CarePlanRelationship;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.Reference;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Care Plan Related Plan</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.CarePlanRelatedPlanImpl#getCode <em>Code</em>}</li>
* <li>{@link org.hl7.fhir.impl.CarePlanRelatedPlanImpl#getPlan <em>Plan</em>}</li>
* </ul>
*
* @generated
*/
public class CarePlanRelatedPlanImpl extends BackboneElementImpl implements CarePlanRelatedPlan {
/**
* The cached value of the '{@link #getCode() <em>Code</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCode()
* @generated
* @ordered
*/
protected CarePlanRelationship code;
/**
* The cached value of the '{@link #getPlan() <em>Plan</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPlan()
* @generated
* @ordered
*/
protected Reference plan;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CarePlanRelatedPlanImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getCarePlanRelatedPlan();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CarePlanRelationship getCode() {
return code;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCode(CarePlanRelationship newCode, NotificationChain msgs) {
CarePlanRelationship oldCode = code;
code = newCode;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.CARE_PLAN_RELATED_PLAN__CODE, oldCode, newCode);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCode(CarePlanRelationship newCode) {
if (newCode != code) {
NotificationChain msgs = null;
if (code != null)
msgs = ((InternalEObject)code).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.CARE_PLAN_RELATED_PLAN__CODE, null, msgs);
if (newCode != null)
msgs = ((InternalEObject)newCode).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.CARE_PLAN_RELATED_PLAN__CODE, null, msgs);
msgs = basicSetCode(newCode, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.CARE_PLAN_RELATED_PLAN__CODE, newCode, newCode));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Reference getPlan() {
return plan;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetPlan(Reference newPlan, NotificationChain msgs) {
Reference oldPlan = plan;
plan = newPlan;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.CARE_PLAN_RELATED_PLAN__PLAN, oldPlan, newPlan);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPlan(Reference newPlan) {
if (newPlan != plan) {
NotificationChain msgs = null;
if (plan != null)
msgs = ((InternalEObject)plan).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.CARE_PLAN_RELATED_PLAN__PLAN, null, msgs);
if (newPlan != null)
msgs = ((InternalEObject)newPlan).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.CARE_PLAN_RELATED_PLAN__PLAN, null, msgs);
msgs = basicSetPlan(newPlan, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.CARE_PLAN_RELATED_PLAN__PLAN, newPlan, newPlan));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.CARE_PLAN_RELATED_PLAN__CODE:
return basicSetCode(null, msgs);
case FhirPackage.CARE_PLAN_RELATED_PLAN__PLAN:
return basicSetPlan(null, 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.CARE_PLAN_RELATED_PLAN__CODE:
return getCode();
case FhirPackage.CARE_PLAN_RELATED_PLAN__PLAN:
return getPlan();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case FhirPackage.CARE_PLAN_RELATED_PLAN__CODE:
setCode((CarePlanRelationship)newValue);
return;
case FhirPackage.CARE_PLAN_RELATED_PLAN__PLAN:
setPlan((Reference)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.CARE_PLAN_RELATED_PLAN__CODE:
setCode((CarePlanRelationship)null);
return;
case FhirPackage.CARE_PLAN_RELATED_PLAN__PLAN:
setPlan((Reference)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.CARE_PLAN_RELATED_PLAN__CODE:
return code != null;
case FhirPackage.CARE_PLAN_RELATED_PLAN__PLAN:
return plan != null;
}
return super.eIsSet(featureID);
}
} //CarePlanRelatedPlanImpl