blob: 221e954ee114f949caf9d790d4427b90e1a167a9 [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.FhirPackage;
import org.hl7.fhir.InsurancePlanBenefit;
import org.hl7.fhir.InsurancePlanLimit;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Insurance Plan Benefit</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.InsurancePlanBenefitImpl#getType <em>Type</em>}</li>
* <li>{@link org.hl7.fhir.impl.InsurancePlanBenefitImpl#getRequirement <em>Requirement</em>}</li>
* <li>{@link org.hl7.fhir.impl.InsurancePlanBenefitImpl#getLimit <em>Limit</em>}</li>
* </ul>
*
* @generated
*/
public class InsurancePlanBenefitImpl extends BackboneElementImpl implements InsurancePlanBenefit {
/**
* The cached value of the '{@link #getType() <em>Type</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected CodeableConcept type;
/**
* The cached value of the '{@link #getRequirement() <em>Requirement</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRequirement()
* @generated
* @ordered
*/
protected org.hl7.fhir.String requirement;
/**
* The cached value of the '{@link #getLimit() <em>Limit</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLimit()
* @generated
* @ordered
*/
protected EList<InsurancePlanLimit> limit;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected InsurancePlanBenefitImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getInsurancePlanBenefit();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CodeableConcept getType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetType(CodeableConcept newType, NotificationChain msgs) {
CodeableConcept oldType = type;
type = newType;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.INSURANCE_PLAN_BENEFIT__TYPE, oldType, newType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(CodeableConcept newType) {
if (newType != type) {
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.INSURANCE_PLAN_BENEFIT__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.INSURANCE_PLAN_BENEFIT__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.INSURANCE_PLAN_BENEFIT__TYPE, newType, newType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public org.hl7.fhir.String getRequirement() {
return requirement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRequirement(org.hl7.fhir.String newRequirement, NotificationChain msgs) {
org.hl7.fhir.String oldRequirement = requirement;
requirement = newRequirement;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.INSURANCE_PLAN_BENEFIT__REQUIREMENT, oldRequirement, newRequirement);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRequirement(org.hl7.fhir.String newRequirement) {
if (newRequirement != requirement) {
NotificationChain msgs = null;
if (requirement != null)
msgs = ((InternalEObject)requirement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.INSURANCE_PLAN_BENEFIT__REQUIREMENT, null, msgs);
if (newRequirement != null)
msgs = ((InternalEObject)newRequirement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.INSURANCE_PLAN_BENEFIT__REQUIREMENT, null, msgs);
msgs = basicSetRequirement(newRequirement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.INSURANCE_PLAN_BENEFIT__REQUIREMENT, newRequirement, newRequirement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<InsurancePlanLimit> getLimit() {
if (limit == null) {
limit = new EObjectContainmentEList<InsurancePlanLimit>(InsurancePlanLimit.class, this, FhirPackage.INSURANCE_PLAN_BENEFIT__LIMIT);
}
return limit;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.INSURANCE_PLAN_BENEFIT__TYPE:
return basicSetType(null, msgs);
case FhirPackage.INSURANCE_PLAN_BENEFIT__REQUIREMENT:
return basicSetRequirement(null, msgs);
case FhirPackage.INSURANCE_PLAN_BENEFIT__LIMIT:
return ((InternalEList<?>)getLimit()).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.INSURANCE_PLAN_BENEFIT__TYPE:
return getType();
case FhirPackage.INSURANCE_PLAN_BENEFIT__REQUIREMENT:
return getRequirement();
case FhirPackage.INSURANCE_PLAN_BENEFIT__LIMIT:
return getLimit();
}
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.INSURANCE_PLAN_BENEFIT__TYPE:
setType((CodeableConcept)newValue);
return;
case FhirPackage.INSURANCE_PLAN_BENEFIT__REQUIREMENT:
setRequirement((org.hl7.fhir.String)newValue);
return;
case FhirPackage.INSURANCE_PLAN_BENEFIT__LIMIT:
getLimit().clear();
getLimit().addAll((Collection<? extends InsurancePlanLimit>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.INSURANCE_PLAN_BENEFIT__TYPE:
setType((CodeableConcept)null);
return;
case FhirPackage.INSURANCE_PLAN_BENEFIT__REQUIREMENT:
setRequirement((org.hl7.fhir.String)null);
return;
case FhirPackage.INSURANCE_PLAN_BENEFIT__LIMIT:
getLimit().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.INSURANCE_PLAN_BENEFIT__TYPE:
return type != null;
case FhirPackage.INSURANCE_PLAN_BENEFIT__REQUIREMENT:
return requirement != null;
case FhirPackage.INSURANCE_PLAN_BENEFIT__LIMIT:
return limit != null && !limit.isEmpty();
}
return super.eIsSet(featureID);
}
} //InsurancePlanBenefitImpl