| /** |
| */ |
| 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.Identifier; |
| import org.hl7.fhir.SimpleQuantity; |
| import org.hl7.fhir.SubstanceInstance; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Substance Instance</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.hl7.fhir.impl.SubstanceInstanceImpl#getIdentifier <em>Identifier</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.SubstanceInstanceImpl#getExpiry <em>Expiry</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.SubstanceInstanceImpl#getQuantity <em>Quantity</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SubstanceInstanceImpl extends BackboneElementImpl implements SubstanceInstance { |
| /** |
| * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIdentifier() |
| * @generated |
| * @ordered |
| */ |
| protected Identifier identifier; |
| |
| /** |
| * The cached value of the '{@link #getExpiry() <em>Expiry</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getExpiry() |
| * @generated |
| * @ordered |
| */ |
| protected DateTime expiry; |
| |
| /** |
| * 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SubstanceInstanceImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirPackage.eINSTANCE.getSubstanceInstance(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Identifier getIdentifier() { |
| return identifier; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetIdentifier(Identifier newIdentifier, NotificationChain msgs) { |
| Identifier oldIdentifier = identifier; |
| identifier = newIdentifier; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.SUBSTANCE_INSTANCE__IDENTIFIER, oldIdentifier, newIdentifier); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setIdentifier(Identifier newIdentifier) { |
| if (newIdentifier != identifier) { |
| NotificationChain msgs = null; |
| if (identifier != null) |
| msgs = ((InternalEObject)identifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.SUBSTANCE_INSTANCE__IDENTIFIER, null, msgs); |
| if (newIdentifier != null) |
| msgs = ((InternalEObject)newIdentifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.SUBSTANCE_INSTANCE__IDENTIFIER, null, msgs); |
| msgs = basicSetIdentifier(newIdentifier, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.SUBSTANCE_INSTANCE__IDENTIFIER, newIdentifier, newIdentifier)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public DateTime getExpiry() { |
| return expiry; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetExpiry(DateTime newExpiry, NotificationChain msgs) { |
| DateTime oldExpiry = expiry; |
| expiry = newExpiry; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.SUBSTANCE_INSTANCE__EXPIRY, oldExpiry, newExpiry); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setExpiry(DateTime newExpiry) { |
| if (newExpiry != expiry) { |
| NotificationChain msgs = null; |
| if (expiry != null) |
| msgs = ((InternalEObject)expiry).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.SUBSTANCE_INSTANCE__EXPIRY, null, msgs); |
| if (newExpiry != null) |
| msgs = ((InternalEObject)newExpiry).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.SUBSTANCE_INSTANCE__EXPIRY, null, msgs); |
| msgs = basicSetExpiry(newExpiry, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.SUBSTANCE_INSTANCE__EXPIRY, newExpiry, newExpiry)); |
| } |
| |
| /** |
| * <!-- 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.SUBSTANCE_INSTANCE__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.SUBSTANCE_INSTANCE__QUANTITY, null, msgs); |
| if (newQuantity != null) |
| msgs = ((InternalEObject)newQuantity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.SUBSTANCE_INSTANCE__QUANTITY, null, msgs); |
| msgs = basicSetQuantity(newQuantity, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.SUBSTANCE_INSTANCE__QUANTITY, newQuantity, newQuantity)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirPackage.SUBSTANCE_INSTANCE__IDENTIFIER: |
| return basicSetIdentifier(null, msgs); |
| case FhirPackage.SUBSTANCE_INSTANCE__EXPIRY: |
| return basicSetExpiry(null, msgs); |
| case FhirPackage.SUBSTANCE_INSTANCE__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.SUBSTANCE_INSTANCE__IDENTIFIER: |
| return getIdentifier(); |
| case FhirPackage.SUBSTANCE_INSTANCE__EXPIRY: |
| return getExpiry(); |
| case FhirPackage.SUBSTANCE_INSTANCE__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.SUBSTANCE_INSTANCE__IDENTIFIER: |
| setIdentifier((Identifier)newValue); |
| return; |
| case FhirPackage.SUBSTANCE_INSTANCE__EXPIRY: |
| setExpiry((DateTime)newValue); |
| return; |
| case FhirPackage.SUBSTANCE_INSTANCE__QUANTITY: |
| setQuantity((SimpleQuantity)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirPackage.SUBSTANCE_INSTANCE__IDENTIFIER: |
| setIdentifier((Identifier)null); |
| return; |
| case FhirPackage.SUBSTANCE_INSTANCE__EXPIRY: |
| setExpiry((DateTime)null); |
| return; |
| case FhirPackage.SUBSTANCE_INSTANCE__QUANTITY: |
| setQuantity((SimpleQuantity)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirPackage.SUBSTANCE_INSTANCE__IDENTIFIER: |
| return identifier != null; |
| case FhirPackage.SUBSTANCE_INSTANCE__EXPIRY: |
| return expiry != null; |
| case FhirPackage.SUBSTANCE_INSTANCE__QUANTITY: |
| return quantity != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //SubstanceInstanceImpl |