blob: abaff74aa6bbfddb7aa0e5c345d4f2c1fcd43caa [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.DateTime;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.MedicationBatch;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Medication Batch</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.MedicationBatchImpl#getLotNumber <em>Lot Number</em>}</li>
* <li>{@link org.hl7.fhir.impl.MedicationBatchImpl#getExpirationDate <em>Expiration Date</em>}</li>
* </ul>
*
* @generated
*/
public class MedicationBatchImpl extends BackboneElementImpl implements MedicationBatch {
/**
* The cached value of the '{@link #getLotNumber() <em>Lot Number</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLotNumber()
* @generated
* @ordered
*/
protected org.hl7.fhir.String lotNumber;
/**
* The cached value of the '{@link #getExpirationDate() <em>Expiration Date</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExpirationDate()
* @generated
* @ordered
*/
protected DateTime expirationDate;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MedicationBatchImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getMedicationBatch();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public org.hl7.fhir.String getLotNumber() {
return lotNumber;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLotNumber(org.hl7.fhir.String newLotNumber, NotificationChain msgs) {
org.hl7.fhir.String oldLotNumber = lotNumber;
lotNumber = newLotNumber;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_BATCH__LOT_NUMBER, oldLotNumber, newLotNumber);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLotNumber(org.hl7.fhir.String newLotNumber) {
if (newLotNumber != lotNumber) {
NotificationChain msgs = null;
if (lotNumber != null)
msgs = ((InternalEObject)lotNumber).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_BATCH__LOT_NUMBER, null, msgs);
if (newLotNumber != null)
msgs = ((InternalEObject)newLotNumber).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_BATCH__LOT_NUMBER, null, msgs);
msgs = basicSetLotNumber(newLotNumber, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_BATCH__LOT_NUMBER, newLotNumber, newLotNumber));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DateTime getExpirationDate() {
return expirationDate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExpirationDate(DateTime newExpirationDate, NotificationChain msgs) {
DateTime oldExpirationDate = expirationDate;
expirationDate = newExpirationDate;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_BATCH__EXPIRATION_DATE, oldExpirationDate, newExpirationDate);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExpirationDate(DateTime newExpirationDate) {
if (newExpirationDate != expirationDate) {
NotificationChain msgs = null;
if (expirationDate != null)
msgs = ((InternalEObject)expirationDate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_BATCH__EXPIRATION_DATE, null, msgs);
if (newExpirationDate != null)
msgs = ((InternalEObject)newExpirationDate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.MEDICATION_BATCH__EXPIRATION_DATE, null, msgs);
msgs = basicSetExpirationDate(newExpirationDate, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.MEDICATION_BATCH__EXPIRATION_DATE, newExpirationDate, newExpirationDate));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.MEDICATION_BATCH__LOT_NUMBER:
return basicSetLotNumber(null, msgs);
case FhirPackage.MEDICATION_BATCH__EXPIRATION_DATE:
return basicSetExpirationDate(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_BATCH__LOT_NUMBER:
return getLotNumber();
case FhirPackage.MEDICATION_BATCH__EXPIRATION_DATE:
return getExpirationDate();
}
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_BATCH__LOT_NUMBER:
setLotNumber((org.hl7.fhir.String)newValue);
return;
case FhirPackage.MEDICATION_BATCH__EXPIRATION_DATE:
setExpirationDate((DateTime)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.MEDICATION_BATCH__LOT_NUMBER:
setLotNumber((org.hl7.fhir.String)null);
return;
case FhirPackage.MEDICATION_BATCH__EXPIRATION_DATE:
setExpirationDate((DateTime)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.MEDICATION_BATCH__LOT_NUMBER:
return lotNumber != null;
case FhirPackage.MEDICATION_BATCH__EXPIRATION_DATE:
return expirationDate != null;
}
return super.eIsSet(featureID);
}
} //MedicationBatchImpl