| /******************************************************************************* |
| * 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 java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.Code; |
| import org.eclipse.mdht.uml.fhir.core.datatype.CodeableConcept; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Identifier; |
| import org.eclipse.mdht.uml.fhir.core.datatype.UnsignedInt; |
| |
| import org.eclipse.mdht.uml.fhir.core.resource.FhirResourcePackage; |
| import org.eclipse.mdht.uml.fhir.core.resource.Group; |
| import org.eclipse.mdht.uml.fhir.core.resource.GroupCharacteristic; |
| import org.eclipse.mdht.uml.fhir.core.resource.GroupMember; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Group</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.GroupImpl#getIdentifiers <em>Identifier</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.GroupImpl#getType <em>Type</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.GroupImpl#getActual <em>Actual</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.GroupImpl#getCode <em>Code</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.GroupImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.GroupImpl#getQuantity <em>Quantity</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.GroupImpl#getCharacteristics <em>Characteristic</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.GroupImpl#getMembers <em>Member</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class GroupImpl extends DomainResourceImpl implements Group { |
| /** |
| * The cached value of the '{@link #getIdentifiers() <em>Identifier</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIdentifiers() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Identifier> identifiers; |
| |
| /** |
| * The cached value of the '{@link #getType() <em>Type</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected Code type; |
| |
| /** |
| * The cached value of the '{@link #getActual() <em>Actual</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getActual() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.mdht.uml.fhir.core.datatype.Boolean actual; |
| |
| /** |
| * The cached value of the '{@link #getCode() <em>Code</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCode() |
| * @generated |
| * @ordered |
| */ |
| protected CodeableConcept code; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.mdht.uml.fhir.core.datatype.String name; |
| |
| /** |
| * The cached value of the '{@link #getQuantity() <em>Quantity</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getQuantity() |
| * @generated |
| * @ordered |
| */ |
| protected UnsignedInt quantity; |
| |
| /** |
| * The cached value of the '{@link #getCharacteristics() <em>Characteristic</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCharacteristics() |
| * @generated |
| * @ordered |
| */ |
| protected EList<GroupCharacteristic> characteristics; |
| |
| /** |
| * The cached value of the '{@link #getMembers() <em>Member</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMembers() |
| * @generated |
| * @ordered |
| */ |
| protected EList<GroupMember> members; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected GroupImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getGroup(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Identifier> getIdentifiers() { |
| if (identifiers == null) { |
| identifiers = new EObjectResolvingEList<Identifier>(Identifier.class, this, FhirResourcePackage.GROUP__IDENTIFIER); |
| } |
| return identifiers; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Code getType() { |
| if (type != null && type.eIsProxy()) { |
| InternalEObject oldType = (InternalEObject)type; |
| type = (Code)eResolveProxy(oldType); |
| if (type != oldType) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.GROUP__TYPE, oldType, type)); |
| } |
| } |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Code basicGetType() { |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setType(Code newType) { |
| Code oldType = type; |
| type = newType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.GROUP__TYPE, oldType, type)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.Boolean getActual() { |
| if (actual != null && actual.eIsProxy()) { |
| InternalEObject oldActual = (InternalEObject)actual; |
| actual = (org.eclipse.mdht.uml.fhir.core.datatype.Boolean)eResolveProxy(oldActual); |
| if (actual != oldActual) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.GROUP__ACTUAL, oldActual, actual)); |
| } |
| } |
| return actual; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.Boolean basicGetActual() { |
| return actual; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setActual(org.eclipse.mdht.uml.fhir.core.datatype.Boolean newActual) { |
| org.eclipse.mdht.uml.fhir.core.datatype.Boolean oldActual = actual; |
| actual = newActual; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.GROUP__ACTUAL, oldActual, actual)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept getCode() { |
| if (code != null && code.eIsProxy()) { |
| InternalEObject oldCode = (InternalEObject)code; |
| code = (CodeableConcept)eResolveProxy(oldCode); |
| if (code != oldCode) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.GROUP__CODE, oldCode, code)); |
| } |
| } |
| return code; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept basicGetCode() { |
| return code; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCode(CodeableConcept newCode) { |
| CodeableConcept oldCode = code; |
| code = newCode; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.GROUP__CODE, oldCode, code)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.String getName() { |
| if (name != null && name.eIsProxy()) { |
| InternalEObject oldName = (InternalEObject)name; |
| name = (org.eclipse.mdht.uml.fhir.core.datatype.String)eResolveProxy(oldName); |
| if (name != oldName) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.GROUP__NAME, oldName, name)); |
| } |
| } |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.String basicGetName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setName(org.eclipse.mdht.uml.fhir.core.datatype.String newName) { |
| org.eclipse.mdht.uml.fhir.core.datatype.String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.GROUP__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public UnsignedInt getQuantity() { |
| if (quantity != null && quantity.eIsProxy()) { |
| InternalEObject oldQuantity = (InternalEObject)quantity; |
| quantity = (UnsignedInt)eResolveProxy(oldQuantity); |
| if (quantity != oldQuantity) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.GROUP__QUANTITY, oldQuantity, quantity)); |
| } |
| } |
| return quantity; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public UnsignedInt basicGetQuantity() { |
| return quantity; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setQuantity(UnsignedInt newQuantity) { |
| UnsignedInt oldQuantity = quantity; |
| quantity = newQuantity; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.GROUP__QUANTITY, oldQuantity, quantity)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<GroupCharacteristic> getCharacteristics() { |
| if (characteristics == null) { |
| characteristics = new EObjectContainmentEList<GroupCharacteristic>(GroupCharacteristic.class, this, FhirResourcePackage.GROUP__CHARACTERISTIC); |
| } |
| return characteristics; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<GroupMember> getMembers() { |
| if (members == null) { |
| members = new EObjectContainmentEList<GroupMember>(GroupMember.class, this, FhirResourcePackage.GROUP__MEMBER); |
| } |
| return members; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirResourcePackage.GROUP__CHARACTERISTIC: |
| return ((InternalEList<?>)getCharacteristics()).basicRemove(otherEnd, msgs); |
| case FhirResourcePackage.GROUP__MEMBER: |
| return ((InternalEList<?>)getMembers()).basicRemove(otherEnd, 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 FhirResourcePackage.GROUP__IDENTIFIER: |
| return getIdentifiers(); |
| case FhirResourcePackage.GROUP__TYPE: |
| if (resolve) return getType(); |
| return basicGetType(); |
| case FhirResourcePackage.GROUP__ACTUAL: |
| if (resolve) return getActual(); |
| return basicGetActual(); |
| case FhirResourcePackage.GROUP__CODE: |
| if (resolve) return getCode(); |
| return basicGetCode(); |
| case FhirResourcePackage.GROUP__NAME: |
| if (resolve) return getName(); |
| return basicGetName(); |
| case FhirResourcePackage.GROUP__QUANTITY: |
| if (resolve) return getQuantity(); |
| return basicGetQuantity(); |
| case FhirResourcePackage.GROUP__CHARACTERISTIC: |
| return getCharacteristics(); |
| case FhirResourcePackage.GROUP__MEMBER: |
| return getMembers(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FhirResourcePackage.GROUP__IDENTIFIER: |
| getIdentifiers().clear(); |
| getIdentifiers().addAll((Collection<? extends Identifier>)newValue); |
| return; |
| case FhirResourcePackage.GROUP__TYPE: |
| setType((Code)newValue); |
| return; |
| case FhirResourcePackage.GROUP__ACTUAL: |
| setActual((org.eclipse.mdht.uml.fhir.core.datatype.Boolean)newValue); |
| return; |
| case FhirResourcePackage.GROUP__CODE: |
| setCode((CodeableConcept)newValue); |
| return; |
| case FhirResourcePackage.GROUP__NAME: |
| setName((org.eclipse.mdht.uml.fhir.core.datatype.String)newValue); |
| return; |
| case FhirResourcePackage.GROUP__QUANTITY: |
| setQuantity((UnsignedInt)newValue); |
| return; |
| case FhirResourcePackage.GROUP__CHARACTERISTIC: |
| getCharacteristics().clear(); |
| getCharacteristics().addAll((Collection<? extends GroupCharacteristic>)newValue); |
| return; |
| case FhirResourcePackage.GROUP__MEMBER: |
| getMembers().clear(); |
| getMembers().addAll((Collection<? extends GroupMember>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.GROUP__IDENTIFIER: |
| getIdentifiers().clear(); |
| return; |
| case FhirResourcePackage.GROUP__TYPE: |
| setType((Code)null); |
| return; |
| case FhirResourcePackage.GROUP__ACTUAL: |
| setActual((org.eclipse.mdht.uml.fhir.core.datatype.Boolean)null); |
| return; |
| case FhirResourcePackage.GROUP__CODE: |
| setCode((CodeableConcept)null); |
| return; |
| case FhirResourcePackage.GROUP__NAME: |
| setName((org.eclipse.mdht.uml.fhir.core.datatype.String)null); |
| return; |
| case FhirResourcePackage.GROUP__QUANTITY: |
| setQuantity((UnsignedInt)null); |
| return; |
| case FhirResourcePackage.GROUP__CHARACTERISTIC: |
| getCharacteristics().clear(); |
| return; |
| case FhirResourcePackage.GROUP__MEMBER: |
| getMembers().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.GROUP__IDENTIFIER: |
| return identifiers != null && !identifiers.isEmpty(); |
| case FhirResourcePackage.GROUP__TYPE: |
| return type != null; |
| case FhirResourcePackage.GROUP__ACTUAL: |
| return actual != null; |
| case FhirResourcePackage.GROUP__CODE: |
| return code != null; |
| case FhirResourcePackage.GROUP__NAME: |
| return name != null; |
| case FhirResourcePackage.GROUP__QUANTITY: |
| return quantity != null; |
| case FhirResourcePackage.GROUP__CHARACTERISTIC: |
| return characteristics != null && !characteristics.isEmpty(); |
| case FhirResourcePackage.GROUP__MEMBER: |
| return members != null && !members.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //GroupImpl |