001package org.hl7.fhir.convertors.conv30_40.resources30_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_40;
004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Reference30_40;
005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40;
006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Identifier30_40;
007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Quantity30_40;
008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Decimal30_40;
009import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Integer30_40;
010import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40;
011import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Uri30_40;
012import org.hl7.fhir.exceptions.FHIRException;
013
014public class Sequence30_40 {
015
016  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Sequence.QualityType> convertQualityType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MolecularSequence.QualityType> src) throws FHIRException {
017    if (src == null || src.isEmpty())
018      return null;
019    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Sequence.QualityType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Sequence.QualityTypeEnumFactory());
020    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
021    switch (src.getValue()) {
022      case INDEL:
023        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.QualityType.INDEL);
024        break;
025      case SNP:
026        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.QualityType.SNP);
027        break;
028      case UNKNOWN:
029        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.QualityType.UNKNOWN);
030        break;
031      default:
032        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.QualityType.NULL);
033        break;
034    }
035    return tgt;
036  }
037
038  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MolecularSequence.QualityType> convertQualityType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Sequence.QualityType> src) throws FHIRException {
039    if (src == null || src.isEmpty())
040      return null;
041    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MolecularSequence.QualityType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.MolecularSequence.QualityTypeEnumFactory());
042    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
043    switch (src.getValue()) {
044      case INDEL:
045        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.QualityType.INDEL);
046        break;
047      case SNP:
048        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.QualityType.SNP);
049        break;
050      case UNKNOWN:
051        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.QualityType.UNKNOWN);
052        break;
053      default:
054        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.QualityType.NULL);
055        break;
056    }
057    return tgt;
058  }
059
060  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Sequence.RepositoryType> convertRepositoryType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MolecularSequence.RepositoryType> src) throws FHIRException {
061    if (src == null || src.isEmpty())
062      return null;
063    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Sequence.RepositoryType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Sequence.RepositoryTypeEnumFactory());
064    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
065    switch (src.getValue()) {
066      case DIRECTLINK:
067        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.RepositoryType.DIRECTLINK);
068        break;
069      case OPENAPI:
070        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OPENAPI);
071        break;
072      case LOGIN:
073        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.RepositoryType.LOGIN);
074        break;
075      case OAUTH:
076        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OAUTH);
077        break;
078      case OTHER:
079        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OTHER);
080        break;
081      default:
082        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.RepositoryType.NULL);
083        break;
084    }
085    return tgt;
086  }
087
088  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MolecularSequence.RepositoryType> convertRepositoryType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Sequence.RepositoryType> src) throws FHIRException {
089    if (src == null || src.isEmpty())
090      return null;
091    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MolecularSequence.RepositoryType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.MolecularSequence.RepositoryTypeEnumFactory());
092    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
093    switch (src.getValue()) {
094      case DIRECTLINK:
095        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.DIRECTLINK);
096        break;
097      case OPENAPI:
098        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OPENAPI);
099        break;
100      case LOGIN:
101        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.LOGIN);
102        break;
103      case OAUTH:
104        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OAUTH);
105        break;
106      case OTHER:
107        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OTHER);
108        break;
109      default:
110        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.NULL);
111        break;
112    }
113    return tgt;
114  }
115
116  public static org.hl7.fhir.dstu3.model.Sequence convertSequence(org.hl7.fhir.r4.model.MolecularSequence src) throws FHIRException {
117    if (src == null)
118      return null;
119    org.hl7.fhir.dstu3.model.Sequence tgt = new org.hl7.fhir.dstu3.model.Sequence();
120    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
121    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
122      tgt.addIdentifier(Identifier30_40.convertIdentifier(t));
123    if (src.hasType())
124      tgt.setTypeElement(convertSequenceType(src.getTypeElement()));
125    if (src.hasCoordinateSystem())
126      tgt.setCoordinateSystemElement(Integer30_40.convertInteger(src.getCoordinateSystemElement()));
127    if (src.hasPatient())
128      tgt.setPatient(Reference30_40.convertReference(src.getPatient()));
129    if (src.hasSpecimen())
130      tgt.setSpecimen(Reference30_40.convertReference(src.getSpecimen()));
131    if (src.hasDevice())
132      tgt.setDevice(Reference30_40.convertReference(src.getDevice()));
133    if (src.hasPerformer())
134      tgt.setPerformer(Reference30_40.convertReference(src.getPerformer()));
135    if (src.hasQuantity())
136      tgt.setQuantity(Quantity30_40.convertQuantity(src.getQuantity()));
137    if (src.hasReferenceSeq())
138      tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq()));
139    for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent t : src.getVariant())
140      tgt.addVariant(convertSequenceVariantComponent(t));
141    if (src.hasObservedSeq())
142      tgt.setObservedSeqElement(String30_40.convertString(src.getObservedSeqElement()));
143    for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent t : src.getQuality())
144      tgt.addQuality(convertSequenceQualityComponent(t));
145    if (src.hasReadCoverage())
146      tgt.setReadCoverageElement(Integer30_40.convertInteger(src.getReadCoverageElement()));
147    for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent t : src.getRepository())
148      tgt.addRepository(convertSequenceRepositoryComponent(t));
149    for (org.hl7.fhir.r4.model.Reference t : src.getPointer()) tgt.addPointer(Reference30_40.convertReference(t));
150    return tgt;
151  }
152
153  public static org.hl7.fhir.r4.model.MolecularSequence convertSequence(org.hl7.fhir.dstu3.model.Sequence src) throws FHIRException {
154    if (src == null)
155      return null;
156    org.hl7.fhir.r4.model.MolecularSequence tgt = new org.hl7.fhir.r4.model.MolecularSequence();
157    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
158    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
159      tgt.addIdentifier(Identifier30_40.convertIdentifier(t));
160    if (src.hasType())
161      tgt.setTypeElement(convertSequenceType(src.getTypeElement()));
162    if (src.hasCoordinateSystem())
163      tgt.setCoordinateSystemElement(Integer30_40.convertInteger(src.getCoordinateSystemElement()));
164    if (src.hasPatient())
165      tgt.setPatient(Reference30_40.convertReference(src.getPatient()));
166    if (src.hasSpecimen())
167      tgt.setSpecimen(Reference30_40.convertReference(src.getSpecimen()));
168    if (src.hasDevice())
169      tgt.setDevice(Reference30_40.convertReference(src.getDevice()));
170    if (src.hasPerformer())
171      tgt.setPerformer(Reference30_40.convertReference(src.getPerformer()));
172    if (src.hasQuantity())
173      tgt.setQuantity(Quantity30_40.convertQuantity(src.getQuantity()));
174    if (src.hasReferenceSeq())
175      tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq()));
176    for (org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent t : src.getVariant())
177      tgt.addVariant(convertSequenceVariantComponent(t));
178    if (src.hasObservedSeq())
179      tgt.setObservedSeqElement(String30_40.convertString(src.getObservedSeqElement()));
180    for (org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent t : src.getQuality())
181      tgt.addQuality(convertSequenceQualityComponent(t));
182    if (src.hasReadCoverage())
183      tgt.setReadCoverageElement(Integer30_40.convertInteger(src.getReadCoverageElement()));
184    for (org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent t : src.getRepository())
185      tgt.addRepository(convertSequenceRepositoryComponent(t));
186    for (org.hl7.fhir.dstu3.model.Reference t : src.getPointer()) tgt.addPointer(Reference30_40.convertReference(t));
187    return tgt;
188  }
189
190  public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent src) throws FHIRException {
191    if (src == null)
192      return null;
193    org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent();
194    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
195    if (src.hasType())
196      tgt.setTypeElement(convertQualityType(src.getTypeElement()));
197    if (src.hasStandardSequence())
198      tgt.setStandardSequence(CodeableConcept30_40.convertCodeableConcept(src.getStandardSequence()));
199    if (src.hasStart())
200      tgt.setStartElement(Integer30_40.convertInteger(src.getStartElement()));
201    if (src.hasEnd())
202      tgt.setEndElement(Integer30_40.convertInteger(src.getEndElement()));
203    if (src.hasScore())
204      tgt.setScore(Quantity30_40.convertQuantity(src.getScore()));
205    if (src.hasMethod())
206      tgt.setMethod(CodeableConcept30_40.convertCodeableConcept(src.getMethod()));
207    if (src.hasTruthTP())
208      tgt.setTruthTPElement(Decimal30_40.convertDecimal(src.getTruthTPElement()));
209    if (src.hasQueryTP())
210      tgt.setQueryTPElement(Decimal30_40.convertDecimal(src.getQueryTPElement()));
211    if (src.hasTruthFN())
212      tgt.setTruthFNElement(Decimal30_40.convertDecimal(src.getTruthFNElement()));
213    if (src.hasQueryFP())
214      tgt.setQueryFPElement(Decimal30_40.convertDecimal(src.getQueryFPElement()));
215    if (src.hasGtFP())
216      tgt.setGtFPElement(Decimal30_40.convertDecimal(src.getGtFPElement()));
217    if (src.hasPrecision())
218      tgt.setPrecisionElement(Decimal30_40.convertDecimal(src.getPrecisionElement()));
219    if (src.hasRecall())
220      tgt.setRecallElement(Decimal30_40.convertDecimal(src.getRecallElement()));
221    if (src.hasFScore())
222      tgt.setFScoreElement(Decimal30_40.convertDecimal(src.getFScoreElement()));
223    return tgt;
224  }
225
226  public static org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent src) throws FHIRException {
227    if (src == null)
228      return null;
229    org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent();
230    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
231    if (src.hasType())
232      tgt.setTypeElement(convertQualityType(src.getTypeElement()));
233    if (src.hasStandardSequence())
234      tgt.setStandardSequence(CodeableConcept30_40.convertCodeableConcept(src.getStandardSequence()));
235    if (src.hasStart())
236      tgt.setStartElement(Integer30_40.convertInteger(src.getStartElement()));
237    if (src.hasEnd())
238      tgt.setEndElement(Integer30_40.convertInteger(src.getEndElement()));
239    if (src.hasScore())
240      tgt.setScore(Quantity30_40.convertQuantity(src.getScore()));
241    if (src.hasMethod())
242      tgt.setMethod(CodeableConcept30_40.convertCodeableConcept(src.getMethod()));
243    if (src.hasTruthTP())
244      tgt.setTruthTPElement(Decimal30_40.convertDecimal(src.getTruthTPElement()));
245    if (src.hasQueryTP())
246      tgt.setQueryTPElement(Decimal30_40.convertDecimal(src.getQueryTPElement()));
247    if (src.hasTruthFN())
248      tgt.setTruthFNElement(Decimal30_40.convertDecimal(src.getTruthFNElement()));
249    if (src.hasQueryFP())
250      tgt.setQueryFPElement(Decimal30_40.convertDecimal(src.getQueryFPElement()));
251    if (src.hasGtFP())
252      tgt.setGtFPElement(Decimal30_40.convertDecimal(src.getGtFPElement()));
253    if (src.hasPrecision())
254      tgt.setPrecisionElement(Decimal30_40.convertDecimal(src.getPrecisionElement()));
255    if (src.hasRecall())
256      tgt.setRecallElement(Decimal30_40.convertDecimal(src.getRecallElement()));
257    if (src.hasFScore())
258      tgt.setFScoreElement(Decimal30_40.convertDecimal(src.getFScoreElement()));
259    return tgt;
260  }
261
262  public static org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent src) throws FHIRException {
263    if (src == null)
264      return null;
265    org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent();
266    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
267    if (src.hasChromosome())
268      tgt.setChromosome(CodeableConcept30_40.convertCodeableConcept(src.getChromosome()));
269    if (src.hasGenomeBuild())
270      tgt.setGenomeBuildElement(String30_40.convertString(src.getGenomeBuildElement()));
271    if (src.hasReferenceSeqId())
272      tgt.setReferenceSeqId(CodeableConcept30_40.convertCodeableConcept(src.getReferenceSeqId()));
273    if (src.hasReferenceSeqPointer())
274      tgt.setReferenceSeqPointer(Reference30_40.convertReference(src.getReferenceSeqPointer()));
275    if (src.hasReferenceSeqString())
276      tgt.setReferenceSeqStringElement(String30_40.convertString(src.getReferenceSeqStringElement()));
277    if (src.hasWindowStart())
278      tgt.setWindowStartElement(Integer30_40.convertInteger(src.getWindowStartElement()));
279    if (src.hasWindowEnd())
280      tgt.setWindowEndElement(Integer30_40.convertInteger(src.getWindowEndElement()));
281    return tgt;
282  }
283
284  public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent src) throws FHIRException {
285    if (src == null)
286      return null;
287    org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent();
288    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
289    if (src.hasChromosome())
290      tgt.setChromosome(CodeableConcept30_40.convertCodeableConcept(src.getChromosome()));
291    if (src.hasGenomeBuild())
292      tgt.setGenomeBuildElement(String30_40.convertString(src.getGenomeBuildElement()));
293    if (src.hasReferenceSeqId())
294      tgt.setReferenceSeqId(CodeableConcept30_40.convertCodeableConcept(src.getReferenceSeqId()));
295    if (src.hasReferenceSeqPointer())
296      tgt.setReferenceSeqPointer(Reference30_40.convertReference(src.getReferenceSeqPointer()));
297    if (src.hasReferenceSeqString())
298      tgt.setReferenceSeqStringElement(String30_40.convertString(src.getReferenceSeqStringElement()));
299    if (src.hasWindowStart())
300      tgt.setWindowStartElement(Integer30_40.convertInteger(src.getWindowStartElement()));
301    if (src.hasWindowEnd())
302      tgt.setWindowEndElement(Integer30_40.convertInteger(src.getWindowEndElement()));
303    return tgt;
304  }
305
306  public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent src) throws FHIRException {
307    if (src == null)
308      return null;
309    org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent();
310    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
311    if (src.hasType())
312      tgt.setTypeElement(convertRepositoryType(src.getTypeElement()));
313    if (src.hasUrl())
314      tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement()));
315    if (src.hasName())
316      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
317    if (src.hasDatasetId())
318      tgt.setDatasetIdElement(String30_40.convertString(src.getDatasetIdElement()));
319    if (src.hasVariantsetId())
320      tgt.setVariantsetIdElement(String30_40.convertString(src.getVariantsetIdElement()));
321    if (src.hasReadsetId())
322      tgt.setReadsetIdElement(String30_40.convertString(src.getReadsetIdElement()));
323    return tgt;
324  }
325
326  public static org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent src) throws FHIRException {
327    if (src == null)
328      return null;
329    org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent();
330    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
331    if (src.hasType())
332      tgt.setTypeElement(convertRepositoryType(src.getTypeElement()));
333    if (src.hasUrl())
334      tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement()));
335    if (src.hasName())
336      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
337    if (src.hasDatasetId())
338      tgt.setDatasetIdElement(String30_40.convertString(src.getDatasetIdElement()));
339    if (src.hasVariantsetId())
340      tgt.setVariantsetIdElement(String30_40.convertString(src.getVariantsetIdElement()));
341    if (src.hasReadsetId())
342      tgt.setReadsetIdElement(String30_40.convertString(src.getReadsetIdElement()));
343    return tgt;
344  }
345
346  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Sequence.SequenceType> convertSequenceType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MolecularSequence.SequenceType> src) throws FHIRException {
347    if (src == null || src.isEmpty())
348      return null;
349    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Sequence.SequenceType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Sequence.SequenceTypeEnumFactory());
350    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
351    switch (src.getValue()) {
352      case AA:
353        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.SequenceType.AA);
354        break;
355      case DNA:
356        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.SequenceType.DNA);
357        break;
358      case RNA:
359        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.SequenceType.RNA);
360        break;
361      default:
362        tgt.setValue(org.hl7.fhir.dstu3.model.Sequence.SequenceType.NULL);
363        break;
364    }
365    return tgt;
366  }
367
368  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MolecularSequence.SequenceType> convertSequenceType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Sequence.SequenceType> src) throws FHIRException {
369    if (src == null || src.isEmpty())
370      return null;
371    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MolecularSequence.SequenceType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.MolecularSequence.SequenceTypeEnumFactory());
372    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
373    switch (src.getValue()) {
374      case AA:
375        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.SequenceType.AA);
376        break;
377      case DNA:
378        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.SequenceType.DNA);
379        break;
380      case RNA:
381        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.SequenceType.RNA);
382        break;
383      default:
384        tgt.setValue(org.hl7.fhir.r4.model.MolecularSequence.SequenceType.NULL);
385        break;
386    }
387    return tgt;
388  }
389
390  public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent src) throws FHIRException {
391    if (src == null)
392      return null;
393    org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent();
394    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
395    if (src.hasStart())
396      tgt.setStartElement(Integer30_40.convertInteger(src.getStartElement()));
397    if (src.hasEnd())
398      tgt.setEndElement(Integer30_40.convertInteger(src.getEndElement()));
399    if (src.hasObservedAllele())
400      tgt.setObservedAlleleElement(String30_40.convertString(src.getObservedAlleleElement()));
401    if (src.hasReferenceAllele())
402      tgt.setReferenceAlleleElement(String30_40.convertString(src.getReferenceAlleleElement()));
403    if (src.hasCigar())
404      tgt.setCigarElement(String30_40.convertString(src.getCigarElement()));
405    if (src.hasVariantPointer())
406      tgt.setVariantPointer(Reference30_40.convertReference(src.getVariantPointer()));
407    return tgt;
408  }
409
410  public static org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent src) throws FHIRException {
411    if (src == null)
412      return null;
413    org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent();
414    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
415    if (src.hasStart())
416      tgt.setStartElement(Integer30_40.convertInteger(src.getStartElement()));
417    if (src.hasEnd())
418      tgt.setEndElement(Integer30_40.convertInteger(src.getEndElement()));
419    if (src.hasObservedAllele())
420      tgt.setObservedAlleleElement(String30_40.convertString(src.getObservedAlleleElement()));
421    if (src.hasReferenceAllele())
422      tgt.setReferenceAlleleElement(String30_40.convertString(src.getReferenceAlleleElement()));
423    if (src.hasCigar())
424      tgt.setCigarElement(String30_40.convertString(src.getCigarElement()));
425    if (src.hasVariantPointer())
426      tgt.setVariantPointer(Reference30_40.convertReference(src.getVariantPointer()));
427    return tgt;
428  }
429}