blob: dfe6d671c2a39e590c44338e7289b8ffe807c7d9 [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.Duration;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.MedicationOrderDispenseRequest;
import org.hl7.fhir.Period;
import org.hl7.fhir.PositiveInt;
import org.hl7.fhir.Reference;
import org.hl7.fhir.SimpleQuantity;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Medication Order Dispense Request</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.MedicationOrderDispenseRequestImpl#getMedicationCodeableConcept <em>Medication Codeable Concept</em>}</li>
* <li>{@link org.hl7.fhir.impl.MedicationOrderDispenseRequestImpl#getMedicationReference <em>Medication Reference</em>}</li>
* <li>{@link org.hl7.fhir.impl.MedicationOrderDispenseRequestImpl#getValidityPeriod <em>Validity Period</em>}</li>
* <li>{@link org.hl7.fhir.impl.MedicationOrderDispenseRequestImpl#getNumberOfRepeatsAllowed <em>Number Of Repeats Allowed</em>}</li>
* <li>{@link org.hl7.fhir.impl.MedicationOrderDispenseRequestImpl#getQuantity <em>Quantity</em>}</li>
* <li>{@link org.hl7.fhir.impl.MedicationOrderDispenseRequestImpl#getExpectedSupplyDuration <em>Expected Supply Duration</em>}</li>
* </ul>
*
* @generated
*/
public class MedicationOrderDispenseRequestImpl extends BackboneElementImpl implements MedicationOrderDispenseRequest {
/**
* The cached value of the '{@link #getMedicationCodeableConcept() <em>Medication Codeable Concept</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMedicationCodeableConcept()
* @generated
* @ordered
*/
protected CodeableConcept medicationCodeableConcept;
/**
* The cached value of the '{@link #getMedicationReference() <em>Medication Reference</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMedicationReference()
* @generated
* @ordered
*/
protected Reference medicationReference;
/**
* The cached value of the '{@link #getValidityPeriod() <em>Validity Period</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValidityPeriod()
* @generated
* @ordered
*/
protected Period validityPeriod;
/**
* The cached value of the '{@link #getNumberOfRepeatsAllowed() <em>Number Of Repeats Allowed</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getNumberOfRepeatsAllowed()
* @generated
* @ordered
*/
protected PositiveInt numberOfRepeatsAllowed;
/**
* The cached value of the '{@link #getQuantity() <em>Quantity</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getQuantity()
* @generated
* @ordered
*/
protected SimpleQuantity quantity;
/**
* The cached value of the '{@link #getExpectedSupplyDuration() <em>Expected Supply Duration</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExpectedSupplyDuration()
* @generated
* @ordered
*/
protected Duration expectedSupplyDuration;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MedicationOrderDispenseRequestImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getMedicationOrderDispenseRequest();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CodeableConcept getMedicationCodeableConcept() {
return medicationCodeableConcept;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetMedicationCodeableConcept(CodeableConcept newMedicationCodeableConcept, NotificationChain msgs) {
CodeableConcept oldMedicationCodeableConcept = medicationCodeableConcept;
medicationCodeableConcept = newMedicationCodeableConcept;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_CODEABLE_CONCEPT, oldMedicationCodeableConcept, newMedicationCodeableConcept);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMedicationCodeableConcept(CodeableConcept newMedicationCodeableConcept) {
if (newMedicationCodeableConcept != medicationCodeableConcept) {
NotificationChain msgs = null;
if (medicationCodeableConcept != null)
msgs = ((InternalEObject)medicationCodeableConcept).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_CODEABLE_CONCEPT, null, msgs);
if (newMedicationCodeableConcept != null)
msgs = ((InternalEObject)newMedicationCodeableConcept).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_CODEABLE_CONCEPT, null, msgs);
msgs = basicSetMedicationCodeableConcept(newMedicationCodeableConcept, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_CODEABLE_CONCEPT, newMedicationCodeableConcept, newMedicationCodeableConcept));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Reference getMedicationReference() {
return medicationReference;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetMedicationReference(Reference newMedicationReference, NotificationChain msgs) {
Reference oldMedicationReference = medicationReference;
medicationReference = newMedicationReference;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_REFERENCE, oldMedicationReference, newMedicationReference);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMedicationReference(Reference newMedicationReference) {
if (newMedicationReference != medicationReference) {
NotificationChain msgs = null;
if (medicationReference != null)
msgs = ((InternalEObject)medicationReference).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_REFERENCE, null, msgs);
if (newMedicationReference != null)
msgs = ((InternalEObject)newMedicationReference).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_REFERENCE, null, msgs);
msgs = basicSetMedicationReference(newMedicationReference, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_REFERENCE, newMedicationReference, newMedicationReference));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Period getValidityPeriod() {
return validityPeriod;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetValidityPeriod(Period newValidityPeriod, NotificationChain msgs) {
Period oldValidityPeriod = validityPeriod;
validityPeriod = newValidityPeriod;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__VALIDITY_PERIOD, oldValidityPeriod, newValidityPeriod);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValidityPeriod(Period newValidityPeriod) {
if (newValidityPeriod != validityPeriod) {
NotificationChain msgs = null;
if (validityPeriod != null)
msgs = ((InternalEObject)validityPeriod).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__VALIDITY_PERIOD, null, msgs);
if (newValidityPeriod != null)
msgs = ((InternalEObject)newValidityPeriod).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__VALIDITY_PERIOD, null, msgs);
msgs = basicSetValidityPeriod(newValidityPeriod, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__VALIDITY_PERIOD, newValidityPeriod, newValidityPeriod));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PositiveInt getNumberOfRepeatsAllowed() {
return numberOfRepeatsAllowed;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetNumberOfRepeatsAllowed(PositiveInt newNumberOfRepeatsAllowed, NotificationChain msgs) {
PositiveInt oldNumberOfRepeatsAllowed = numberOfRepeatsAllowed;
numberOfRepeatsAllowed = newNumberOfRepeatsAllowed;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__NUMBER_OF_REPEATS_ALLOWED, oldNumberOfRepeatsAllowed, newNumberOfRepeatsAllowed);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setNumberOfRepeatsAllowed(PositiveInt newNumberOfRepeatsAllowed) {
if (newNumberOfRepeatsAllowed != numberOfRepeatsAllowed) {
NotificationChain msgs = null;
if (numberOfRepeatsAllowed != null)
msgs = ((InternalEObject)numberOfRepeatsAllowed).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__NUMBER_OF_REPEATS_ALLOWED, null, msgs);
if (newNumberOfRepeatsAllowed != null)
msgs = ((InternalEObject)newNumberOfRepeatsAllowed).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__NUMBER_OF_REPEATS_ALLOWED, null, msgs);
msgs = basicSetNumberOfRepeatsAllowed(newNumberOfRepeatsAllowed, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__NUMBER_OF_REPEATS_ALLOWED, newNumberOfRepeatsAllowed, newNumberOfRepeatsAllowed));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SimpleQuantity getQuantity() {
return quantity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetQuantity(SimpleQuantity newQuantity, NotificationChain msgs) {
SimpleQuantity oldQuantity = quantity;
quantity = newQuantity;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__QUANTITY, oldQuantity, newQuantity);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setQuantity(SimpleQuantity newQuantity) {
if (newQuantity != quantity) {
NotificationChain msgs = null;
if (quantity != null)
msgs = ((InternalEObject)quantity).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__QUANTITY, null, msgs);
if (newQuantity != null)
msgs = ((InternalEObject)newQuantity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__QUANTITY, null, msgs);
msgs = basicSetQuantity(newQuantity, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__QUANTITY, newQuantity, newQuantity));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Duration getExpectedSupplyDuration() {
return expectedSupplyDuration;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExpectedSupplyDuration(Duration newExpectedSupplyDuration, NotificationChain msgs) {
Duration oldExpectedSupplyDuration = expectedSupplyDuration;
expectedSupplyDuration = newExpectedSupplyDuration;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__EXPECTED_SUPPLY_DURATION, oldExpectedSupplyDuration, newExpectedSupplyDuration);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExpectedSupplyDuration(Duration newExpectedSupplyDuration) {
if (newExpectedSupplyDuration != expectedSupplyDuration) {
NotificationChain msgs = null;
if (expectedSupplyDuration != null)
msgs = ((InternalEObject)expectedSupplyDuration).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__EXPECTED_SUPPLY_DURATION, null, msgs);
if (newExpectedSupplyDuration != null)
msgs = ((InternalEObject)newExpectedSupplyDuration).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__EXPECTED_SUPPLY_DURATION, null, msgs);
msgs = basicSetExpectedSupplyDuration(newExpectedSupplyDuration, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__EXPECTED_SUPPLY_DURATION, newExpectedSupplyDuration, newExpectedSupplyDuration));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_CODEABLE_CONCEPT:
return basicSetMedicationCodeableConcept(null, msgs);
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_REFERENCE:
return basicSetMedicationReference(null, msgs);
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__VALIDITY_PERIOD:
return basicSetValidityPeriod(null, msgs);
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__NUMBER_OF_REPEATS_ALLOWED:
return basicSetNumberOfRepeatsAllowed(null, msgs);
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__QUANTITY:
return basicSetQuantity(null, msgs);
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__EXPECTED_SUPPLY_DURATION:
return basicSetExpectedSupplyDuration(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_ORDER_DISPENSE_REQUEST__MEDICATION_CODEABLE_CONCEPT:
return getMedicationCodeableConcept();
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_REFERENCE:
return getMedicationReference();
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__VALIDITY_PERIOD:
return getValidityPeriod();
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__NUMBER_OF_REPEATS_ALLOWED:
return getNumberOfRepeatsAllowed();
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__QUANTITY:
return getQuantity();
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__EXPECTED_SUPPLY_DURATION:
return getExpectedSupplyDuration();
}
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_ORDER_DISPENSE_REQUEST__MEDICATION_CODEABLE_CONCEPT:
setMedicationCodeableConcept((CodeableConcept)newValue);
return;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_REFERENCE:
setMedicationReference((Reference)newValue);
return;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__VALIDITY_PERIOD:
setValidityPeriod((Period)newValue);
return;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__NUMBER_OF_REPEATS_ALLOWED:
setNumberOfRepeatsAllowed((PositiveInt)newValue);
return;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__QUANTITY:
setQuantity((SimpleQuantity)newValue);
return;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__EXPECTED_SUPPLY_DURATION:
setExpectedSupplyDuration((Duration)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_CODEABLE_CONCEPT:
setMedicationCodeableConcept((CodeableConcept)null);
return;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_REFERENCE:
setMedicationReference((Reference)null);
return;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__VALIDITY_PERIOD:
setValidityPeriod((Period)null);
return;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__NUMBER_OF_REPEATS_ALLOWED:
setNumberOfRepeatsAllowed((PositiveInt)null);
return;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__QUANTITY:
setQuantity((SimpleQuantity)null);
return;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__EXPECTED_SUPPLY_DURATION:
setExpectedSupplyDuration((Duration)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_CODEABLE_CONCEPT:
return medicationCodeableConcept != null;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__MEDICATION_REFERENCE:
return medicationReference != null;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__VALIDITY_PERIOD:
return validityPeriod != null;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__NUMBER_OF_REPEATS_ALLOWED:
return numberOfRepeatsAllowed != null;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__QUANTITY:
return quantity != null;
case FhirPackage.MEDICATION_ORDER_DISPENSE_REQUEST__EXPECTED_SUPPLY_DURATION:
return expectedSupplyDuration != null;
}
return super.eIsSet(featureID);
}
} //MedicationOrderDispenseRequestImpl