blob: 5a26246a3eaa8762dbc59891ad58ee5b6ed4460d [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.Ratio;
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.Substance;
import org.eclipse.mdht.uml.fhir.core.resource.SubstanceIngredient;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Substance Ingredient</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.SubstanceIngredientImpl#getQuantity <em>Quantity</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.SubstanceIngredientImpl#getSubstance <em>Substance</em>}</li>
* </ul>
*
* @generated
*/
public class SubstanceIngredientImpl extends BackboneElementImpl implements SubstanceIngredient {
/**
* The cached value of the '{@link #getQuantity() <em>Quantity</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getQuantity()
* @generated
* @ordered
*/
protected Ratio quantity;
/**
* The cached value of the '{@link #getSubstance() <em>Substance</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSubstance()
* @generated
* @ordered
*/
protected Substance substance;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SubstanceIngredientImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirResourcePackage.eINSTANCE.getSubstanceIngredient();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Ratio getQuantity() {
if (quantity != null && quantity.eIsProxy()) {
InternalEObject oldQuantity = (InternalEObject)quantity;
quantity = (Ratio)eResolveProxy(oldQuantity);
if (quantity != oldQuantity) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.SUBSTANCE_INGREDIENT__QUANTITY, oldQuantity, quantity));
}
}
return quantity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Ratio basicGetQuantity() {
return quantity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setQuantity(Ratio newQuantity) {
Ratio oldQuantity = quantity;
quantity = newQuantity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.SUBSTANCE_INGREDIENT__QUANTITY, oldQuantity, quantity));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Substance getSubstance() {
if (substance != null && substance.eIsProxy()) {
InternalEObject oldSubstance = (InternalEObject)substance;
substance = (Substance)eResolveProxy(oldSubstance);
if (substance != oldSubstance) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.SUBSTANCE_INGREDIENT__SUBSTANCE, oldSubstance, substance));
}
}
return substance;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Substance basicGetSubstance() {
return substance;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSubstance(Substance newSubstance) {
Substance oldSubstance = substance;
substance = newSubstance;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.SUBSTANCE_INGREDIENT__SUBSTANCE, oldSubstance, substance));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case FhirResourcePackage.SUBSTANCE_INGREDIENT__QUANTITY:
if (resolve) return getQuantity();
return basicGetQuantity();
case FhirResourcePackage.SUBSTANCE_INGREDIENT__SUBSTANCE:
if (resolve) return getSubstance();
return basicGetSubstance();
}
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_INGREDIENT__QUANTITY:
setQuantity((Ratio)newValue);
return;
case FhirResourcePackage.SUBSTANCE_INGREDIENT__SUBSTANCE:
setSubstance((Substance)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirResourcePackage.SUBSTANCE_INGREDIENT__QUANTITY:
setQuantity((Ratio)null);
return;
case FhirResourcePackage.SUBSTANCE_INGREDIENT__SUBSTANCE:
setSubstance((Substance)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirResourcePackage.SUBSTANCE_INGREDIENT__QUANTITY:
return quantity != null;
case FhirResourcePackage.SUBSTANCE_INGREDIENT__SUBSTANCE:
return substance != null;
}
return super.eIsSet(featureID);
}
} //SubstanceIngredientImpl