blob: a8fd1db3ce71dc29c9fb2cea4e5bb5bedd2587f2 [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.datatype.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
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.FhirDatatypePackage;
import org.eclipse.mdht.uml.fhir.core.datatype.Narrative;
import org.eclipse.mdht.uml.fhir.core.datatype.NarrativeDiv;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Narrative</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.mdht.uml.fhir.core.datatype.impl.NarrativeImpl#getStatus <em>Status</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.datatype.impl.NarrativeImpl#getDiv <em>Div</em>}</li>
* </ul>
*
* @generated
*/
public class NarrativeImpl extends DataTypeImpl implements Narrative {
/**
* The cached value of the '{@link #getStatus() <em>Status</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStatus()
* @generated
* @ordered
*/
protected Code status;
/**
* The cached value of the '{@link #getDiv() <em>Div</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDiv()
* @generated
* @ordered
*/
protected NarrativeDiv div;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected NarrativeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirDatatypePackage.Literals.NARRATIVE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Code getStatus() {
if (status != null && status.eIsProxy()) {
InternalEObject oldStatus = (InternalEObject)status;
status = (Code)eResolveProxy(oldStatus);
if (status != oldStatus) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirDatatypePackage.NARRATIVE__STATUS, oldStatus, status));
}
}
return status;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Code basicGetStatus() {
return status;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStatus(Code newStatus) {
Code oldStatus = status;
status = newStatus;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.NARRATIVE__STATUS, oldStatus, status));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NarrativeDiv getDiv() {
return div;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDiv(NarrativeDiv newDiv, NotificationChain msgs) {
NarrativeDiv oldDiv = div;
div = newDiv;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.NARRATIVE__DIV, oldDiv, newDiv);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDiv(NarrativeDiv newDiv) {
if (newDiv != div) {
NotificationChain msgs = null;
if (div != null)
msgs = ((InternalEObject)div).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirDatatypePackage.NARRATIVE__DIV, null, msgs);
if (newDiv != null)
msgs = ((InternalEObject)newDiv).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirDatatypePackage.NARRATIVE__DIV, null, msgs);
msgs = basicSetDiv(newDiv, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.NARRATIVE__DIV, newDiv, newDiv));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirDatatypePackage.NARRATIVE__DIV:
return basicSetDiv(null, 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 FhirDatatypePackage.NARRATIVE__STATUS:
if (resolve) return getStatus();
return basicGetStatus();
case FhirDatatypePackage.NARRATIVE__DIV:
return getDiv();
}
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.NARRATIVE__STATUS:
setStatus((Code)newValue);
return;
case FhirDatatypePackage.NARRATIVE__DIV:
setDiv((NarrativeDiv)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirDatatypePackage.NARRATIVE__STATUS:
setStatus((Code)null);
return;
case FhirDatatypePackage.NARRATIVE__DIV:
setDiv((NarrativeDiv)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirDatatypePackage.NARRATIVE__STATUS:
return status != null;
case FhirDatatypePackage.NARRATIVE__DIV:
return div != null;
}
return super.eIsSet(featureID);
}
} //NarrativeImpl