| /******************************************************************************* |
| * 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.datatype.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.Code; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Decimal; |
| import org.eclipse.mdht.uml.fhir.core.datatype.FhirDatatypePackage; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Quantity; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Uri; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Quantity</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.datatype.impl.QuantityImpl#getValue <em>Value</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.datatype.impl.QuantityImpl#getComparator <em>Comparator</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.datatype.impl.QuantityImpl#getUnit <em>Unit</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.datatype.impl.QuantityImpl#getSystem <em>System</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.datatype.impl.QuantityImpl#getCode <em>Code</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class QuantityImpl extends DataTypeImpl implements Quantity { |
| /** |
| * The cached value of the '{@link #getValue() <em>Value</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValue() |
| * @generated |
| * @ordered |
| */ |
| protected Decimal value; |
| |
| /** |
| * The cached value of the '{@link #getComparator() <em>Comparator</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getComparator() |
| * @generated |
| * @ordered |
| */ |
| protected Code comparator; |
| |
| /** |
| * The cached value of the '{@link #getUnit() <em>Unit</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUnit() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.mdht.uml.fhir.core.datatype.String unit; |
| |
| /** |
| * The cached value of the '{@link #getSystem() <em>System</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSystem() |
| * @generated |
| * @ordered |
| */ |
| protected Uri system; |
| |
| /** |
| * The cached value of the '{@link #getCode() <em>Code</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCode() |
| * @generated |
| * @ordered |
| */ |
| protected Code code; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected QuantityImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirDatatypePackage.Literals.QUANTITY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Decimal getValue() { |
| if (value != null && value.eIsProxy()) { |
| InternalEObject oldValue = (InternalEObject)value; |
| value = (Decimal)eResolveProxy(oldValue); |
| if (value != oldValue) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirDatatypePackage.QUANTITY__VALUE, oldValue, value)); |
| } |
| } |
| return value; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Decimal basicGetValue() { |
| return value; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setValue(Decimal newValue) { |
| Decimal oldValue = value; |
| value = newValue; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.QUANTITY__VALUE, oldValue, value)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Code getComparator() { |
| if (comparator != null && comparator.eIsProxy()) { |
| InternalEObject oldComparator = (InternalEObject)comparator; |
| comparator = (Code)eResolveProxy(oldComparator); |
| if (comparator != oldComparator) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirDatatypePackage.QUANTITY__COMPARATOR, oldComparator, comparator)); |
| } |
| } |
| return comparator; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Code basicGetComparator() { |
| return comparator; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setComparator(Code newComparator) { |
| Code oldComparator = comparator; |
| comparator = newComparator; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.QUANTITY__COMPARATOR, oldComparator, comparator)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.String getUnit() { |
| if (unit != null && unit.eIsProxy()) { |
| InternalEObject oldUnit = (InternalEObject)unit; |
| unit = (org.eclipse.mdht.uml.fhir.core.datatype.String)eResolveProxy(oldUnit); |
| if (unit != oldUnit) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirDatatypePackage.QUANTITY__UNIT, oldUnit, unit)); |
| } |
| } |
| return unit; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.String basicGetUnit() { |
| return unit; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setUnit(org.eclipse.mdht.uml.fhir.core.datatype.String newUnit) { |
| org.eclipse.mdht.uml.fhir.core.datatype.String oldUnit = unit; |
| unit = newUnit; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.QUANTITY__UNIT, oldUnit, unit)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Uri getSystem() { |
| if (system != null && system.eIsProxy()) { |
| InternalEObject oldSystem = (InternalEObject)system; |
| system = (Uri)eResolveProxy(oldSystem); |
| if (system != oldSystem) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirDatatypePackage.QUANTITY__SYSTEM, oldSystem, system)); |
| } |
| } |
| return system; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Uri basicGetSystem() { |
| return system; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSystem(Uri newSystem) { |
| Uri oldSystem = system; |
| system = newSystem; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.QUANTITY__SYSTEM, oldSystem, system)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Code getCode() { |
| if (code != null && code.eIsProxy()) { |
| InternalEObject oldCode = (InternalEObject)code; |
| code = (Code)eResolveProxy(oldCode); |
| if (code != oldCode) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirDatatypePackage.QUANTITY__CODE, oldCode, code)); |
| } |
| } |
| return code; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Code basicGetCode() { |
| return code; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCode(Code newCode) { |
| Code oldCode = code; |
| code = newCode; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.QUANTITY__CODE, oldCode, code)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FhirDatatypePackage.QUANTITY__VALUE: |
| if (resolve) return getValue(); |
| return basicGetValue(); |
| case FhirDatatypePackage.QUANTITY__COMPARATOR: |
| if (resolve) return getComparator(); |
| return basicGetComparator(); |
| case FhirDatatypePackage.QUANTITY__UNIT: |
| if (resolve) return getUnit(); |
| return basicGetUnit(); |
| case FhirDatatypePackage.QUANTITY__SYSTEM: |
| if (resolve) return getSystem(); |
| return basicGetSystem(); |
| case FhirDatatypePackage.QUANTITY__CODE: |
| if (resolve) return getCode(); |
| return basicGetCode(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FhirDatatypePackage.QUANTITY__VALUE: |
| setValue((Decimal)newValue); |
| return; |
| case FhirDatatypePackage.QUANTITY__COMPARATOR: |
| setComparator((Code)newValue); |
| return; |
| case FhirDatatypePackage.QUANTITY__UNIT: |
| setUnit((org.eclipse.mdht.uml.fhir.core.datatype.String)newValue); |
| return; |
| case FhirDatatypePackage.QUANTITY__SYSTEM: |
| setSystem((Uri)newValue); |
| return; |
| case FhirDatatypePackage.QUANTITY__CODE: |
| setCode((Code)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirDatatypePackage.QUANTITY__VALUE: |
| setValue((Decimal)null); |
| return; |
| case FhirDatatypePackage.QUANTITY__COMPARATOR: |
| setComparator((Code)null); |
| return; |
| case FhirDatatypePackage.QUANTITY__UNIT: |
| setUnit((org.eclipse.mdht.uml.fhir.core.datatype.String)null); |
| return; |
| case FhirDatatypePackage.QUANTITY__SYSTEM: |
| setSystem((Uri)null); |
| return; |
| case FhirDatatypePackage.QUANTITY__CODE: |
| setCode((Code)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirDatatypePackage.QUANTITY__VALUE: |
| return value != null; |
| case FhirDatatypePackage.QUANTITY__COMPARATOR: |
| return comparator != null; |
| case FhirDatatypePackage.QUANTITY__UNIT: |
| return unit != null; |
| case FhirDatatypePackage.QUANTITY__SYSTEM: |
| return system != null; |
| case FhirDatatypePackage.QUANTITY__CODE: |
| return code != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //QuantityImpl |