blob: 532c3fe975121ba155aa8b7406cc03212e6bf01b [file] [log] [blame]
/**
*/
package org.hl7.fhir.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.InternalEList;
import org.hl7.fhir.CodeableConcept;
import org.hl7.fhir.ContractActor1;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.Reference;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Contract Actor1</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.ContractActor1Impl#getEntity <em>Entity</em>}</li>
* <li>{@link org.hl7.fhir.impl.ContractActor1Impl#getRole <em>Role</em>}</li>
* </ul>
*
* @generated
*/
public class ContractActor1Impl extends BackboneElementImpl implements ContractActor1 {
/**
* The cached value of the '{@link #getEntity() <em>Entity</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEntity()
* @generated
* @ordered
*/
protected Reference entity;
/**
* The cached value of the '{@link #getRole() <em>Role</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRole()
* @generated
* @ordered
*/
protected EList<CodeableConcept> role;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ContractActor1Impl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getContractActor1();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Reference getEntity() {
return entity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetEntity(Reference newEntity, NotificationChain msgs) {
Reference oldEntity = entity;
entity = newEntity;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.CONTRACT_ACTOR1__ENTITY, oldEntity, newEntity);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEntity(Reference newEntity) {
if (newEntity != entity) {
NotificationChain msgs = null;
if (entity != null)
msgs = ((InternalEObject)entity).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.CONTRACT_ACTOR1__ENTITY, null, msgs);
if (newEntity != null)
msgs = ((InternalEObject)newEntity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.CONTRACT_ACTOR1__ENTITY, null, msgs);
msgs = basicSetEntity(newEntity, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.CONTRACT_ACTOR1__ENTITY, newEntity, newEntity));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<CodeableConcept> getRole() {
if (role == null) {
role = new EObjectContainmentEList<CodeableConcept>(CodeableConcept.class, this, FhirPackage.CONTRACT_ACTOR1__ROLE);
}
return role;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.CONTRACT_ACTOR1__ENTITY:
return basicSetEntity(null, msgs);
case FhirPackage.CONTRACT_ACTOR1__ROLE:
return ((InternalEList<?>)getRole()).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 FhirPackage.CONTRACT_ACTOR1__ENTITY:
return getEntity();
case FhirPackage.CONTRACT_ACTOR1__ROLE:
return getRole();
}
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 FhirPackage.CONTRACT_ACTOR1__ENTITY:
setEntity((Reference)newValue);
return;
case FhirPackage.CONTRACT_ACTOR1__ROLE:
getRole().clear();
getRole().addAll((Collection<? extends CodeableConcept>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.CONTRACT_ACTOR1__ENTITY:
setEntity((Reference)null);
return;
case FhirPackage.CONTRACT_ACTOR1__ROLE:
getRole().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.CONTRACT_ACTOR1__ENTITY:
return entity != null;
case FhirPackage.CONTRACT_ACTOR1__ROLE:
return role != null && !role.isEmpty();
}
return super.eIsSet(featureID);
}
} //ContractActor1Impl