| /******************************************************************************* |
| * 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 java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| 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.EObjectResolvingEList; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.Element; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Extension; |
| import org.eclipse.mdht.uml.fhir.core.datatype.FhirDatatypePackage; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Id; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Element</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.datatype.impl.ElementImpl#getId <em>Id</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.datatype.impl.ElementImpl#getExtensions <em>Extension</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class ElementImpl extends BaseImpl implements Element { |
| /** |
| * The cached value of the '{@link #getId() <em>Id</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected Id id; |
| |
| /** |
| * The cached value of the '{@link #getExtensions() <em>Extension</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getExtensions() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Extension> extensions; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ElementImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirDatatypePackage.Literals.ELEMENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Id getId() { |
| if (id != null && id.eIsProxy()) { |
| InternalEObject oldId = (InternalEObject)id; |
| id = (Id)eResolveProxy(oldId); |
| if (id != oldId) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirDatatypePackage.ELEMENT__ID, oldId, id)); |
| } |
| } |
| return id; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Id basicGetId() { |
| return id; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setId(Id newId) { |
| Id oldId = id; |
| id = newId; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.ELEMENT__ID, oldId, id)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Extension> getExtensions() { |
| if (extensions == null) { |
| extensions = new EObjectResolvingEList<Extension>(Extension.class, this, FhirDatatypePackage.ELEMENT__EXTENSION); |
| } |
| return extensions; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FhirDatatypePackage.ELEMENT__ID: |
| if (resolve) return getId(); |
| return basicGetId(); |
| case FhirDatatypePackage.ELEMENT__EXTENSION: |
| return getExtensions(); |
| } |
| 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 FhirDatatypePackage.ELEMENT__ID: |
| setId((Id)newValue); |
| return; |
| case FhirDatatypePackage.ELEMENT__EXTENSION: |
| getExtensions().clear(); |
| getExtensions().addAll((Collection<? extends Extension>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirDatatypePackage.ELEMENT__ID: |
| setId((Id)null); |
| return; |
| case FhirDatatypePackage.ELEMENT__EXTENSION: |
| getExtensions().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirDatatypePackage.ELEMENT__ID: |
| return id != null; |
| case FhirDatatypePackage.ELEMENT__EXTENSION: |
| return extensions != null && !extensions.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //ElementImpl |