blob: 1ca06f9a354d733459ad65347e43a4c816439d8c [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.Coding;
import org.hl7.fhir.FhirPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Codeable Concept</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.CodeableConceptImpl#getCoding <em>Coding</em>}</li>
* <li>{@link org.hl7.fhir.impl.CodeableConceptImpl#getText <em>Text</em>}</li>
* </ul>
*
* @generated
*/
public class CodeableConceptImpl extends ElementImpl implements CodeableConcept {
/**
* The cached value of the '{@link #getCoding() <em>Coding</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCoding()
* @generated
* @ordered
*/
protected EList<Coding> coding;
/**
* The cached value of the '{@link #getText() <em>Text</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getText()
* @generated
* @ordered
*/
protected org.hl7.fhir.String text;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CodeableConceptImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getCodeableConcept();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Coding> getCoding() {
if (coding == null) {
coding = new EObjectContainmentEList<Coding>(Coding.class, this, FhirPackage.CODEABLE_CONCEPT__CODING);
}
return coding;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public org.hl7.fhir.String getText() {
return text;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetText(org.hl7.fhir.String newText, NotificationChain msgs) {
org.hl7.fhir.String oldText = text;
text = newText;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.CODEABLE_CONCEPT__TEXT, oldText, newText);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setText(org.hl7.fhir.String newText) {
if (newText != text) {
NotificationChain msgs = null;
if (text != null)
msgs = ((InternalEObject)text).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.CODEABLE_CONCEPT__TEXT, null, msgs);
if (newText != null)
msgs = ((InternalEObject)newText).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.CODEABLE_CONCEPT__TEXT, null, msgs);
msgs = basicSetText(newText, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.CODEABLE_CONCEPT__TEXT, newText, newText));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.CODEABLE_CONCEPT__CODING:
return ((InternalEList<?>)getCoding()).basicRemove(otherEnd, msgs);
case FhirPackage.CODEABLE_CONCEPT__TEXT:
return basicSetText(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.CODEABLE_CONCEPT__CODING:
return getCoding();
case FhirPackage.CODEABLE_CONCEPT__TEXT:
return getText();
}
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.CODEABLE_CONCEPT__CODING:
getCoding().clear();
getCoding().addAll((Collection<? extends Coding>)newValue);
return;
case FhirPackage.CODEABLE_CONCEPT__TEXT:
setText((org.hl7.fhir.String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.CODEABLE_CONCEPT__CODING:
getCoding().clear();
return;
case FhirPackage.CODEABLE_CONCEPT__TEXT:
setText((org.hl7.fhir.String)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.CODEABLE_CONCEPT__CODING:
return coding != null && !coding.isEmpty();
case FhirPackage.CODEABLE_CONCEPT__TEXT:
return text != null;
}
return super.eIsSet(featureID);
}
} //CodeableConceptImpl