| /** |
| */ |
| 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.ContractSubject; |
| import org.hl7.fhir.FhirPackage; |
| import org.hl7.fhir.Reference; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Contract Subject</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.hl7.fhir.impl.ContractSubjectImpl#getReference <em>Reference</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.ContractSubjectImpl#getRole <em>Role</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ContractSubjectImpl extends BackboneElementImpl implements ContractSubject { |
| /** |
| * The cached value of the '{@link #getReference() <em>Reference</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getReference() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Reference> reference; |
| |
| /** |
| * The cached value of the '{@link #getRole() <em>Role</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRole() |
| * @generated |
| * @ordered |
| */ |
| protected CodeableConcept role; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ContractSubjectImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirPackage.eINSTANCE.getContractSubject(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Reference> getReference() { |
| if (reference == null) { |
| reference = new EObjectContainmentEList<Reference>(Reference.class, this, FhirPackage.CONTRACT_SUBJECT__REFERENCE); |
| } |
| return reference; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept getRole() { |
| return role; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetRole(CodeableConcept newRole, NotificationChain msgs) { |
| CodeableConcept oldRole = role; |
| role = newRole; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.CONTRACT_SUBJECT__ROLE, oldRole, newRole); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRole(CodeableConcept newRole) { |
| if (newRole != role) { |
| NotificationChain msgs = null; |
| if (role != null) |
| msgs = ((InternalEObject)role).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.CONTRACT_SUBJECT__ROLE, null, msgs); |
| if (newRole != null) |
| msgs = ((InternalEObject)newRole).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.CONTRACT_SUBJECT__ROLE, null, msgs); |
| msgs = basicSetRole(newRole, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.CONTRACT_SUBJECT__ROLE, newRole, newRole)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirPackage.CONTRACT_SUBJECT__REFERENCE: |
| return ((InternalEList<?>)getReference()).basicRemove(otherEnd, msgs); |
| case FhirPackage.CONTRACT_SUBJECT__ROLE: |
| return basicSetRole(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 FhirPackage.CONTRACT_SUBJECT__REFERENCE: |
| return getReference(); |
| case FhirPackage.CONTRACT_SUBJECT__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_SUBJECT__REFERENCE: |
| getReference().clear(); |
| getReference().addAll((Collection<? extends Reference>)newValue); |
| return; |
| case FhirPackage.CONTRACT_SUBJECT__ROLE: |
| setRole((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_SUBJECT__REFERENCE: |
| getReference().clear(); |
| return; |
| case FhirPackage.CONTRACT_SUBJECT__ROLE: |
| setRole((CodeableConcept)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirPackage.CONTRACT_SUBJECT__REFERENCE: |
| return reference != null && !reference.isEmpty(); |
| case FhirPackage.CONTRACT_SUBJECT__ROLE: |
| return role != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //ContractSubjectImpl |