001package org.hl7.fhir.convertors.conv10_50.datatypes10_50.complextypes10_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_50;
004import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Code10_50;
005import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Decimal10_50;
006import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.String10_50;
007import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri10_50;
008import org.hl7.fhir.exceptions.FHIRException;
009
010public class Count10_50 {
011  public static org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.dstu2.model.Count src) throws FHIRException {
012    if (src == null || src.isEmpty()) return null;
013    org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count();
014    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
015    if (src.hasValueElement()) tgt.setValueElement(Decimal10_50.convertDecimal(src.getValueElement()));
016    if (src.hasComparator())
017      tgt.setComparatorElement(Quantity10_50.convertQuantityComparator(src.getComparatorElement()));
018    if (src.hasUnitElement()) tgt.setUnitElement(String10_50.convertString(src.getUnitElement()));
019    if (src.hasSystemElement()) tgt.setSystemElement(Uri10_50.convertUri(src.getSystemElement()));
020    if (src.hasCodeElement()) tgt.setCodeElement(Code10_50.convertCode(src.getCodeElement()));
021    return tgt;
022  }
023
024  public static org.hl7.fhir.dstu2.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException {
025    if (src == null || src.isEmpty()) return null;
026    org.hl7.fhir.dstu2.model.Count tgt = new org.hl7.fhir.dstu2.model.Count();
027    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
028    if (src.hasValueElement()) tgt.setValueElement(Decimal10_50.convertDecimal(src.getValueElement()));
029    if (src.hasComparator())
030      tgt.setComparatorElement(Quantity10_50.convertQuantityComparator(src.getComparatorElement()));
031    if (src.hasUnitElement()) tgt.setUnitElement(String10_50.convertString(src.getUnitElement()));
032    if (src.hasSystemElement()) tgt.setSystemElement(Uri10_50.convertUri(src.getSystemElement()));
033    if (src.hasCodeElement()) tgt.setCodeElement(Code10_50.convertCode(src.getCodeElement()));
034    return tgt;
035  }
036}