blob: 50c5cf80387bae32f6c26aea13500e58b2ab0a21 [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.CodeableConcept;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.MedicationKnowledgePackaging;
import org.hl7.fhir.Quantity;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Medication Knowledge Packaging</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.MedicationKnowledgePackagingImpl#getType <em>Type</em>}</li>
* <li>{@link org.hl7.fhir.impl.MedicationKnowledgePackagingImpl#getQuantity <em>Quantity</em>}</li>
* </ul>
*
* @generated
*/
public class MedicationKnowledgePackagingImpl extends BackboneElementImpl implements MedicationKnowledgePackaging {
/**
* 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 #getQuantity() <em>Quantity</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getQuantity()
* @generated
* @ordered
*/
protected Quantity quantity;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MedicationKnowledgePackagingImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getMedicationKnowledgePackaging();
}
/**
* <!-- 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.MEDICATION_KNOWLEDGE_PACKAGING__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.MEDICATION_KNOWLEDGE_PACKAGING__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__TYPE, newType, newType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Quantity getQuantity() {
return quantity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetQuantity(Quantity newQuantity, NotificationChain msgs) {
Quantity oldQuantity = quantity;
quantity = newQuantity;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__QUANTITY, oldQuantity, newQuantity);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setQuantity(Quantity newQuantity) {
if (newQuantity != quantity) {
NotificationChain msgs = null;
if (quantity != null)
msgs = ((InternalEObject)quantity).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__QUANTITY, null, msgs);
if (newQuantity != null)
msgs = ((InternalEObject)newQuantity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__QUANTITY, null, msgs);
msgs = basicSetQuantity(newQuantity, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__QUANTITY, newQuantity, newQuantity));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__TYPE:
return basicSetType(null, msgs);
case FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__QUANTITY:
return basicSetQuantity(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.MEDICATION_KNOWLEDGE_PACKAGING__TYPE:
return getType();
case FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__QUANTITY:
return getQuantity();
}
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.MEDICATION_KNOWLEDGE_PACKAGING__TYPE:
setType((CodeableConcept)newValue);
return;
case FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__QUANTITY:
setQuantity((Quantity)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__TYPE:
setType((CodeableConcept)null);
return;
case FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__QUANTITY:
setQuantity((Quantity)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__TYPE:
return type != null;
case FhirPackage.MEDICATION_KNOWLEDGE_PACKAGING__QUANTITY:
return quantity != null;
}
return super.eIsSet(featureID);
}
} //MedicationKnowledgePackagingImpl