blob: 1c02b0e4df5c4020242042c89168080c1441c8ea [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 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.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.Period;
import org.eclipse.mdht.uml.fhir.core.resource.Encounter;
import org.eclipse.mdht.uml.fhir.core.resource.FhirResourcePackage;
import org.eclipse.mdht.uml.fhir.core.resource.Flag;
import org.eclipse.mdht.uml.fhir.core.resource.Resource;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Flag</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.FlagImpl#getIdentifiers <em>Identifier</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.FlagImpl#getCategory <em>Category</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.FlagImpl#getStatus <em>Status</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.FlagImpl#getPeriod <em>Period</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.FlagImpl#getSubject <em>Subject</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.FlagImpl#getEncounter <em>Encounter</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.FlagImpl#getAuthor <em>Author</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.FlagImpl#getCode <em>Code</em>}</li>
* </ul>
*
* @generated
*/
public class FlagImpl extends DomainResourceImpl implements Flag {
/**
* 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 #getCategory() <em>Category</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCategory()
* @generated
* @ordered
*/
protected CodeableConcept category;
/**
* 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 #getPeriod() <em>Period</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPeriod()
* @generated
* @ordered
*/
protected Period period;
/**
* The cached value of the '{@link #getSubject() <em>Subject</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSubject()
* @generated
* @ordered
*/
protected Resource subject;
/**
* The cached value of the '{@link #getEncounter() <em>Encounter</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEncounter()
* @generated
* @ordered
*/
protected Encounter encounter;
/**
* The cached value of the '{@link #getAuthor() <em>Author</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAuthor()
* @generated
* @ordered
*/
protected Resource author;
/**
* The cached value of the '{@link #getCode() <em>Code</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCode()
* @generated
* @ordered
*/
protected CodeableConcept code;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected FlagImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirResourcePackage.eINSTANCE.getFlag();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Identifier> getIdentifiers() {
if (identifiers == null) {
identifiers = new EObjectResolvingEList<Identifier>(Identifier.class, this, FhirResourcePackage.FLAG__IDENTIFIER);
}
return identifiers;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CodeableConcept getCategory() {
if (category != null && category.eIsProxy()) {
InternalEObject oldCategory = (InternalEObject)category;
category = (CodeableConcept)eResolveProxy(oldCategory);
if (category != oldCategory) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.FLAG__CATEGORY, oldCategory, category));
}
}
return category;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CodeableConcept basicGetCategory() {
return category;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCategory(CodeableConcept newCategory) {
CodeableConcept oldCategory = category;
category = newCategory;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.FLAG__CATEGORY, oldCategory, category));
}
/**
* <!-- 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, FhirResourcePackage.FLAG__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, FhirResourcePackage.FLAG__STATUS, oldStatus, status));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Period getPeriod() {
if (period != null && period.eIsProxy()) {
InternalEObject oldPeriod = (InternalEObject)period;
period = (Period)eResolveProxy(oldPeriod);
if (period != oldPeriod) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.FLAG__PERIOD, oldPeriod, period));
}
}
return period;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Period basicGetPeriod() {
return period;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPeriod(Period newPeriod) {
Period oldPeriod = period;
period = newPeriod;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.FLAG__PERIOD, oldPeriod, period));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Resource getSubject() {
if (subject != null && subject.eIsProxy()) {
InternalEObject oldSubject = (InternalEObject)subject;
subject = (Resource)eResolveProxy(oldSubject);
if (subject != oldSubject) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.FLAG__SUBJECT, oldSubject, subject));
}
}
return subject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Resource basicGetSubject() {
return subject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSubject(Resource newSubject) {
Resource oldSubject = subject;
subject = newSubject;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.FLAG__SUBJECT, oldSubject, subject));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Encounter getEncounter() {
if (encounter != null && encounter.eIsProxy()) {
InternalEObject oldEncounter = (InternalEObject)encounter;
encounter = (Encounter)eResolveProxy(oldEncounter);
if (encounter != oldEncounter) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.FLAG__ENCOUNTER, oldEncounter, encounter));
}
}
return encounter;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Encounter basicGetEncounter() {
return encounter;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEncounter(Encounter newEncounter) {
Encounter oldEncounter = encounter;
encounter = newEncounter;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.FLAG__ENCOUNTER, oldEncounter, encounter));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Resource getAuthor() {
if (author != null && author.eIsProxy()) {
InternalEObject oldAuthor = (InternalEObject)author;
author = (Resource)eResolveProxy(oldAuthor);
if (author != oldAuthor) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.FLAG__AUTHOR, oldAuthor, author));
}
}
return author;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Resource basicGetAuthor() {
return author;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAuthor(Resource newAuthor) {
Resource oldAuthor = author;
author = newAuthor;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.FLAG__AUTHOR, oldAuthor, author));
}
/**
* <!-- 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.FLAG__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.FLAG__CODE, oldCode, code));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case FhirResourcePackage.FLAG__IDENTIFIER:
return getIdentifiers();
case FhirResourcePackage.FLAG__CATEGORY:
if (resolve) return getCategory();
return basicGetCategory();
case FhirResourcePackage.FLAG__STATUS:
if (resolve) return getStatus();
return basicGetStatus();
case FhirResourcePackage.FLAG__PERIOD:
if (resolve) return getPeriod();
return basicGetPeriod();
case FhirResourcePackage.FLAG__SUBJECT:
if (resolve) return getSubject();
return basicGetSubject();
case FhirResourcePackage.FLAG__ENCOUNTER:
if (resolve) return getEncounter();
return basicGetEncounter();
case FhirResourcePackage.FLAG__AUTHOR:
if (resolve) return getAuthor();
return basicGetAuthor();
case FhirResourcePackage.FLAG__CODE:
if (resolve) return getCode();
return basicGetCode();
}
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.FLAG__IDENTIFIER:
getIdentifiers().clear();
getIdentifiers().addAll((Collection<? extends Identifier>)newValue);
return;
case FhirResourcePackage.FLAG__CATEGORY:
setCategory((CodeableConcept)newValue);
return;
case FhirResourcePackage.FLAG__STATUS:
setStatus((Code)newValue);
return;
case FhirResourcePackage.FLAG__PERIOD:
setPeriod((Period)newValue);
return;
case FhirResourcePackage.FLAG__SUBJECT:
setSubject((Resource)newValue);
return;
case FhirResourcePackage.FLAG__ENCOUNTER:
setEncounter((Encounter)newValue);
return;
case FhirResourcePackage.FLAG__AUTHOR:
setAuthor((Resource)newValue);
return;
case FhirResourcePackage.FLAG__CODE:
setCode((CodeableConcept)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirResourcePackage.FLAG__IDENTIFIER:
getIdentifiers().clear();
return;
case FhirResourcePackage.FLAG__CATEGORY:
setCategory((CodeableConcept)null);
return;
case FhirResourcePackage.FLAG__STATUS:
setStatus((Code)null);
return;
case FhirResourcePackage.FLAG__PERIOD:
setPeriod((Period)null);
return;
case FhirResourcePackage.FLAG__SUBJECT:
setSubject((Resource)null);
return;
case FhirResourcePackage.FLAG__ENCOUNTER:
setEncounter((Encounter)null);
return;
case FhirResourcePackage.FLAG__AUTHOR:
setAuthor((Resource)null);
return;
case FhirResourcePackage.FLAG__CODE:
setCode((CodeableConcept)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirResourcePackage.FLAG__IDENTIFIER:
return identifiers != null && !identifiers.isEmpty();
case FhirResourcePackage.FLAG__CATEGORY:
return category != null;
case FhirResourcePackage.FLAG__STATUS:
return status != null;
case FhirResourcePackage.FLAG__PERIOD:
return period != null;
case FhirResourcePackage.FLAG__SUBJECT:
return subject != null;
case FhirResourcePackage.FLAG__ENCOUNTER:
return encounter != null;
case FhirResourcePackage.FLAG__AUTHOR:
return author != null;
case FhirResourcePackage.FLAG__CODE:
return code != null;
}
return super.eIsSet(featureID);
}
} //FlagImpl