blob: f4dcc1dafcac98b554fe6e17090c5c172347dd6e [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2016 David Carlson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* David Carlson (Clinical Cloud Solutions, LLC) - initial API and implementation
*******************************************************************************/
/**
*/
package org.eclipse.mdht.uml.fhir.core.resource.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.mdht.uml.fhir.core.datatype.DateTime;
import org.eclipse.mdht.uml.fhir.core.datatype.Identifier;
import org.eclipse.mdht.uml.fhir.core.datatype.SimpleQuantity;
import org.eclipse.mdht.uml.fhir.core.datatype.impl.BackboneElementImpl;
import org.eclipse.mdht.uml.fhir.core.resource.FhirResourcePackage;
import org.eclipse.mdht.uml.fhir.core.resource.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.eclipse.mdht.uml.fhir.core.resource.impl.SubstanceInstanceImpl#getIdentifier <em>Identifier</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.SubstanceInstanceImpl#getExpiry <em>Expiry</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.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>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIdentifier()
* @generated
* @ordered
*/
protected Identifier identifier;
/**
* The cached value of the '{@link #getExpiry() <em>Expiry</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExpiry()
* @generated
* @ordered
*/
protected DateTime expiry;
/**
* The cached value of the '{@link #getQuantity() <em>Quantity</em>}' 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 FhirResourcePackage.eINSTANCE.getSubstanceInstance();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Identifier getIdentifier() {
if (identifier != null && identifier.eIsProxy()) {
InternalEObject oldIdentifier = (InternalEObject)identifier;
identifier = (Identifier)eResolveProxy(oldIdentifier);
if (identifier != oldIdentifier) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.SUBSTANCE_INSTANCE__IDENTIFIER, oldIdentifier, identifier));
}
}
return identifier;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Identifier basicGetIdentifier() {
return identifier;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIdentifier(Identifier newIdentifier) {
Identifier oldIdentifier = identifier;
identifier = newIdentifier;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.SUBSTANCE_INSTANCE__IDENTIFIER, oldIdentifier, identifier));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DateTime getExpiry() {
if (expiry != null && expiry.eIsProxy()) {
InternalEObject oldExpiry = (InternalEObject)expiry;
expiry = (DateTime)eResolveProxy(oldExpiry);
if (expiry != oldExpiry) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.SUBSTANCE_INSTANCE__EXPIRY, oldExpiry, expiry));
}
}
return expiry;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DateTime basicGetExpiry() {
return expiry;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExpiry(DateTime newExpiry) {
DateTime oldExpiry = expiry;
expiry = newExpiry;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.SUBSTANCE_INSTANCE__EXPIRY, oldExpiry, expiry));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SimpleQuantity getQuantity() {
if (quantity != null && quantity.eIsProxy()) {
InternalEObject oldQuantity = (InternalEObject)quantity;
quantity = (SimpleQuantity)eResolveProxy(oldQuantity);
if (quantity != oldQuantity) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.SUBSTANCE_INSTANCE__QUANTITY, oldQuantity, quantity));
}
}
return quantity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SimpleQuantity basicGetQuantity() {
return quantity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setQuantity(SimpleQuantity newQuantity) {
SimpleQuantity oldQuantity = quantity;
quantity = newQuantity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.SUBSTANCE_INSTANCE__QUANTITY, oldQuantity, quantity));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case FhirResourcePackage.SUBSTANCE_INSTANCE__IDENTIFIER:
if (resolve) return getIdentifier();
return basicGetIdentifier();
case FhirResourcePackage.SUBSTANCE_INSTANCE__EXPIRY:
if (resolve) return getExpiry();
return basicGetExpiry();
case FhirResourcePackage.SUBSTANCE_INSTANCE__QUANTITY:
if (resolve) return getQuantity();
return basicGetQuantity();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case FhirResourcePackage.SUBSTANCE_INSTANCE__IDENTIFIER:
setIdentifier((Identifier)newValue);
return;
case FhirResourcePackage.SUBSTANCE_INSTANCE__EXPIRY:
setExpiry((DateTime)newValue);
return;
case FhirResourcePackage.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 FhirResourcePackage.SUBSTANCE_INSTANCE__IDENTIFIER:
setIdentifier((Identifier)null);
return;
case FhirResourcePackage.SUBSTANCE_INSTANCE__EXPIRY:
setExpiry((DateTime)null);
return;
case FhirResourcePackage.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 FhirResourcePackage.SUBSTANCE_INSTANCE__IDENTIFIER:
return identifier != null;
case FhirResourcePackage.SUBSTANCE_INSTANCE__EXPIRY:
return expiry != null;
case FhirResourcePackage.SUBSTANCE_INSTANCE__QUANTITY:
return quantity != null;
}
return super.eIsSet(featureID);
}
} //SubstanceInstanceImpl