| /** |
| */ |
| 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.DateTime; |
| import org.hl7.fhir.FhirPackage; |
| import org.hl7.fhir.Timing; |
| import org.hl7.fhir.TimingRepeat; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Timing</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.hl7.fhir.impl.TimingImpl#getEvent <em>Event</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.TimingImpl#getRepeat <em>Repeat</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.TimingImpl#getCode <em>Code</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class TimingImpl extends ElementImpl implements Timing { |
| /** |
| * The cached value of the '{@link #getEvent() <em>Event</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEvent() |
| * @generated |
| * @ordered |
| */ |
| protected EList<DateTime> event; |
| |
| /** |
| * The cached value of the '{@link #getRepeat() <em>Repeat</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRepeat() |
| * @generated |
| * @ordered |
| */ |
| protected TimingRepeat repeat; |
| |
| /** |
| * The cached value of the '{@link #getCode() <em>Code</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCode() |
| * @generated |
| * @ordered |
| */ |
| protected CodeableConcept code; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected TimingImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirPackage.eINSTANCE.getTiming(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<DateTime> getEvent() { |
| if (event == null) { |
| event = new EObjectContainmentEList<DateTime>(DateTime.class, this, FhirPackage.TIMING__EVENT); |
| } |
| return event; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TimingRepeat getRepeat() { |
| return repeat; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetRepeat(TimingRepeat newRepeat, NotificationChain msgs) { |
| TimingRepeat oldRepeat = repeat; |
| repeat = newRepeat; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.TIMING__REPEAT, oldRepeat, newRepeat); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRepeat(TimingRepeat newRepeat) { |
| if (newRepeat != repeat) { |
| NotificationChain msgs = null; |
| if (repeat != null) |
| msgs = ((InternalEObject)repeat).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.TIMING__REPEAT, null, msgs); |
| if (newRepeat != null) |
| msgs = ((InternalEObject)newRepeat).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.TIMING__REPEAT, null, msgs); |
| msgs = basicSetRepeat(newRepeat, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.TIMING__REPEAT, newRepeat, newRepeat)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept getCode() { |
| return code; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetCode(CodeableConcept newCode, NotificationChain msgs) { |
| CodeableConcept oldCode = code; |
| code = newCode; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.TIMING__CODE, oldCode, newCode); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCode(CodeableConcept newCode) { |
| if (newCode != code) { |
| NotificationChain msgs = null; |
| if (code != null) |
| msgs = ((InternalEObject)code).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.TIMING__CODE, null, msgs); |
| if (newCode != null) |
| msgs = ((InternalEObject)newCode).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.TIMING__CODE, null, msgs); |
| msgs = basicSetCode(newCode, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.TIMING__CODE, newCode, newCode)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirPackage.TIMING__EVENT: |
| return ((InternalEList<?>)getEvent()).basicRemove(otherEnd, msgs); |
| case FhirPackage.TIMING__REPEAT: |
| return basicSetRepeat(null, msgs); |
| case FhirPackage.TIMING__CODE: |
| return basicSetCode(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.TIMING__EVENT: |
| return getEvent(); |
| case FhirPackage.TIMING__REPEAT: |
| return getRepeat(); |
| case FhirPackage.TIMING__CODE: |
| return getCode(); |
| } |
| 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.TIMING__EVENT: |
| getEvent().clear(); |
| getEvent().addAll((Collection<? extends DateTime>)newValue); |
| return; |
| case FhirPackage.TIMING__REPEAT: |
| setRepeat((TimingRepeat)newValue); |
| return; |
| case FhirPackage.TIMING__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 FhirPackage.TIMING__EVENT: |
| getEvent().clear(); |
| return; |
| case FhirPackage.TIMING__REPEAT: |
| setRepeat((TimingRepeat)null); |
| return; |
| case FhirPackage.TIMING__CODE: |
| setCode((CodeableConcept)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirPackage.TIMING__EVENT: |
| return event != null && !event.isEmpty(); |
| case FhirPackage.TIMING__REPEAT: |
| return repeat != null; |
| case FhirPackage.TIMING__CODE: |
| return code != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //TimingImpl |