blob: 3d665bb6123bcf08170c518ded847192bac509d3 [file] [log] [blame]
/**
*/
package org.hl7.fhir.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.hl7.fhir.DateTime;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.Period;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Period</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.PeriodImpl#getStart <em>Start</em>}</li>
* <li>{@link org.hl7.fhir.impl.PeriodImpl#getEnd <em>End</em>}</li>
* </ul>
*
* @generated
*/
public class PeriodImpl extends ElementImpl implements Period {
/**
* The cached value of the '{@link #getStart() <em>Start</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStart()
* @generated
* @ordered
*/
protected DateTime start;
/**
* The cached value of the '{@link #getEnd() <em>End</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEnd()
* @generated
* @ordered
*/
protected DateTime end;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PeriodImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getPeriod();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DateTime getStart() {
return start;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetStart(DateTime newStart, NotificationChain msgs) {
DateTime oldStart = start;
start = newStart;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PERIOD__START, oldStart, newStart);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStart(DateTime newStart) {
if (newStart != start) {
NotificationChain msgs = null;
if (start != null)
msgs = ((InternalEObject)start).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERIOD__START, null, msgs);
if (newStart != null)
msgs = ((InternalEObject)newStart).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERIOD__START, null, msgs);
msgs = basicSetStart(newStart, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PERIOD__START, newStart, newStart));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DateTime getEnd() {
return end;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetEnd(DateTime newEnd, NotificationChain msgs) {
DateTime oldEnd = end;
end = newEnd;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PERIOD__END, oldEnd, newEnd);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEnd(DateTime newEnd) {
if (newEnd != end) {
NotificationChain msgs = null;
if (end != null)
msgs = ((InternalEObject)end).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERIOD__END, null, msgs);
if (newEnd != null)
msgs = ((InternalEObject)newEnd).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERIOD__END, null, msgs);
msgs = basicSetEnd(newEnd, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PERIOD__END, newEnd, newEnd));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.PERIOD__START:
return basicSetStart(null, msgs);
case FhirPackage.PERIOD__END:
return basicSetEnd(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.PERIOD__START:
return getStart();
case FhirPackage.PERIOD__END:
return getEnd();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case FhirPackage.PERIOD__START:
setStart((DateTime)newValue);
return;
case FhirPackage.PERIOD__END:
setEnd((DateTime)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.PERIOD__START:
setStart((DateTime)null);
return;
case FhirPackage.PERIOD__END:
setEnd((DateTime)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.PERIOD__START:
return start != null;
case FhirPackage.PERIOD__END:
return end != null;
}
return super.eIsSet(featureID);
}
} //PeriodImpl