001package org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext40_50;
004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Decimal40_50;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.PositiveInt40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
007import org.hl7.fhir.exceptions.FHIRException;
008
009public class SampledData40_50 {
010  public static org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException {
011    if (src == null) return null;
012    org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData();
013    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
014    if (src.hasOrigin()) tgt.setOrigin(SimpleQuantity40_50.convertSimpleQuantity(src.getOrigin()));
015    if (src.hasPeriod()) tgt.setPeriodElement(Decimal40_50.convertDecimal(src.getPeriodElement()));
016    if (src.hasFactor()) tgt.setFactorElement(Decimal40_50.convertDecimal(src.getFactorElement()));
017    if (src.hasLowerLimit()) tgt.setLowerLimitElement(Decimal40_50.convertDecimal(src.getLowerLimitElement()));
018    if (src.hasUpperLimit()) tgt.setUpperLimitElement(Decimal40_50.convertDecimal(src.getUpperLimitElement()));
019    if (src.hasDimensions()) tgt.setDimensionsElement(PositiveInt40_50.convertPositiveInt(src.getDimensionsElement()));
020    if (src.hasData()) tgt.setDataElement(String40_50.convertString(src.getDataElement()));
021    return tgt;
022  }
023
024  public static org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException {
025    if (src == null) return null;
026    org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData();
027    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
028    if (src.hasOrigin()) tgt.setOrigin(SimpleQuantity40_50.convertSimpleQuantity(src.getOrigin()));
029    if (src.hasPeriod()) tgt.setPeriodElement(Decimal40_50.convertDecimal(src.getPeriodElement()));
030    if (src.hasFactor()) tgt.setFactorElement(Decimal40_50.convertDecimal(src.getFactorElement()));
031    if (src.hasLowerLimit()) tgt.setLowerLimitElement(Decimal40_50.convertDecimal(src.getLowerLimitElement()));
032    if (src.hasUpperLimit()) tgt.setUpperLimitElement(Decimal40_50.convertDecimal(src.getUpperLimitElement()));
033    if (src.hasDimensions()) tgt.setDimensionsElement(PositiveInt40_50.convertPositiveInt(src.getDimensionsElement()));
034    if (src.hasData()) tgt.setDataElement(String40_50.convertString(src.getDataElement()));
035    return tgt;
036  }
037}