blob: 088e49c492a880d4d9d5b9a8baa6bd98caba062c [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.datatype.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.mdht.uml.fhir.core.datatype.DateTime;
import org.eclipse.mdht.uml.fhir.core.datatype.FhirDatatypePackage;
import org.eclipse.mdht.uml.fhir.core.datatype.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.eclipse.mdht.uml.fhir.core.datatype.impl.PeriodImpl#getStart <em>Start</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.datatype.impl.PeriodImpl#getEnd <em>End</em>}</li>
* </ul>
*
* @generated
*/
public class PeriodImpl extends DataTypeImpl implements Period {
/**
* The cached value of the '{@link #getStart() <em>Start</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStart()
* @generated
* @ordered
*/
protected DateTime start;
/**
* The cached value of the '{@link #getEnd() <em>End</em>}' 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 FhirDatatypePackage.Literals.PERIOD;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DateTime getStart() {
if (start != null && start.eIsProxy()) {
InternalEObject oldStart = (InternalEObject)start;
start = (DateTime)eResolveProxy(oldStart);
if (start != oldStart) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirDatatypePackage.PERIOD__START, oldStart, start));
}
}
return start;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DateTime basicGetStart() {
return start;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStart(DateTime newStart) {
DateTime oldStart = start;
start = newStart;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.PERIOD__START, oldStart, start));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DateTime getEnd() {
if (end != null && end.eIsProxy()) {
InternalEObject oldEnd = (InternalEObject)end;
end = (DateTime)eResolveProxy(oldEnd);
if (end != oldEnd) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirDatatypePackage.PERIOD__END, oldEnd, end));
}
}
return end;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DateTime basicGetEnd() {
return end;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEnd(DateTime newEnd) {
DateTime oldEnd = end;
end = newEnd;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirDatatypePackage.PERIOD__END, oldEnd, end));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case FhirDatatypePackage.PERIOD__START:
if (resolve) return getStart();
return basicGetStart();
case FhirDatatypePackage.PERIOD__END:
if (resolve) return getEnd();
return basicGetEnd();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case FhirDatatypePackage.PERIOD__START:
setStart((DateTime)newValue);
return;
case FhirDatatypePackage.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 FhirDatatypePackage.PERIOD__START:
setStart((DateTime)null);
return;
case FhirDatatypePackage.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 FhirDatatypePackage.PERIOD__START:
return start != null;
case FhirDatatypePackage.PERIOD__END:
return end != null;
}
return super.eIsSet(featureID);
}
} //PeriodImpl