001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.r4.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046// added from java-adornments.txt:
047import org.hl7.fhir.r4.utils.StructureMapUtilities;
048
049// end addition
050/**
051 * A Map of relationships between 2 structures that can be used to transform data.
052 */
053@ResourceDef(name="StructureMap", profile="http://hl7.org/fhir/Profile/StructureMap")
054@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "copyright", "structure", "import", "group"})
055public class StructureMap extends MetadataResource {
056
057    public enum StructureMapModelMode {
058        /**
059         * This structure describes an instance passed to the mapping engine that is used a source of data
060         */
061        SOURCE, 
062        /**
063         * This structure describes an instance that the mapping engine may ask for that is used a source of data
064         */
065        QUERIED, 
066        /**
067         * This structure describes an instance passed to the mapping engine that is used a target of data
068         */
069        TARGET, 
070        /**
071         * This structure describes an instance that the mapping engine may ask to create that is used a target of data
072         */
073        PRODUCED, 
074        /**
075         * added to help the parsers with the generic types
076         */
077        NULL;
078        public static StructureMapModelMode fromCode(String codeString) throws FHIRException {
079            if (codeString == null || "".equals(codeString))
080                return null;
081        if ("source".equals(codeString))
082          return SOURCE;
083        if ("queried".equals(codeString))
084          return QUERIED;
085        if ("target".equals(codeString))
086          return TARGET;
087        if ("produced".equals(codeString))
088          return PRODUCED;
089        if (Configuration.isAcceptInvalidEnums())
090          return null;
091        else
092          throw new FHIRException("Unknown StructureMapModelMode code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case SOURCE: return "source";
097            case QUERIED: return "queried";
098            case TARGET: return "target";
099            case PRODUCED: return "produced";
100            default: return "?";
101          }
102        }
103        public String getSystem() {
104          switch (this) {
105            case SOURCE: return "http://hl7.org/fhir/map-model-mode";
106            case QUERIED: return "http://hl7.org/fhir/map-model-mode";
107            case TARGET: return "http://hl7.org/fhir/map-model-mode";
108            case PRODUCED: return "http://hl7.org/fhir/map-model-mode";
109            default: return "?";
110          }
111        }
112        public String getDefinition() {
113          switch (this) {
114            case SOURCE: return "This structure describes an instance passed to the mapping engine that is used a source of data";
115            case QUERIED: return "This structure describes an instance that the mapping engine may ask for that is used a source of data";
116            case TARGET: return "This structure describes an instance passed to the mapping engine that is used a target of data";
117            case PRODUCED: return "This structure describes an instance that the mapping engine may ask to create that is used a target of data";
118            default: return "?";
119          }
120        }
121        public String getDisplay() {
122          switch (this) {
123            case SOURCE: return "Source Structure Definition";
124            case QUERIED: return "Queried Structure Definition";
125            case TARGET: return "Target Structure Definition";
126            case PRODUCED: return "Produced Structure Definition";
127            default: return "?";
128          }
129        }
130    }
131
132  public static class StructureMapModelModeEnumFactory implements EnumFactory<StructureMapModelMode> {
133    public StructureMapModelMode fromCode(String codeString) throws IllegalArgumentException {
134      if (codeString == null || "".equals(codeString))
135            if (codeString == null || "".equals(codeString))
136                return null;
137        if ("source".equals(codeString))
138          return StructureMapModelMode.SOURCE;
139        if ("queried".equals(codeString))
140          return StructureMapModelMode.QUERIED;
141        if ("target".equals(codeString))
142          return StructureMapModelMode.TARGET;
143        if ("produced".equals(codeString))
144          return StructureMapModelMode.PRODUCED;
145        throw new IllegalArgumentException("Unknown StructureMapModelMode code '"+codeString+"'");
146        }
147        public Enumeration<StructureMapModelMode> fromType(Base code) throws FHIRException {
148          if (code == null)
149            return null;
150          if (code.isEmpty())
151            return new Enumeration<StructureMapModelMode>(this);
152          String codeString = ((PrimitiveType) code).asStringValue();
153          if (codeString == null || "".equals(codeString))
154            return null;
155        if ("source".equals(codeString))
156          return new Enumeration<StructureMapModelMode>(this, StructureMapModelMode.SOURCE);
157        if ("queried".equals(codeString))
158          return new Enumeration<StructureMapModelMode>(this, StructureMapModelMode.QUERIED);
159        if ("target".equals(codeString))
160          return new Enumeration<StructureMapModelMode>(this, StructureMapModelMode.TARGET);
161        if ("produced".equals(codeString))
162          return new Enumeration<StructureMapModelMode>(this, StructureMapModelMode.PRODUCED);
163        throw new FHIRException("Unknown StructureMapModelMode code '"+codeString+"'");
164        }
165    public String toCode(StructureMapModelMode code) {
166      if (code == StructureMapModelMode.SOURCE)
167        return "source";
168      if (code == StructureMapModelMode.QUERIED)
169        return "queried";
170      if (code == StructureMapModelMode.TARGET)
171        return "target";
172      if (code == StructureMapModelMode.PRODUCED)
173        return "produced";
174      return "?";
175      }
176    public String toSystem(StructureMapModelMode code) {
177      return code.getSystem();
178      }
179    }
180
181    public enum StructureMapGroupTypeMode {
182        /**
183         * This group is not a default group for the types
184         */
185        NONE, 
186        /**
187         * This group is a default mapping group for the specified types and for the primary source type
188         */
189        TYPES, 
190        /**
191         * This group is a default mapping group for the specified types
192         */
193        TYPEANDTYPES, 
194        /**
195         * added to help the parsers with the generic types
196         */
197        NULL;
198        public static StructureMapGroupTypeMode fromCode(String codeString) throws FHIRException {
199            if (codeString == null || "".equals(codeString))
200                return null;
201        if ("none".equals(codeString))
202          return NONE;
203        if ("types".equals(codeString))
204          return TYPES;
205        if ("type-and-types".equals(codeString))
206          return TYPEANDTYPES;
207        if (Configuration.isAcceptInvalidEnums())
208          return null;
209        else
210          throw new FHIRException("Unknown StructureMapGroupTypeMode code '"+codeString+"'");
211        }
212        public String toCode() {
213          switch (this) {
214            case NONE: return "none";
215            case TYPES: return "types";
216            case TYPEANDTYPES: return "type-and-types";
217            default: return "?";
218          }
219        }
220        public String getSystem() {
221          switch (this) {
222            case NONE: return "http://hl7.org/fhir/map-group-type-mode";
223            case TYPES: return "http://hl7.org/fhir/map-group-type-mode";
224            case TYPEANDTYPES: return "http://hl7.org/fhir/map-group-type-mode";
225            default: return "?";
226          }
227        }
228        public String getDefinition() {
229          switch (this) {
230            case NONE: return "This group is not a default group for the types";
231            case TYPES: return "This group is a default mapping group for the specified types and for the primary source type";
232            case TYPEANDTYPES: return "This group is a default mapping group for the specified types";
233            default: return "?";
234          }
235        }
236        public String getDisplay() {
237          switch (this) {
238            case NONE: return "Not a Default";
239            case TYPES: return "Default for Type Combination";
240            case TYPEANDTYPES: return "Default for type + combination";
241            default: return "?";
242          }
243        }
244    }
245
246  public static class StructureMapGroupTypeModeEnumFactory implements EnumFactory<StructureMapGroupTypeMode> {
247    public StructureMapGroupTypeMode fromCode(String codeString) throws IllegalArgumentException {
248      if (codeString == null || "".equals(codeString))
249            if (codeString == null || "".equals(codeString))
250                return null;
251        if ("none".equals(codeString))
252          return StructureMapGroupTypeMode.NONE;
253        if ("types".equals(codeString))
254          return StructureMapGroupTypeMode.TYPES;
255        if ("type-and-types".equals(codeString))
256          return StructureMapGroupTypeMode.TYPEANDTYPES;
257        throw new IllegalArgumentException("Unknown StructureMapGroupTypeMode code '"+codeString+"'");
258        }
259        public Enumeration<StructureMapGroupTypeMode> fromType(Base code) throws FHIRException {
260          if (code == null)
261            return null;
262          if (code.isEmpty())
263            return new Enumeration<StructureMapGroupTypeMode>(this);
264          String codeString = ((PrimitiveType) code).asStringValue();
265          if (codeString == null || "".equals(codeString))
266            return null;
267        if ("none".equals(codeString))
268          return new Enumeration<StructureMapGroupTypeMode>(this, StructureMapGroupTypeMode.NONE);
269        if ("types".equals(codeString))
270          return new Enumeration<StructureMapGroupTypeMode>(this, StructureMapGroupTypeMode.TYPES);
271        if ("type-and-types".equals(codeString))
272          return new Enumeration<StructureMapGroupTypeMode>(this, StructureMapGroupTypeMode.TYPEANDTYPES);
273        throw new FHIRException("Unknown StructureMapGroupTypeMode code '"+codeString+"'");
274        }
275    public String toCode(StructureMapGroupTypeMode code) {
276      if (code == StructureMapGroupTypeMode.NONE)
277        return "none";
278      if (code == StructureMapGroupTypeMode.TYPES)
279        return "types";
280      if (code == StructureMapGroupTypeMode.TYPEANDTYPES)
281        return "type-and-types";
282      return "?";
283      }
284    public String toSystem(StructureMapGroupTypeMode code) {
285      return code.getSystem();
286      }
287    }
288
289    public enum StructureMapInputMode {
290        /**
291         * Names an input instance used a source for mapping
292         */
293        SOURCE, 
294        /**
295         * Names an instance that is being populated
296         */
297        TARGET, 
298        /**
299         * added to help the parsers with the generic types
300         */
301        NULL;
302        public static StructureMapInputMode fromCode(String codeString) throws FHIRException {
303            if (codeString == null || "".equals(codeString))
304                return null;
305        if ("source".equals(codeString))
306          return SOURCE;
307        if ("target".equals(codeString))
308          return TARGET;
309        if (Configuration.isAcceptInvalidEnums())
310          return null;
311        else
312          throw new FHIRException("Unknown StructureMapInputMode code '"+codeString+"'");
313        }
314        public String toCode() {
315          switch (this) {
316            case SOURCE: return "source";
317            case TARGET: return "target";
318            default: return "?";
319          }
320        }
321        public String getSystem() {
322          switch (this) {
323            case SOURCE: return "http://hl7.org/fhir/map-input-mode";
324            case TARGET: return "http://hl7.org/fhir/map-input-mode";
325            default: return "?";
326          }
327        }
328        public String getDefinition() {
329          switch (this) {
330            case SOURCE: return "Names an input instance used a source for mapping";
331            case TARGET: return "Names an instance that is being populated";
332            default: return "?";
333          }
334        }
335        public String getDisplay() {
336          switch (this) {
337            case SOURCE: return "Source Instance";
338            case TARGET: return "Target Instance";
339            default: return "?";
340          }
341        }
342    }
343
344  public static class StructureMapInputModeEnumFactory implements EnumFactory<StructureMapInputMode> {
345    public StructureMapInputMode fromCode(String codeString) throws IllegalArgumentException {
346      if (codeString == null || "".equals(codeString))
347            if (codeString == null || "".equals(codeString))
348                return null;
349        if ("source".equals(codeString))
350          return StructureMapInputMode.SOURCE;
351        if ("target".equals(codeString))
352          return StructureMapInputMode.TARGET;
353        throw new IllegalArgumentException("Unknown StructureMapInputMode code '"+codeString+"'");
354        }
355        public Enumeration<StructureMapInputMode> fromType(Base code) throws FHIRException {
356          if (code == null)
357            return null;
358          if (code.isEmpty())
359            return new Enumeration<StructureMapInputMode>(this);
360          String codeString = ((PrimitiveType) code).asStringValue();
361          if (codeString == null || "".equals(codeString))
362            return null;
363        if ("source".equals(codeString))
364          return new Enumeration<StructureMapInputMode>(this, StructureMapInputMode.SOURCE);
365        if ("target".equals(codeString))
366          return new Enumeration<StructureMapInputMode>(this, StructureMapInputMode.TARGET);
367        throw new FHIRException("Unknown StructureMapInputMode code '"+codeString+"'");
368        }
369    public String toCode(StructureMapInputMode code) {
370      if (code == StructureMapInputMode.SOURCE)
371        return "source";
372      if (code == StructureMapInputMode.TARGET)
373        return "target";
374      return "?";
375      }
376    public String toSystem(StructureMapInputMode code) {
377      return code.getSystem();
378      }
379    }
380
381    public enum StructureMapSourceListMode {
382        /**
383         * Only process this rule for the first in the list
384         */
385        FIRST, 
386        /**
387         * Process this rule for all but the first
388         */
389        NOTFIRST, 
390        /**
391         * Only process this rule for the last in the list
392         */
393        LAST, 
394        /**
395         * Process this rule for all but the last
396         */
397        NOTLAST, 
398        /**
399         * Only process this rule is there is only item
400         */
401        ONLYONE, 
402        /**
403         * added to help the parsers with the generic types
404         */
405        NULL;
406        public static StructureMapSourceListMode fromCode(String codeString) throws FHIRException {
407            if (codeString == null || "".equals(codeString))
408                return null;
409        if ("first".equals(codeString))
410          return FIRST;
411        if ("not_first".equals(codeString))
412          return NOTFIRST;
413        if ("last".equals(codeString))
414          return LAST;
415        if ("not_last".equals(codeString))
416          return NOTLAST;
417        if ("only_one".equals(codeString))
418          return ONLYONE;
419        if (Configuration.isAcceptInvalidEnums())
420          return null;
421        else
422          throw new FHIRException("Unknown StructureMapSourceListMode code '"+codeString+"'");
423        }
424        public String toCode() {
425          switch (this) {
426            case FIRST: return "first";
427            case NOTFIRST: return "not_first";
428            case LAST: return "last";
429            case NOTLAST: return "not_last";
430            case ONLYONE: return "only_one";
431            default: return "?";
432          }
433        }
434        public String getSystem() {
435          switch (this) {
436            case FIRST: return "http://hl7.org/fhir/map-source-list-mode";
437            case NOTFIRST: return "http://hl7.org/fhir/map-source-list-mode";
438            case LAST: return "http://hl7.org/fhir/map-source-list-mode";
439            case NOTLAST: return "http://hl7.org/fhir/map-source-list-mode";
440            case ONLYONE: return "http://hl7.org/fhir/map-source-list-mode";
441            default: return "?";
442          }
443        }
444        public String getDefinition() {
445          switch (this) {
446            case FIRST: return "Only process this rule for the first in the list";
447            case NOTFIRST: return "Process this rule for all but the first";
448            case LAST: return "Only process this rule for the last in the list";
449            case NOTLAST: return "Process this rule for all but the last";
450            case ONLYONE: return "Only process this rule is there is only item";
451            default: return "?";
452          }
453        }
454        public String getDisplay() {
455          switch (this) {
456            case FIRST: return "First";
457            case NOTFIRST: return "All but the first";
458            case LAST: return "Last";
459            case NOTLAST: return "All but the last";
460            case ONLYONE: return "Enforce only one";
461            default: return "?";
462          }
463        }
464    }
465
466  public static class StructureMapSourceListModeEnumFactory implements EnumFactory<StructureMapSourceListMode> {
467    public StructureMapSourceListMode fromCode(String codeString) throws IllegalArgumentException {
468      if (codeString == null || "".equals(codeString))
469            if (codeString == null || "".equals(codeString))
470                return null;
471        if ("first".equals(codeString))
472          return StructureMapSourceListMode.FIRST;
473        if ("not_first".equals(codeString))
474          return StructureMapSourceListMode.NOTFIRST;
475        if ("last".equals(codeString))
476          return StructureMapSourceListMode.LAST;
477        if ("not_last".equals(codeString))
478          return StructureMapSourceListMode.NOTLAST;
479        if ("only_one".equals(codeString))
480          return StructureMapSourceListMode.ONLYONE;
481        throw new IllegalArgumentException("Unknown StructureMapSourceListMode code '"+codeString+"'");
482        }
483        public Enumeration<StructureMapSourceListMode> fromType(Base code) throws FHIRException {
484          if (code == null)
485            return null;
486          if (code.isEmpty())
487            return new Enumeration<StructureMapSourceListMode>(this);
488          String codeString = ((PrimitiveType) code).asStringValue();
489          if (codeString == null || "".equals(codeString))
490            return null;
491        if ("first".equals(codeString))
492          return new Enumeration<StructureMapSourceListMode>(this, StructureMapSourceListMode.FIRST);
493        if ("not_first".equals(codeString))
494          return new Enumeration<StructureMapSourceListMode>(this, StructureMapSourceListMode.NOTFIRST);
495        if ("last".equals(codeString))
496          return new Enumeration<StructureMapSourceListMode>(this, StructureMapSourceListMode.LAST);
497        if ("not_last".equals(codeString))
498          return new Enumeration<StructureMapSourceListMode>(this, StructureMapSourceListMode.NOTLAST);
499        if ("only_one".equals(codeString))
500          return new Enumeration<StructureMapSourceListMode>(this, StructureMapSourceListMode.ONLYONE);
501        throw new FHIRException("Unknown StructureMapSourceListMode code '"+codeString+"'");
502        }
503    public String toCode(StructureMapSourceListMode code) {
504      if (code == StructureMapSourceListMode.FIRST)
505        return "first";
506      if (code == StructureMapSourceListMode.NOTFIRST)
507        return "not_first";
508      if (code == StructureMapSourceListMode.LAST)
509        return "last";
510      if (code == StructureMapSourceListMode.NOTLAST)
511        return "not_last";
512      if (code == StructureMapSourceListMode.ONLYONE)
513        return "only_one";
514      return "?";
515      }
516    public String toSystem(StructureMapSourceListMode code) {
517      return code.getSystem();
518      }
519    }
520
521    public enum StructureMapContextType {
522        /**
523         * The context specifies a type
524         */
525        TYPE, 
526        /**
527         * The context specifies a variable
528         */
529        VARIABLE, 
530        /**
531         * added to help the parsers with the generic types
532         */
533        NULL;
534        public static StructureMapContextType fromCode(String codeString) throws FHIRException {
535            if (codeString == null || "".equals(codeString))
536                return null;
537        if ("type".equals(codeString))
538          return TYPE;
539        if ("variable".equals(codeString))
540          return VARIABLE;
541        if (Configuration.isAcceptInvalidEnums())
542          return null;
543        else
544          throw new FHIRException("Unknown StructureMapContextType code '"+codeString+"'");
545        }
546        public String toCode() {
547          switch (this) {
548            case TYPE: return "type";
549            case VARIABLE: return "variable";
550            default: return "?";
551          }
552        }
553        public String getSystem() {
554          switch (this) {
555            case TYPE: return "http://hl7.org/fhir/map-context-type";
556            case VARIABLE: return "http://hl7.org/fhir/map-context-type";
557            default: return "?";
558          }
559        }
560        public String getDefinition() {
561          switch (this) {
562            case TYPE: return "The context specifies a type";
563            case VARIABLE: return "The context specifies a variable";
564            default: return "?";
565          }
566        }
567        public String getDisplay() {
568          switch (this) {
569            case TYPE: return "Type";
570            case VARIABLE: return "Variable";
571            default: return "?";
572          }
573        }
574    }
575
576  public static class StructureMapContextTypeEnumFactory implements EnumFactory<StructureMapContextType> {
577    public StructureMapContextType fromCode(String codeString) throws IllegalArgumentException {
578      if (codeString == null || "".equals(codeString))
579            if (codeString == null || "".equals(codeString))
580                return null;
581        if ("type".equals(codeString))
582          return StructureMapContextType.TYPE;
583        if ("variable".equals(codeString))
584          return StructureMapContextType.VARIABLE;
585        throw new IllegalArgumentException("Unknown StructureMapContextType code '"+codeString+"'");
586        }
587        public Enumeration<StructureMapContextType> fromType(Base code) throws FHIRException {
588          if (code == null)
589            return null;
590          if (code.isEmpty())
591            return new Enumeration<StructureMapContextType>(this);
592          String codeString = ((PrimitiveType) code).asStringValue();
593          if (codeString == null || "".equals(codeString))
594            return null;
595        if ("type".equals(codeString))
596          return new Enumeration<StructureMapContextType>(this, StructureMapContextType.TYPE);
597        if ("variable".equals(codeString))
598          return new Enumeration<StructureMapContextType>(this, StructureMapContextType.VARIABLE);
599        throw new FHIRException("Unknown StructureMapContextType code '"+codeString+"'");
600        }
601    public String toCode(StructureMapContextType code) {
602      if (code == StructureMapContextType.TYPE)
603        return "type";
604      if (code == StructureMapContextType.VARIABLE)
605        return "variable";
606      return "?";
607      }
608    public String toSystem(StructureMapContextType code) {
609      return code.getSystem();
610      }
611    }
612
613    public enum StructureMapTargetListMode {
614        /**
615         * when the target list is being assembled, the items for this rule go first. If more than one rule defines a first item (for a given instance of mapping) then this is an error
616         */
617        FIRST, 
618        /**
619         * the target instance is shared with the target instances generated by another rule (up to the first common n items, then create new ones)
620         */
621        SHARE, 
622        /**
623         * when the target list is being assembled, the items for this rule go last. If more than one rule defines a last item (for a given instance of mapping) then this is an error
624         */
625        LAST, 
626        /**
627         * re-use the first item in the list, and keep adding content to it
628         */
629        COLLATE, 
630        /**
631         * added to help the parsers with the generic types
632         */
633        NULL;
634        public static StructureMapTargetListMode fromCode(String codeString) throws FHIRException {
635            if (codeString == null || "".equals(codeString))
636                return null;
637        if ("first".equals(codeString))
638          return FIRST;
639        if ("share".equals(codeString))
640          return SHARE;
641        if ("last".equals(codeString))
642          return LAST;
643        if ("collate".equals(codeString))
644          return COLLATE;
645        if (Configuration.isAcceptInvalidEnums())
646          return null;
647        else
648          throw new FHIRException("Unknown StructureMapTargetListMode code '"+codeString+"'");
649        }
650        public String toCode() {
651          switch (this) {
652            case FIRST: return "first";
653            case SHARE: return "share";
654            case LAST: return "last";
655            case COLLATE: return "collate";
656            default: return "?";
657          }
658        }
659        public String getSystem() {
660          switch (this) {
661            case FIRST: return "http://hl7.org/fhir/map-target-list-mode";
662            case SHARE: return "http://hl7.org/fhir/map-target-list-mode";
663            case LAST: return "http://hl7.org/fhir/map-target-list-mode";
664            case COLLATE: return "http://hl7.org/fhir/map-target-list-mode";
665            default: return "?";
666          }
667        }
668        public String getDefinition() {
669          switch (this) {
670            case FIRST: return "when the target list is being assembled, the items for this rule go first. If more than one rule defines a first item (for a given instance of mapping) then this is an error";
671            case SHARE: return "the target instance is shared with the target instances generated by another rule (up to the first common n items, then create new ones)";
672            case LAST: return "when the target list is being assembled, the items for this rule go last. If more than one rule defines a last item (for a given instance of mapping) then this is an error";
673            case COLLATE: return "re-use the first item in the list, and keep adding content to it";
674            default: return "?";
675          }
676        }
677        public String getDisplay() {
678          switch (this) {
679            case FIRST: return "First";
680            case SHARE: return "Share";
681            case LAST: return "Last";
682            case COLLATE: return "Collate";
683            default: return "?";
684          }
685        }
686    }
687
688  public static class StructureMapTargetListModeEnumFactory implements EnumFactory<StructureMapTargetListMode> {
689    public StructureMapTargetListMode fromCode(String codeString) throws IllegalArgumentException {
690      if (codeString == null || "".equals(codeString))
691            if (codeString == null || "".equals(codeString))
692                return null;
693        if ("first".equals(codeString))
694          return StructureMapTargetListMode.FIRST;
695        if ("share".equals(codeString))
696          return StructureMapTargetListMode.SHARE;
697        if ("last".equals(codeString))
698          return StructureMapTargetListMode.LAST;
699        if ("collate".equals(codeString))
700          return StructureMapTargetListMode.COLLATE;
701        throw new IllegalArgumentException("Unknown StructureMapTargetListMode code '"+codeString+"'");
702        }
703        public Enumeration<StructureMapTargetListMode> fromType(Base code) throws FHIRException {
704          if (code == null)
705            return null;
706          if (code.isEmpty())
707            return new Enumeration<StructureMapTargetListMode>(this);
708          String codeString = ((PrimitiveType) code).asStringValue();
709          if (codeString == null || "".equals(codeString))
710            return null;
711        if ("first".equals(codeString))
712          return new Enumeration<StructureMapTargetListMode>(this, StructureMapTargetListMode.FIRST);
713        if ("share".equals(codeString))
714          return new Enumeration<StructureMapTargetListMode>(this, StructureMapTargetListMode.SHARE);
715        if ("last".equals(codeString))
716          return new Enumeration<StructureMapTargetListMode>(this, StructureMapTargetListMode.LAST);
717        if ("collate".equals(codeString))
718          return new Enumeration<StructureMapTargetListMode>(this, StructureMapTargetListMode.COLLATE);
719        throw new FHIRException("Unknown StructureMapTargetListMode code '"+codeString+"'");
720        }
721    public String toCode(StructureMapTargetListMode code) {
722      if (code == StructureMapTargetListMode.FIRST)
723        return "first";
724      if (code == StructureMapTargetListMode.SHARE)
725        return "share";
726      if (code == StructureMapTargetListMode.LAST)
727        return "last";
728      if (code == StructureMapTargetListMode.COLLATE)
729        return "collate";
730      return "?";
731      }
732    public String toSystem(StructureMapTargetListMode code) {
733      return code.getSystem();
734      }
735    }
736
737    public enum StructureMapTransform {
738        /**
739         * create(type : string) - type is passed through to the application on the standard API, and must be known by it
740         */
741        CREATE, 
742        /**
743         * copy(source)
744         */
745        COPY, 
746        /**
747         * truncate(source, length) - source must be stringy type
748         */
749        TRUNCATE, 
750        /**
751         * escape(source, fmt1, fmt2) - change source from one kind of escaping to another (plain, java, xml, json). note that this is for when the string itself is escaped
752         */
753        ESCAPE, 
754        /**
755         * cast(source, type?) - case source from one type to another. target type can be left as implicit if there is one and only one target type known
756         */
757        CAST, 
758        /**
759         * append(source...) - source is element or string
760         */
761        APPEND, 
762        /**
763         * translate(source, uri_of_map) - use the translate operation
764         */
765        TRANSLATE, 
766        /**
767         * reference(source : object) - return a string that references the provided tree properly
768         */
769        REFERENCE, 
770        /**
771         * Perform a date operation. *Parameters to be documented*
772         */
773        DATEOP, 
774        /**
775         * Generate a random UUID (in lowercase). No Parameters
776         */
777        UUID, 
778        /**
779         * Return the appropriate string to put in a reference that refers to the resource provided as a parameter
780         */
781        POINTER, 
782        /**
783         * Execute the supplied FHIRPath expression and use the value returned by that
784         */
785        EVALUATE, 
786        /**
787         * Create a CodeableConcept. Parameters = (text) or (system. Code[, display])
788         */
789        CC, 
790        /**
791         * Create a Coding. Parameters = (system. Code[, display])
792         */
793        C, 
794        /**
795         * Create a quantity. Parameters = (text) or (value, unit, [system, code]) where text is the natural representation e.g. [comparator]value[space]unit
796         */
797        QTY, 
798        /**
799         * Create an identifier. Parameters = (system, value[, type]) where type is a code from the identifier type value set
800         */
801        ID, 
802        /**
803         * Create a contact details. Parameters = (value) or (system, value). If no system is provided, the system should be inferred from the content of the value
804         */
805        CP, 
806        /**
807         * added to help the parsers with the generic types
808         */
809        NULL;
810        public static StructureMapTransform fromCode(String codeString) throws FHIRException {
811            if (codeString == null || "".equals(codeString))
812                return null;
813        if ("create".equals(codeString))
814          return CREATE;
815        if ("copy".equals(codeString))
816          return COPY;
817        if ("truncate".equals(codeString))
818          return TRUNCATE;
819        if ("escape".equals(codeString))
820          return ESCAPE;
821        if ("cast".equals(codeString))
822          return CAST;
823        if ("append".equals(codeString))
824          return APPEND;
825        if ("translate".equals(codeString))
826          return TRANSLATE;
827        if ("reference".equals(codeString))
828          return REFERENCE;
829        if ("dateOp".equals(codeString))
830          return DATEOP;
831        if ("uuid".equals(codeString))
832          return UUID;
833        if ("pointer".equals(codeString))
834          return POINTER;
835        if ("evaluate".equals(codeString))
836          return EVALUATE;
837        if ("cc".equals(codeString))
838          return CC;
839        if ("c".equals(codeString))
840          return C;
841        if ("qty".equals(codeString))
842          return QTY;
843        if ("id".equals(codeString))
844          return ID;
845        if ("cp".equals(codeString))
846          return CP;
847        if (Configuration.isAcceptInvalidEnums())
848          return null;
849        else
850          throw new FHIRException("Unknown StructureMapTransform code '"+codeString+"'");
851        }
852        public String toCode() {
853          switch (this) {
854            case CREATE: return "create";
855            case COPY: return "copy";
856            case TRUNCATE: return "truncate";
857            case ESCAPE: return "escape";
858            case CAST: return "cast";
859            case APPEND: return "append";
860            case TRANSLATE: return "translate";
861            case REFERENCE: return "reference";
862            case DATEOP: return "dateOp";
863            case UUID: return "uuid";
864            case POINTER: return "pointer";
865            case EVALUATE: return "evaluate";
866            case CC: return "cc";
867            case C: return "c";
868            case QTY: return "qty";
869            case ID: return "id";
870            case CP: return "cp";
871            default: return "?";
872          }
873        }
874        public String getSystem() {
875          switch (this) {
876            case CREATE: return "http://hl7.org/fhir/map-transform";
877            case COPY: return "http://hl7.org/fhir/map-transform";
878            case TRUNCATE: return "http://hl7.org/fhir/map-transform";
879            case ESCAPE: return "http://hl7.org/fhir/map-transform";
880            case CAST: return "http://hl7.org/fhir/map-transform";
881            case APPEND: return "http://hl7.org/fhir/map-transform";
882            case TRANSLATE: return "http://hl7.org/fhir/map-transform";
883            case REFERENCE: return "http://hl7.org/fhir/map-transform";
884            case DATEOP: return "http://hl7.org/fhir/map-transform";
885            case UUID: return "http://hl7.org/fhir/map-transform";
886            case POINTER: return "http://hl7.org/fhir/map-transform";
887            case EVALUATE: return "http://hl7.org/fhir/map-transform";
888            case CC: return "http://hl7.org/fhir/map-transform";
889            case C: return "http://hl7.org/fhir/map-transform";
890            case QTY: return "http://hl7.org/fhir/map-transform";
891            case ID: return "http://hl7.org/fhir/map-transform";
892            case CP: return "http://hl7.org/fhir/map-transform";
893            default: return "?";
894          }
895        }
896        public String getDefinition() {
897          switch (this) {
898            case CREATE: return "create(type : string) - type is passed through to the application on the standard API, and must be known by it";
899            case COPY: return "copy(source)";
900            case TRUNCATE: return "truncate(source, length) - source must be stringy type";
901            case ESCAPE: return "escape(source, fmt1, fmt2) - change source from one kind of escaping to another (plain, java, xml, json). note that this is for when the string itself is escaped";
902            case CAST: return "cast(source, type?) - case source from one type to another. target type can be left as implicit if there is one and only one target type known";
903            case APPEND: return "append(source...) - source is element or string";
904            case TRANSLATE: return "translate(source, uri_of_map) - use the translate operation";
905            case REFERENCE: return "reference(source : object) - return a string that references the provided tree properly";
906            case DATEOP: return "Perform a date operation. *Parameters to be documented*";
907            case UUID: return "Generate a random UUID (in lowercase). No Parameters";
908            case POINTER: return "Return the appropriate string to put in a reference that refers to the resource provided as a parameter";
909            case EVALUATE: return "Execute the supplied FHIRPath expression and use the value returned by that";
910            case CC: return "Create a CodeableConcept. Parameters = (text) or (system. Code[, display])";
911            case C: return "Create a Coding. Parameters = (system. Code[, display])";
912            case QTY: return "Create a quantity. Parameters = (text) or (value, unit, [system, code]) where text is the natural representation e.g. [comparator]value[space]unit";
913            case ID: return "Create an identifier. Parameters = (system, value[, type]) where type is a code from the identifier type value set";
914            case CP: return "Create a contact details. Parameters = (value) or (system, value). If no system is provided, the system should be inferred from the content of the value";
915            default: return "?";
916          }
917        }
918        public String getDisplay() {
919          switch (this) {
920            case CREATE: return "create";
921            case COPY: return "copy";
922            case TRUNCATE: return "truncate";
923            case ESCAPE: return "escape";
924            case CAST: return "cast";
925            case APPEND: return "append";
926            case TRANSLATE: return "translate";
927            case REFERENCE: return "reference";
928            case DATEOP: return "dateOp";
929            case UUID: return "uuid";
930            case POINTER: return "pointer";
931            case EVALUATE: return "evaluate";
932            case CC: return "cc";
933            case C: return "c";
934            case QTY: return "qty";
935            case ID: return "id";
936            case CP: return "cp";
937            default: return "?";
938          }
939        }
940    }
941
942  public static class StructureMapTransformEnumFactory implements EnumFactory<StructureMapTransform> {
943    public StructureMapTransform fromCode(String codeString) throws IllegalArgumentException {
944      if (codeString == null || "".equals(codeString))
945            if (codeString == null || "".equals(codeString))
946                return null;
947        if ("create".equals(codeString))
948          return StructureMapTransform.CREATE;
949        if ("copy".equals(codeString))
950          return StructureMapTransform.COPY;
951        if ("truncate".equals(codeString))
952          return StructureMapTransform.TRUNCATE;
953        if ("escape".equals(codeString))
954          return StructureMapTransform.ESCAPE;
955        if ("cast".equals(codeString))
956          return StructureMapTransform.CAST;
957        if ("append".equals(codeString))
958          return StructureMapTransform.APPEND;
959        if ("translate".equals(codeString))
960          return StructureMapTransform.TRANSLATE;
961        if ("reference".equals(codeString))
962          return StructureMapTransform.REFERENCE;
963        if ("dateOp".equals(codeString))
964          return StructureMapTransform.DATEOP;
965        if ("uuid".equals(codeString))
966          return StructureMapTransform.UUID;
967        if ("pointer".equals(codeString))
968          return StructureMapTransform.POINTER;
969        if ("evaluate".equals(codeString))
970          return StructureMapTransform.EVALUATE;
971        if ("cc".equals(codeString))
972          return StructureMapTransform.CC;
973        if ("c".equals(codeString))
974          return StructureMapTransform.C;
975        if ("qty".equals(codeString))
976          return StructureMapTransform.QTY;
977        if ("id".equals(codeString))
978          return StructureMapTransform.ID;
979        if ("cp".equals(codeString))
980          return StructureMapTransform.CP;
981        throw new IllegalArgumentException("Unknown StructureMapTransform code '"+codeString+"'");
982        }
983        public Enumeration<StructureMapTransform> fromType(Base code) throws FHIRException {
984          if (code == null)
985            return null;
986          if (code.isEmpty())
987            return new Enumeration<StructureMapTransform>(this);
988          String codeString = ((PrimitiveType) code).asStringValue();
989          if (codeString == null || "".equals(codeString))
990            return null;
991        if ("create".equals(codeString))
992          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.CREATE);
993        if ("copy".equals(codeString))
994          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.COPY);
995        if ("truncate".equals(codeString))
996          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.TRUNCATE);
997        if ("escape".equals(codeString))
998          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.ESCAPE);
999        if ("cast".equals(codeString))
1000          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.CAST);
1001        if ("append".equals(codeString))
1002          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.APPEND);
1003        if ("translate".equals(codeString))
1004          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.TRANSLATE);
1005        if ("reference".equals(codeString))
1006          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.REFERENCE);
1007        if ("dateOp".equals(codeString))
1008          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.DATEOP);
1009        if ("uuid".equals(codeString))
1010          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.UUID);
1011        if ("pointer".equals(codeString))
1012          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.POINTER);
1013        if ("evaluate".equals(codeString))
1014          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.EVALUATE);
1015        if ("cc".equals(codeString))
1016          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.CC);
1017        if ("c".equals(codeString))
1018          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.C);
1019        if ("qty".equals(codeString))
1020          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.QTY);
1021        if ("id".equals(codeString))
1022          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.ID);
1023        if ("cp".equals(codeString))
1024          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.CP);
1025        throw new FHIRException("Unknown StructureMapTransform code '"+codeString+"'");
1026        }
1027    public String toCode(StructureMapTransform code) {
1028      if (code == StructureMapTransform.CREATE)
1029        return "create";
1030      if (code == StructureMapTransform.COPY)
1031        return "copy";
1032      if (code == StructureMapTransform.TRUNCATE)
1033        return "truncate";
1034      if (code == StructureMapTransform.ESCAPE)
1035        return "escape";
1036      if (code == StructureMapTransform.CAST)
1037        return "cast";
1038      if (code == StructureMapTransform.APPEND)
1039        return "append";
1040      if (code == StructureMapTransform.TRANSLATE)
1041        return "translate";
1042      if (code == StructureMapTransform.REFERENCE)
1043        return "reference";
1044      if (code == StructureMapTransform.DATEOP)
1045        return "dateOp";
1046      if (code == StructureMapTransform.UUID)
1047        return "uuid";
1048      if (code == StructureMapTransform.POINTER)
1049        return "pointer";
1050      if (code == StructureMapTransform.EVALUATE)
1051        return "evaluate";
1052      if (code == StructureMapTransform.CC)
1053        return "cc";
1054      if (code == StructureMapTransform.C)
1055        return "c";
1056      if (code == StructureMapTransform.QTY)
1057        return "qty";
1058      if (code == StructureMapTransform.ID)
1059        return "id";
1060      if (code == StructureMapTransform.CP)
1061        return "cp";
1062      return "?";
1063      }
1064    public String toSystem(StructureMapTransform code) {
1065      return code.getSystem();
1066      }
1067    }
1068
1069    @Block()
1070    public static class StructureMapStructureComponent extends BackboneElement implements IBaseBackboneElement {
1071        /**
1072         * The canonical URL that identifies the structure.
1073         */
1074        @Child(name = "url", type = {CanonicalType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1075        @Description(shortDefinition="Canonical URL for structure definition", formalDefinition="The canonical URL that identifies the structure." )
1076        protected CanonicalType url;
1077
1078        /**
1079         * How the referenced structure is used in this mapping.
1080         */
1081        @Child(name = "mode", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1082        @Description(shortDefinition="source | queried | target | produced", formalDefinition="How the referenced structure is used in this mapping." )
1083        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-model-mode")
1084        protected Enumeration<StructureMapModelMode> mode;
1085
1086        /**
1087         * The name used for this type in the map.
1088         */
1089        @Child(name = "alias", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1090        @Description(shortDefinition="Name for type in this map", formalDefinition="The name used for this type in the map." )
1091        protected StringType alias;
1092
1093        /**
1094         * Documentation that describes how the structure is used in the mapping.
1095         */
1096        @Child(name = "documentation", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1097        @Description(shortDefinition="Documentation on use of structure", formalDefinition="Documentation that describes how the structure is used in the mapping." )
1098        protected StringType documentation;
1099
1100        private static final long serialVersionUID = 364750586L;
1101
1102    /**
1103     * Constructor
1104     */
1105      public StructureMapStructureComponent() {
1106        super();
1107      }
1108
1109    /**
1110     * Constructor
1111     */
1112      public StructureMapStructureComponent(CanonicalType url, Enumeration<StructureMapModelMode> mode) {
1113        super();
1114        this.url = url;
1115        this.mode = mode;
1116      }
1117
1118        /**
1119         * @return {@link #url} (The canonical URL that identifies the structure.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1120         */
1121        public CanonicalType getUrlElement() { 
1122          if (this.url == null)
1123            if (Configuration.errorOnAutoCreate())
1124              throw new Error("Attempt to auto-create StructureMapStructureComponent.url");
1125            else if (Configuration.doAutoCreate())
1126              this.url = new CanonicalType(); // bb
1127          return this.url;
1128        }
1129
1130        public boolean hasUrlElement() { 
1131          return this.url != null && !this.url.isEmpty();
1132        }
1133
1134        public boolean hasUrl() { 
1135          return this.url != null && !this.url.isEmpty();
1136        }
1137
1138        /**
1139         * @param value {@link #url} (The canonical URL that identifies the structure.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1140         */
1141        public StructureMapStructureComponent setUrlElement(CanonicalType value) { 
1142          this.url = value;
1143          return this;
1144        }
1145
1146        /**
1147         * @return The canonical URL that identifies the structure.
1148         */
1149        public String getUrl() { 
1150          return this.url == null ? null : this.url.getValue();
1151        }
1152
1153        /**
1154         * @param value The canonical URL that identifies the structure.
1155         */
1156        public StructureMapStructureComponent setUrl(String value) { 
1157            if (this.url == null)
1158              this.url = new CanonicalType();
1159            this.url.setValue(value);
1160          return this;
1161        }
1162
1163        /**
1164         * @return {@link #mode} (How the referenced structure is used in this mapping.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
1165         */
1166        public Enumeration<StructureMapModelMode> getModeElement() { 
1167          if (this.mode == null)
1168            if (Configuration.errorOnAutoCreate())
1169              throw new Error("Attempt to auto-create StructureMapStructureComponent.mode");
1170            else if (Configuration.doAutoCreate())
1171              this.mode = new Enumeration<StructureMapModelMode>(new StructureMapModelModeEnumFactory()); // bb
1172          return this.mode;
1173        }
1174
1175        public boolean hasModeElement() { 
1176          return this.mode != null && !this.mode.isEmpty();
1177        }
1178
1179        public boolean hasMode() { 
1180          return this.mode != null && !this.mode.isEmpty();
1181        }
1182
1183        /**
1184         * @param value {@link #mode} (How the referenced structure is used in this mapping.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
1185         */
1186        public StructureMapStructureComponent setModeElement(Enumeration<StructureMapModelMode> value) { 
1187          this.mode = value;
1188          return this;
1189        }
1190
1191        /**
1192         * @return How the referenced structure is used in this mapping.
1193         */
1194        public StructureMapModelMode getMode() { 
1195          return this.mode == null ? null : this.mode.getValue();
1196        }
1197
1198        /**
1199         * @param value How the referenced structure is used in this mapping.
1200         */
1201        public StructureMapStructureComponent setMode(StructureMapModelMode value) { 
1202            if (this.mode == null)
1203              this.mode = new Enumeration<StructureMapModelMode>(new StructureMapModelModeEnumFactory());
1204            this.mode.setValue(value);
1205          return this;
1206        }
1207
1208        /**
1209         * @return {@link #alias} (The name used for this type in the map.). This is the underlying object with id, value and extensions. The accessor "getAlias" gives direct access to the value
1210         */
1211        public StringType getAliasElement() { 
1212          if (this.alias == null)
1213            if (Configuration.errorOnAutoCreate())
1214              throw new Error("Attempt to auto-create StructureMapStructureComponent.alias");
1215            else if (Configuration.doAutoCreate())
1216              this.alias = new StringType(); // bb
1217          return this.alias;
1218        }
1219
1220        public boolean hasAliasElement() { 
1221          return this.alias != null && !this.alias.isEmpty();
1222        }
1223
1224        public boolean hasAlias() { 
1225          return this.alias != null && !this.alias.isEmpty();
1226        }
1227
1228        /**
1229         * @param value {@link #alias} (The name used for this type in the map.). This is the underlying object with id, value and extensions. The accessor "getAlias" gives direct access to the value
1230         */
1231        public StructureMapStructureComponent setAliasElement(StringType value) { 
1232          this.alias = value;
1233          return this;
1234        }
1235
1236        /**
1237         * @return The name used for this type in the map.
1238         */
1239        public String getAlias() { 
1240          return this.alias == null ? null : this.alias.getValue();
1241        }
1242
1243        /**
1244         * @param value The name used for this type in the map.
1245         */
1246        public StructureMapStructureComponent setAlias(String value) { 
1247          if (Utilities.noString(value))
1248            this.alias = null;
1249          else {
1250            if (this.alias == null)
1251              this.alias = new StringType();
1252            this.alias.setValue(value);
1253          }
1254          return this;
1255        }
1256
1257        /**
1258         * @return {@link #documentation} (Documentation that describes how the structure is used in the mapping.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
1259         */
1260        public StringType getDocumentationElement() { 
1261          if (this.documentation == null)
1262            if (Configuration.errorOnAutoCreate())
1263              throw new Error("Attempt to auto-create StructureMapStructureComponent.documentation");
1264            else if (Configuration.doAutoCreate())
1265              this.documentation = new StringType(); // bb
1266          return this.documentation;
1267        }
1268
1269        public boolean hasDocumentationElement() { 
1270          return this.documentation != null && !this.documentation.isEmpty();
1271        }
1272
1273        public boolean hasDocumentation() { 
1274          return this.documentation != null && !this.documentation.isEmpty();
1275        }
1276
1277        /**
1278         * @param value {@link #documentation} (Documentation that describes how the structure is used in the mapping.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
1279         */
1280        public StructureMapStructureComponent setDocumentationElement(StringType value) { 
1281          this.documentation = value;
1282          return this;
1283        }
1284
1285        /**
1286         * @return Documentation that describes how the structure is used in the mapping.
1287         */
1288        public String getDocumentation() { 
1289          return this.documentation == null ? null : this.documentation.getValue();
1290        }
1291
1292        /**
1293         * @param value Documentation that describes how the structure is used in the mapping.
1294         */
1295        public StructureMapStructureComponent setDocumentation(String value) { 
1296          if (Utilities.noString(value))
1297            this.documentation = null;
1298          else {
1299            if (this.documentation == null)
1300              this.documentation = new StringType();
1301            this.documentation.setValue(value);
1302          }
1303          return this;
1304        }
1305
1306        protected void listChildren(List<Property> children) {
1307          super.listChildren(children);
1308          children.add(new Property("url", "canonical(StructureDefinition)", "The canonical URL that identifies the structure.", 0, 1, url));
1309          children.add(new Property("mode", "code", "How the referenced structure is used in this mapping.", 0, 1, mode));
1310          children.add(new Property("alias", "string", "The name used for this type in the map.", 0, 1, alias));
1311          children.add(new Property("documentation", "string", "Documentation that describes how the structure is used in the mapping.", 0, 1, documentation));
1312        }
1313
1314        @Override
1315        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1316          switch (_hash) {
1317          case 116079: /*url*/  return new Property("url", "canonical(StructureDefinition)", "The canonical URL that identifies the structure.", 0, 1, url);
1318          case 3357091: /*mode*/  return new Property("mode", "code", "How the referenced structure is used in this mapping.", 0, 1, mode);
1319          case 92902992: /*alias*/  return new Property("alias", "string", "The name used for this type in the map.", 0, 1, alias);
1320          case 1587405498: /*documentation*/  return new Property("documentation", "string", "Documentation that describes how the structure is used in the mapping.", 0, 1, documentation);
1321          default: return super.getNamedProperty(_hash, _name, _checkValid);
1322          }
1323
1324        }
1325
1326      @Override
1327      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1328        switch (hash) {
1329        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // CanonicalType
1330        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<StructureMapModelMode>
1331        case 92902992: /*alias*/ return this.alias == null ? new Base[0] : new Base[] {this.alias}; // StringType
1332        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
1333        default: return super.getProperty(hash, name, checkValid);
1334        }
1335
1336      }
1337
1338      @Override
1339      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1340        switch (hash) {
1341        case 116079: // url
1342          this.url = castToCanonical(value); // CanonicalType
1343          return value;
1344        case 3357091: // mode
1345          value = new StructureMapModelModeEnumFactory().fromType(castToCode(value));
1346          this.mode = (Enumeration) value; // Enumeration<StructureMapModelMode>
1347          return value;
1348        case 92902992: // alias
1349          this.alias = castToString(value); // StringType
1350          return value;
1351        case 1587405498: // documentation
1352          this.documentation = castToString(value); // StringType
1353          return value;
1354        default: return super.setProperty(hash, name, value);
1355        }
1356
1357      }
1358
1359      @Override
1360      public Base setProperty(String name, Base value) throws FHIRException {
1361        if (name.equals("url")) {
1362          this.url = castToCanonical(value); // CanonicalType
1363        } else if (name.equals("mode")) {
1364          value = new StructureMapModelModeEnumFactory().fromType(castToCode(value));
1365          this.mode = (Enumeration) value; // Enumeration<StructureMapModelMode>
1366        } else if (name.equals("alias")) {
1367          this.alias = castToString(value); // StringType
1368        } else if (name.equals("documentation")) {
1369          this.documentation = castToString(value); // StringType
1370        } else
1371          return super.setProperty(name, value);
1372        return value;
1373      }
1374
1375      @Override
1376      public Base makeProperty(int hash, String name) throws FHIRException {
1377        switch (hash) {
1378        case 116079:  return getUrlElement();
1379        case 3357091:  return getModeElement();
1380        case 92902992:  return getAliasElement();
1381        case 1587405498:  return getDocumentationElement();
1382        default: return super.makeProperty(hash, name);
1383        }
1384
1385      }
1386
1387      @Override
1388      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1389        switch (hash) {
1390        case 116079: /*url*/ return new String[] {"canonical"};
1391        case 3357091: /*mode*/ return new String[] {"code"};
1392        case 92902992: /*alias*/ return new String[] {"string"};
1393        case 1587405498: /*documentation*/ return new String[] {"string"};
1394        default: return super.getTypesForProperty(hash, name);
1395        }
1396
1397      }
1398
1399      @Override
1400      public Base addChild(String name) throws FHIRException {
1401        if (name.equals("url")) {
1402          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.url");
1403        }
1404        else if (name.equals("mode")) {
1405          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.mode");
1406        }
1407        else if (name.equals("alias")) {
1408          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.alias");
1409        }
1410        else if (name.equals("documentation")) {
1411          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
1412        }
1413        else
1414          return super.addChild(name);
1415      }
1416
1417      public StructureMapStructureComponent copy() {
1418        StructureMapStructureComponent dst = new StructureMapStructureComponent();
1419        copyValues(dst);
1420        dst.url = url == null ? null : url.copy();
1421        dst.mode = mode == null ? null : mode.copy();
1422        dst.alias = alias == null ? null : alias.copy();
1423        dst.documentation = documentation == null ? null : documentation.copy();
1424        return dst;
1425      }
1426
1427      @Override
1428      public boolean equalsDeep(Base other_) {
1429        if (!super.equalsDeep(other_))
1430          return false;
1431        if (!(other_ instanceof StructureMapStructureComponent))
1432          return false;
1433        StructureMapStructureComponent o = (StructureMapStructureComponent) other_;
1434        return compareDeep(url, o.url, true) && compareDeep(mode, o.mode, true) && compareDeep(alias, o.alias, true)
1435           && compareDeep(documentation, o.documentation, true);
1436      }
1437
1438      @Override
1439      public boolean equalsShallow(Base other_) {
1440        if (!super.equalsShallow(other_))
1441          return false;
1442        if (!(other_ instanceof StructureMapStructureComponent))
1443          return false;
1444        StructureMapStructureComponent o = (StructureMapStructureComponent) other_;
1445        return compareValues(mode, o.mode, true) && compareValues(alias, o.alias, true) && compareValues(documentation, o.documentation, true)
1446          ;
1447      }
1448
1449      public boolean isEmpty() {
1450        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, mode, alias, documentation
1451          );
1452      }
1453
1454  public String fhirType() {
1455    return "StructureMap.structure";
1456
1457  }
1458
1459  }
1460
1461    @Block()
1462    public static class StructureMapGroupComponent extends BackboneElement implements IBaseBackboneElement {
1463        /**
1464         * A unique name for the group for the convenience of human readers.
1465         */
1466        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1467        @Description(shortDefinition="Human-readable label", formalDefinition="A unique name for the group for the convenience of human readers." )
1468        protected IdType name;
1469
1470        /**
1471         * Another group that this group adds rules to.
1472         */
1473        @Child(name = "extends", type = {IdType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1474        @Description(shortDefinition="Another group that this group adds rules to", formalDefinition="Another group that this group adds rules to." )
1475        protected IdType extends_;
1476
1477        /**
1478         * If this is the default rule set to apply for the source type or this combination of types.
1479         */
1480        @Child(name = "typeMode", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1481        @Description(shortDefinition="none | types | type-and-types", formalDefinition="If this is the default rule set to apply for the source type or this combination of types." )
1482        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-group-type-mode")
1483        protected Enumeration<StructureMapGroupTypeMode> typeMode;
1484
1485        /**
1486         * Additional supporting documentation that explains the purpose of the group and the types of mappings within it.
1487         */
1488        @Child(name = "documentation", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1489        @Description(shortDefinition="Additional description/explanation for group", formalDefinition="Additional supporting documentation that explains the purpose of the group and the types of mappings within it." )
1490        protected StringType documentation;
1491
1492        /**
1493         * A name assigned to an instance of data. The instance must be provided when the mapping is invoked.
1494         */
1495        @Child(name = "input", type = {}, order=5, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1496        @Description(shortDefinition="Named instance provided when invoking the map", formalDefinition="A name assigned to an instance of data. The instance must be provided when the mapping is invoked." )
1497        protected List<StructureMapGroupInputComponent> input;
1498
1499        /**
1500         * Transform Rule from source to target.
1501         */
1502        @Child(name = "rule", type = {}, order=6, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1503        @Description(shortDefinition="Transform Rule from source to target", formalDefinition="Transform Rule from source to target." )
1504        protected List<StructureMapGroupRuleComponent> rule;
1505
1506        private static final long serialVersionUID = -1474595081L;
1507
1508    /**
1509     * Constructor
1510     */
1511      public StructureMapGroupComponent() {
1512        super();
1513      }
1514
1515    /**
1516     * Constructor
1517     */
1518      public StructureMapGroupComponent(IdType name, Enumeration<StructureMapGroupTypeMode> typeMode) {
1519        super();
1520        this.name = name;
1521        this.typeMode = typeMode;
1522      }
1523
1524        /**
1525         * @return {@link #name} (A unique name for the group for the convenience of human readers.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1526         */
1527        public IdType getNameElement() { 
1528          if (this.name == null)
1529            if (Configuration.errorOnAutoCreate())
1530              throw new Error("Attempt to auto-create StructureMapGroupComponent.name");
1531            else if (Configuration.doAutoCreate())
1532              this.name = new IdType(); // bb
1533          return this.name;
1534        }
1535
1536        public boolean hasNameElement() { 
1537          return this.name != null && !this.name.isEmpty();
1538        }
1539
1540        public boolean hasName() { 
1541          return this.name != null && !this.name.isEmpty();
1542        }
1543
1544        /**
1545         * @param value {@link #name} (A unique name for the group for the convenience of human readers.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1546         */
1547        public StructureMapGroupComponent setNameElement(IdType value) { 
1548          this.name = value;
1549          return this;
1550        }
1551
1552        /**
1553         * @return A unique name for the group for the convenience of human readers.
1554         */
1555        public String getName() { 
1556          return this.name == null ? null : this.name.getValue();
1557        }
1558
1559        /**
1560         * @param value A unique name for the group for the convenience of human readers.
1561         */
1562        public StructureMapGroupComponent setName(String value) { 
1563            if (this.name == null)
1564              this.name = new IdType();
1565            this.name.setValue(value);
1566          return this;
1567        }
1568
1569        /**
1570         * @return {@link #extends_} (Another group that this group adds rules to.). This is the underlying object with id, value and extensions. The accessor "getExtends" gives direct access to the value
1571         */
1572        public IdType getExtendsElement() { 
1573          if (this.extends_ == null)
1574            if (Configuration.errorOnAutoCreate())
1575              throw new Error("Attempt to auto-create StructureMapGroupComponent.extends_");
1576            else if (Configuration.doAutoCreate())
1577              this.extends_ = new IdType(); // bb
1578          return this.extends_;
1579        }
1580
1581        public boolean hasExtendsElement() { 
1582          return this.extends_ != null && !this.extends_.isEmpty();
1583        }
1584
1585        public boolean hasExtends() { 
1586          return this.extends_ != null && !this.extends_.isEmpty();
1587        }
1588
1589        /**
1590         * @param value {@link #extends_} (Another group that this group adds rules to.). This is the underlying object with id, value and extensions. The accessor "getExtends" gives direct access to the value
1591         */
1592        public StructureMapGroupComponent setExtendsElement(IdType value) { 
1593          this.extends_ = value;
1594          return this;
1595        }
1596
1597        /**
1598         * @return Another group that this group adds rules to.
1599         */
1600        public String getExtends() { 
1601          return this.extends_ == null ? null : this.extends_.getValue();
1602        }
1603
1604        /**
1605         * @param value Another group that this group adds rules to.
1606         */
1607        public StructureMapGroupComponent setExtends(String value) { 
1608          if (Utilities.noString(value))
1609            this.extends_ = null;
1610          else {
1611            if (this.extends_ == null)
1612              this.extends_ = new IdType();
1613            this.extends_.setValue(value);
1614          }
1615          return this;
1616        }
1617
1618        /**
1619         * @return {@link #typeMode} (If this is the default rule set to apply for the source type or this combination of types.). This is the underlying object with id, value and extensions. The accessor "getTypeMode" gives direct access to the value
1620         */
1621        public Enumeration<StructureMapGroupTypeMode> getTypeModeElement() { 
1622          if (this.typeMode == null)
1623            if (Configuration.errorOnAutoCreate())
1624              throw new Error("Attempt to auto-create StructureMapGroupComponent.typeMode");
1625            else if (Configuration.doAutoCreate())
1626              this.typeMode = new Enumeration<StructureMapGroupTypeMode>(new StructureMapGroupTypeModeEnumFactory()); // bb
1627          return this.typeMode;
1628        }
1629
1630        public boolean hasTypeModeElement() { 
1631          return this.typeMode != null && !this.typeMode.isEmpty();
1632        }
1633
1634        public boolean hasTypeMode() { 
1635          return this.typeMode != null && !this.typeMode.isEmpty();
1636        }
1637
1638        /**
1639         * @param value {@link #typeMode} (If this is the default rule set to apply for the source type or this combination of types.). This is the underlying object with id, value and extensions. The accessor "getTypeMode" gives direct access to the value
1640         */
1641        public StructureMapGroupComponent setTypeModeElement(Enumeration<StructureMapGroupTypeMode> value) { 
1642          this.typeMode = value;
1643          return this;
1644        }
1645
1646        /**
1647         * @return If this is the default rule set to apply for the source type or this combination of types.
1648         */
1649        public StructureMapGroupTypeMode getTypeMode() { 
1650          return this.typeMode == null ? null : this.typeMode.getValue();
1651        }
1652
1653        /**
1654         * @param value If this is the default rule set to apply for the source type or this combination of types.
1655         */
1656        public StructureMapGroupComponent setTypeMode(StructureMapGroupTypeMode value) { 
1657            if (this.typeMode == null)
1658              this.typeMode = new Enumeration<StructureMapGroupTypeMode>(new StructureMapGroupTypeModeEnumFactory());
1659            this.typeMode.setValue(value);
1660          return this;
1661        }
1662
1663        /**
1664         * @return {@link #documentation} (Additional supporting documentation that explains the purpose of the group and the types of mappings within it.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
1665         */
1666        public StringType getDocumentationElement() { 
1667          if (this.documentation == null)
1668            if (Configuration.errorOnAutoCreate())
1669              throw new Error("Attempt to auto-create StructureMapGroupComponent.documentation");
1670            else if (Configuration.doAutoCreate())
1671              this.documentation = new StringType(); // bb
1672          return this.documentation;
1673        }
1674
1675        public boolean hasDocumentationElement() { 
1676          return this.documentation != null && !this.documentation.isEmpty();
1677        }
1678
1679        public boolean hasDocumentation() { 
1680          return this.documentation != null && !this.documentation.isEmpty();
1681        }
1682
1683        /**
1684         * @param value {@link #documentation} (Additional supporting documentation that explains the purpose of the group and the types of mappings within it.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
1685         */
1686        public StructureMapGroupComponent setDocumentationElement(StringType value) { 
1687          this.documentation = value;
1688          return this;
1689        }
1690
1691        /**
1692         * @return Additional supporting documentation that explains the purpose of the group and the types of mappings within it.
1693         */
1694        public String getDocumentation() { 
1695          return this.documentation == null ? null : this.documentation.getValue();
1696        }
1697
1698        /**
1699         * @param value Additional supporting documentation that explains the purpose of the group and the types of mappings within it.
1700         */
1701        public StructureMapGroupComponent setDocumentation(String value) { 
1702          if (Utilities.noString(value))
1703            this.documentation = null;
1704          else {
1705            if (this.documentation == null)
1706              this.documentation = new StringType();
1707            this.documentation.setValue(value);
1708          }
1709          return this;
1710        }
1711
1712        /**
1713         * @return {@link #input} (A name assigned to an instance of data. The instance must be provided when the mapping is invoked.)
1714         */
1715        public List<StructureMapGroupInputComponent> getInput() { 
1716          if (this.input == null)
1717            this.input = new ArrayList<StructureMapGroupInputComponent>();
1718          return this.input;
1719        }
1720
1721        /**
1722         * @return Returns a reference to <code>this</code> for easy method chaining
1723         */
1724        public StructureMapGroupComponent setInput(List<StructureMapGroupInputComponent> theInput) { 
1725          this.input = theInput;
1726          return this;
1727        }
1728
1729        public boolean hasInput() { 
1730          if (this.input == null)
1731            return false;
1732          for (StructureMapGroupInputComponent item : this.input)
1733            if (!item.isEmpty())
1734              return true;
1735          return false;
1736        }
1737
1738        public StructureMapGroupInputComponent addInput() { //3
1739          StructureMapGroupInputComponent t = new StructureMapGroupInputComponent();
1740          if (this.input == null)
1741            this.input = new ArrayList<StructureMapGroupInputComponent>();
1742          this.input.add(t);
1743          return t;
1744        }
1745
1746        public StructureMapGroupComponent addInput(StructureMapGroupInputComponent t) { //3
1747          if (t == null)
1748            return this;
1749          if (this.input == null)
1750            this.input = new ArrayList<StructureMapGroupInputComponent>();
1751          this.input.add(t);
1752          return this;
1753        }
1754
1755        /**
1756         * @return The first repetition of repeating field {@link #input}, creating it if it does not already exist
1757         */
1758        public StructureMapGroupInputComponent getInputFirstRep() { 
1759          if (getInput().isEmpty()) {
1760            addInput();
1761          }
1762          return getInput().get(0);
1763        }
1764
1765        /**
1766         * @return {@link #rule} (Transform Rule from source to target.)
1767         */
1768        public List<StructureMapGroupRuleComponent> getRule() { 
1769          if (this.rule == null)
1770            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
1771          return this.rule;
1772        }
1773
1774        /**
1775         * @return Returns a reference to <code>this</code> for easy method chaining
1776         */
1777        public StructureMapGroupComponent setRule(List<StructureMapGroupRuleComponent> theRule) { 
1778          this.rule = theRule;
1779          return this;
1780        }
1781
1782        public boolean hasRule() { 
1783          if (this.rule == null)
1784            return false;
1785          for (StructureMapGroupRuleComponent item : this.rule)
1786            if (!item.isEmpty())
1787              return true;
1788          return false;
1789        }
1790
1791        public StructureMapGroupRuleComponent addRule() { //3
1792          StructureMapGroupRuleComponent t = new StructureMapGroupRuleComponent();
1793          if (this.rule == null)
1794            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
1795          this.rule.add(t);
1796          return t;
1797        }
1798
1799        public StructureMapGroupComponent addRule(StructureMapGroupRuleComponent t) { //3
1800          if (t == null)
1801            return this;
1802          if (this.rule == null)
1803            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
1804          this.rule.add(t);
1805          return this;
1806        }
1807
1808        /**
1809         * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist
1810         */
1811        public StructureMapGroupRuleComponent getRuleFirstRep() { 
1812          if (getRule().isEmpty()) {
1813            addRule();
1814          }
1815          return getRule().get(0);
1816        }
1817
1818        protected void listChildren(List<Property> children) {
1819          super.listChildren(children);
1820          children.add(new Property("name", "id", "A unique name for the group for the convenience of human readers.", 0, 1, name));
1821          children.add(new Property("extends", "id", "Another group that this group adds rules to.", 0, 1, extends_));
1822          children.add(new Property("typeMode", "code", "If this is the default rule set to apply for the source type or this combination of types.", 0, 1, typeMode));
1823          children.add(new Property("documentation", "string", "Additional supporting documentation that explains the purpose of the group and the types of mappings within it.", 0, 1, documentation));
1824          children.add(new Property("input", "", "A name assigned to an instance of data. The instance must be provided when the mapping is invoked.", 0, java.lang.Integer.MAX_VALUE, input));
1825          children.add(new Property("rule", "", "Transform Rule from source to target.", 0, java.lang.Integer.MAX_VALUE, rule));
1826        }
1827
1828        @Override
1829        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1830          switch (_hash) {
1831          case 3373707: /*name*/  return new Property("name", "id", "A unique name for the group for the convenience of human readers.", 0, 1, name);
1832          case -1305664359: /*extends*/  return new Property("extends", "id", "Another group that this group adds rules to.", 0, 1, extends_);
1833          case -676524035: /*typeMode*/  return new Property("typeMode", "code", "If this is the default rule set to apply for the source type or this combination of types.", 0, 1, typeMode);
1834          case 1587405498: /*documentation*/  return new Property("documentation", "string", "Additional supporting documentation that explains the purpose of the group and the types of mappings within it.", 0, 1, documentation);
1835          case 100358090: /*input*/  return new Property("input", "", "A name assigned to an instance of data. The instance must be provided when the mapping is invoked.", 0, java.lang.Integer.MAX_VALUE, input);
1836          case 3512060: /*rule*/  return new Property("rule", "", "Transform Rule from source to target.", 0, java.lang.Integer.MAX_VALUE, rule);
1837          default: return super.getNamedProperty(_hash, _name, _checkValid);
1838          }
1839
1840        }
1841
1842      @Override
1843      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1844        switch (hash) {
1845        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
1846        case -1305664359: /*extends*/ return this.extends_ == null ? new Base[0] : new Base[] {this.extends_}; // IdType
1847        case -676524035: /*typeMode*/ return this.typeMode == null ? new Base[0] : new Base[] {this.typeMode}; // Enumeration<StructureMapGroupTypeMode>
1848        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
1849        case 100358090: /*input*/ return this.input == null ? new Base[0] : this.input.toArray(new Base[this.input.size()]); // StructureMapGroupInputComponent
1850        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // StructureMapGroupRuleComponent
1851        default: return super.getProperty(hash, name, checkValid);
1852        }
1853
1854      }
1855
1856      @Override
1857      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1858        switch (hash) {
1859        case 3373707: // name
1860          this.name = castToId(value); // IdType
1861          return value;
1862        case -1305664359: // extends
1863          this.extends_ = castToId(value); // IdType
1864          return value;
1865        case -676524035: // typeMode
1866          value = new StructureMapGroupTypeModeEnumFactory().fromType(castToCode(value));
1867          this.typeMode = (Enumeration) value; // Enumeration<StructureMapGroupTypeMode>
1868          return value;
1869        case 1587405498: // documentation
1870          this.documentation = castToString(value); // StringType
1871          return value;
1872        case 100358090: // input
1873          this.getInput().add((StructureMapGroupInputComponent) value); // StructureMapGroupInputComponent
1874          return value;
1875        case 3512060: // rule
1876          this.getRule().add((StructureMapGroupRuleComponent) value); // StructureMapGroupRuleComponent
1877          return value;
1878        default: return super.setProperty(hash, name, value);
1879        }
1880
1881      }
1882
1883      @Override
1884      public Base setProperty(String name, Base value) throws FHIRException {
1885        if (name.equals("name")) {
1886          this.name = castToId(value); // IdType
1887        } else if (name.equals("extends")) {
1888          this.extends_ = castToId(value); // IdType
1889        } else if (name.equals("typeMode")) {
1890          value = new StructureMapGroupTypeModeEnumFactory().fromType(castToCode(value));
1891          this.typeMode = (Enumeration) value; // Enumeration<StructureMapGroupTypeMode>
1892        } else if (name.equals("documentation")) {
1893          this.documentation = castToString(value); // StringType
1894        } else if (name.equals("input")) {
1895          this.getInput().add((StructureMapGroupInputComponent) value);
1896        } else if (name.equals("rule")) {
1897          this.getRule().add((StructureMapGroupRuleComponent) value);
1898        } else
1899          return super.setProperty(name, value);
1900        return value;
1901      }
1902
1903      @Override
1904      public Base makeProperty(int hash, String name) throws FHIRException {
1905        switch (hash) {
1906        case 3373707:  return getNameElement();
1907        case -1305664359:  return getExtendsElement();
1908        case -676524035:  return getTypeModeElement();
1909        case 1587405498:  return getDocumentationElement();
1910        case 100358090:  return addInput(); 
1911        case 3512060:  return addRule(); 
1912        default: return super.makeProperty(hash, name);
1913        }
1914
1915      }
1916
1917      @Override
1918      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1919        switch (hash) {
1920        case 3373707: /*name*/ return new String[] {"id"};
1921        case -1305664359: /*extends*/ return new String[] {"id"};
1922        case -676524035: /*typeMode*/ return new String[] {"code"};
1923        case 1587405498: /*documentation*/ return new String[] {"string"};
1924        case 100358090: /*input*/ return new String[] {};
1925        case 3512060: /*rule*/ return new String[] {};
1926        default: return super.getTypesForProperty(hash, name);
1927        }
1928
1929      }
1930
1931      @Override
1932      public Base addChild(String name) throws FHIRException {
1933        if (name.equals("name")) {
1934          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
1935        }
1936        else if (name.equals("extends")) {
1937          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.extends");
1938        }
1939        else if (name.equals("typeMode")) {
1940          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.typeMode");
1941        }
1942        else if (name.equals("documentation")) {
1943          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
1944        }
1945        else if (name.equals("input")) {
1946          return addInput();
1947        }
1948        else if (name.equals("rule")) {
1949          return addRule();
1950        }
1951        else
1952          return super.addChild(name);
1953      }
1954
1955      public StructureMapGroupComponent copy() {
1956        StructureMapGroupComponent dst = new StructureMapGroupComponent();
1957        copyValues(dst);
1958        dst.name = name == null ? null : name.copy();
1959        dst.extends_ = extends_ == null ? null : extends_.copy();
1960        dst.typeMode = typeMode == null ? null : typeMode.copy();
1961        dst.documentation = documentation == null ? null : documentation.copy();
1962        if (input != null) {
1963          dst.input = new ArrayList<StructureMapGroupInputComponent>();
1964          for (StructureMapGroupInputComponent i : input)
1965            dst.input.add(i.copy());
1966        };
1967        if (rule != null) {
1968          dst.rule = new ArrayList<StructureMapGroupRuleComponent>();
1969          for (StructureMapGroupRuleComponent i : rule)
1970            dst.rule.add(i.copy());
1971        };
1972        return dst;
1973      }
1974
1975      @Override
1976      public boolean equalsDeep(Base other_) {
1977        if (!super.equalsDeep(other_))
1978          return false;
1979        if (!(other_ instanceof StructureMapGroupComponent))
1980          return false;
1981        StructureMapGroupComponent o = (StructureMapGroupComponent) other_;
1982        return compareDeep(name, o.name, true) && compareDeep(extends_, o.extends_, true) && compareDeep(typeMode, o.typeMode, true)
1983           && compareDeep(documentation, o.documentation, true) && compareDeep(input, o.input, true) && compareDeep(rule, o.rule, true)
1984          ;
1985      }
1986
1987      @Override
1988      public boolean equalsShallow(Base other_) {
1989        if (!super.equalsShallow(other_))
1990          return false;
1991        if (!(other_ instanceof StructureMapGroupComponent))
1992          return false;
1993        StructureMapGroupComponent o = (StructureMapGroupComponent) other_;
1994        return compareValues(name, o.name, true) && compareValues(extends_, o.extends_, true) && compareValues(typeMode, o.typeMode, true)
1995           && compareValues(documentation, o.documentation, true);
1996      }
1997
1998      public boolean isEmpty() {
1999        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, extends_, typeMode
2000          , documentation, input, rule);
2001      }
2002
2003  public String fhirType() {
2004    return "StructureMap.group";
2005
2006  }
2007
2008// added from java-adornments.txt:
2009
2010  public String toString() {
2011    return StructureMapUtilities.groupToString(this);
2012  }
2013
2014
2015// end addition
2016  }
2017
2018    @Block()
2019    public static class StructureMapGroupInputComponent extends BackboneElement implements IBaseBackboneElement {
2020        /**
2021         * Name for this instance of data.
2022         */
2023        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2024        @Description(shortDefinition="Name for this instance of data", formalDefinition="Name for this instance of data." )
2025        protected IdType name;
2026
2027        /**
2028         * Type for this instance of data.
2029         */
2030        @Child(name = "type", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2031        @Description(shortDefinition="Type for this instance of data", formalDefinition="Type for this instance of data." )
2032        protected StringType type;
2033
2034        /**
2035         * Mode for this instance of data.
2036         */
2037        @Child(name = "mode", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
2038        @Description(shortDefinition="source | target", formalDefinition="Mode for this instance of data." )
2039        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-input-mode")
2040        protected Enumeration<StructureMapInputMode> mode;
2041
2042        /**
2043         * Documentation for this instance of data.
2044         */
2045        @Child(name = "documentation", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
2046        @Description(shortDefinition="Documentation for this instance of data", formalDefinition="Documentation for this instance of data." )
2047        protected StringType documentation;
2048
2049        private static final long serialVersionUID = -25050724L;
2050
2051    /**
2052     * Constructor
2053     */
2054      public StructureMapGroupInputComponent() {
2055        super();
2056      }
2057
2058    /**
2059     * Constructor
2060     */
2061      public StructureMapGroupInputComponent(IdType name, Enumeration<StructureMapInputMode> mode) {
2062        super();
2063        this.name = name;
2064        this.mode = mode;
2065      }
2066
2067        /**
2068         * @return {@link #name} (Name for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2069         */
2070        public IdType getNameElement() { 
2071          if (this.name == null)
2072            if (Configuration.errorOnAutoCreate())
2073              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.name");
2074            else if (Configuration.doAutoCreate())
2075              this.name = new IdType(); // bb
2076          return this.name;
2077        }
2078
2079        public boolean hasNameElement() { 
2080          return this.name != null && !this.name.isEmpty();
2081        }
2082
2083        public boolean hasName() { 
2084          return this.name != null && !this.name.isEmpty();
2085        }
2086
2087        /**
2088         * @param value {@link #name} (Name for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2089         */
2090        public StructureMapGroupInputComponent setNameElement(IdType value) { 
2091          this.name = value;
2092          return this;
2093        }
2094
2095        /**
2096         * @return Name for this instance of data.
2097         */
2098        public String getName() { 
2099          return this.name == null ? null : this.name.getValue();
2100        }
2101
2102        /**
2103         * @param value Name for this instance of data.
2104         */
2105        public StructureMapGroupInputComponent setName(String value) { 
2106            if (this.name == null)
2107              this.name = new IdType();
2108            this.name.setValue(value);
2109          return this;
2110        }
2111
2112        /**
2113         * @return {@link #type} (Type for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
2114         */
2115        public StringType getTypeElement() { 
2116          if (this.type == null)
2117            if (Configuration.errorOnAutoCreate())
2118              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.type");
2119            else if (Configuration.doAutoCreate())
2120              this.type = new StringType(); // bb
2121          return this.type;
2122        }
2123
2124        public boolean hasTypeElement() { 
2125          return this.type != null && !this.type.isEmpty();
2126        }
2127
2128        public boolean hasType() { 
2129          return this.type != null && !this.type.isEmpty();
2130        }
2131
2132        /**
2133         * @param value {@link #type} (Type for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
2134         */
2135        public StructureMapGroupInputComponent setTypeElement(StringType value) { 
2136          this.type = value;
2137          return this;
2138        }
2139
2140        /**
2141         * @return Type for this instance of data.
2142         */
2143        public String getType() { 
2144          return this.type == null ? null : this.type.getValue();
2145        }
2146
2147        /**
2148         * @param value Type for this instance of data.
2149         */
2150        public StructureMapGroupInputComponent setType(String value) { 
2151          if (Utilities.noString(value))
2152            this.type = null;
2153          else {
2154            if (this.type == null)
2155              this.type = new StringType();
2156            this.type.setValue(value);
2157          }
2158          return this;
2159        }
2160
2161        /**
2162         * @return {@link #mode} (Mode for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
2163         */
2164        public Enumeration<StructureMapInputMode> getModeElement() { 
2165          if (this.mode == null)
2166            if (Configuration.errorOnAutoCreate())
2167              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.mode");
2168            else if (Configuration.doAutoCreate())
2169              this.mode = new Enumeration<StructureMapInputMode>(new StructureMapInputModeEnumFactory()); // bb
2170          return this.mode;
2171        }
2172
2173        public boolean hasModeElement() { 
2174          return this.mode != null && !this.mode.isEmpty();
2175        }
2176
2177        public boolean hasMode() { 
2178          return this.mode != null && !this.mode.isEmpty();
2179        }
2180
2181        /**
2182         * @param value {@link #mode} (Mode for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
2183         */
2184        public StructureMapGroupInputComponent setModeElement(Enumeration<StructureMapInputMode> value) { 
2185          this.mode = value;
2186          return this;
2187        }
2188
2189        /**
2190         * @return Mode for this instance of data.
2191         */
2192        public StructureMapInputMode getMode() { 
2193          return this.mode == null ? null : this.mode.getValue();
2194        }
2195
2196        /**
2197         * @param value Mode for this instance of data.
2198         */
2199        public StructureMapGroupInputComponent setMode(StructureMapInputMode value) { 
2200            if (this.mode == null)
2201              this.mode = new Enumeration<StructureMapInputMode>(new StructureMapInputModeEnumFactory());
2202            this.mode.setValue(value);
2203          return this;
2204        }
2205
2206        /**
2207         * @return {@link #documentation} (Documentation for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
2208         */
2209        public StringType getDocumentationElement() { 
2210          if (this.documentation == null)
2211            if (Configuration.errorOnAutoCreate())
2212              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.documentation");
2213            else if (Configuration.doAutoCreate())
2214              this.documentation = new StringType(); // bb
2215          return this.documentation;
2216        }
2217
2218        public boolean hasDocumentationElement() { 
2219          return this.documentation != null && !this.documentation.isEmpty();
2220        }
2221
2222        public boolean hasDocumentation() { 
2223          return this.documentation != null && !this.documentation.isEmpty();
2224        }
2225
2226        /**
2227         * @param value {@link #documentation} (Documentation for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
2228         */
2229        public StructureMapGroupInputComponent setDocumentationElement(StringType value) { 
2230          this.documentation = value;
2231          return this;
2232        }
2233
2234        /**
2235         * @return Documentation for this instance of data.
2236         */
2237        public String getDocumentation() { 
2238          return this.documentation == null ? null : this.documentation.getValue();
2239        }
2240
2241        /**
2242         * @param value Documentation for this instance of data.
2243         */
2244        public StructureMapGroupInputComponent setDocumentation(String value) { 
2245          if (Utilities.noString(value))
2246            this.documentation = null;
2247          else {
2248            if (this.documentation == null)
2249              this.documentation = new StringType();
2250            this.documentation.setValue(value);
2251          }
2252          return this;
2253        }
2254
2255        protected void listChildren(List<Property> children) {
2256          super.listChildren(children);
2257          children.add(new Property("name", "id", "Name for this instance of data.", 0, 1, name));
2258          children.add(new Property("type", "string", "Type for this instance of data.", 0, 1, type));
2259          children.add(new Property("mode", "code", "Mode for this instance of data.", 0, 1, mode));
2260          children.add(new Property("documentation", "string", "Documentation for this instance of data.", 0, 1, documentation));
2261        }
2262
2263        @Override
2264        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2265          switch (_hash) {
2266          case 3373707: /*name*/  return new Property("name", "id", "Name for this instance of data.", 0, 1, name);
2267          case 3575610: /*type*/  return new Property("type", "string", "Type for this instance of data.", 0, 1, type);
2268          case 3357091: /*mode*/  return new Property("mode", "code", "Mode for this instance of data.", 0, 1, mode);
2269          case 1587405498: /*documentation*/  return new Property("documentation", "string", "Documentation for this instance of data.", 0, 1, documentation);
2270          default: return super.getNamedProperty(_hash, _name, _checkValid);
2271          }
2272
2273        }
2274
2275      @Override
2276      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2277        switch (hash) {
2278        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
2279        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // StringType
2280        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<StructureMapInputMode>
2281        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
2282        default: return super.getProperty(hash, name, checkValid);
2283        }
2284
2285      }
2286
2287      @Override
2288      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2289        switch (hash) {
2290        case 3373707: // name
2291          this.name = castToId(value); // IdType
2292          return value;
2293        case 3575610: // type
2294          this.type = castToString(value); // StringType
2295          return value;
2296        case 3357091: // mode
2297          value = new StructureMapInputModeEnumFactory().fromType(castToCode(value));
2298          this.mode = (Enumeration) value; // Enumeration<StructureMapInputMode>
2299          return value;
2300        case 1587405498: // documentation
2301          this.documentation = castToString(value); // StringType
2302          return value;
2303        default: return super.setProperty(hash, name, value);
2304        }
2305
2306      }
2307
2308      @Override
2309      public Base setProperty(String name, Base value) throws FHIRException {
2310        if (name.equals("name")) {
2311          this.name = castToId(value); // IdType
2312        } else if (name.equals("type")) {
2313          this.type = castToString(value); // StringType
2314        } else if (name.equals("mode")) {
2315          value = new StructureMapInputModeEnumFactory().fromType(castToCode(value));
2316          this.mode = (Enumeration) value; // Enumeration<StructureMapInputMode>
2317        } else if (name.equals("documentation")) {
2318          this.documentation = castToString(value); // StringType
2319        } else
2320          return super.setProperty(name, value);
2321        return value;
2322      }
2323
2324      @Override
2325      public Base makeProperty(int hash, String name) throws FHIRException {
2326        switch (hash) {
2327        case 3373707:  return getNameElement();
2328        case 3575610:  return getTypeElement();
2329        case 3357091:  return getModeElement();
2330        case 1587405498:  return getDocumentationElement();
2331        default: return super.makeProperty(hash, name);
2332        }
2333
2334      }
2335
2336      @Override
2337      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2338        switch (hash) {
2339        case 3373707: /*name*/ return new String[] {"id"};
2340        case 3575610: /*type*/ return new String[] {"string"};
2341        case 3357091: /*mode*/ return new String[] {"code"};
2342        case 1587405498: /*documentation*/ return new String[] {"string"};
2343        default: return super.getTypesForProperty(hash, name);
2344        }
2345
2346      }
2347
2348      @Override
2349      public Base addChild(String name) throws FHIRException {
2350        if (name.equals("name")) {
2351          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
2352        }
2353        else if (name.equals("type")) {
2354          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.type");
2355        }
2356        else if (name.equals("mode")) {
2357          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.mode");
2358        }
2359        else if (name.equals("documentation")) {
2360          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
2361        }
2362        else
2363          return super.addChild(name);
2364      }
2365
2366      public StructureMapGroupInputComponent copy() {
2367        StructureMapGroupInputComponent dst = new StructureMapGroupInputComponent();
2368        copyValues(dst);
2369        dst.name = name == null ? null : name.copy();
2370        dst.type = type == null ? null : type.copy();
2371        dst.mode = mode == null ? null : mode.copy();
2372        dst.documentation = documentation == null ? null : documentation.copy();
2373        return dst;
2374      }
2375
2376      @Override
2377      public boolean equalsDeep(Base other_) {
2378        if (!super.equalsDeep(other_))
2379          return false;
2380        if (!(other_ instanceof StructureMapGroupInputComponent))
2381          return false;
2382        StructureMapGroupInputComponent o = (StructureMapGroupInputComponent) other_;
2383        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true) && compareDeep(mode, o.mode, true)
2384           && compareDeep(documentation, o.documentation, true);
2385      }
2386
2387      @Override
2388      public boolean equalsShallow(Base other_) {
2389        if (!super.equalsShallow(other_))
2390          return false;
2391        if (!(other_ instanceof StructureMapGroupInputComponent))
2392          return false;
2393        StructureMapGroupInputComponent o = (StructureMapGroupInputComponent) other_;
2394        return compareValues(name, o.name, true) && compareValues(type, o.type, true) && compareValues(mode, o.mode, true)
2395           && compareValues(documentation, o.documentation, true);
2396      }
2397
2398      public boolean isEmpty() {
2399        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type, mode, documentation
2400          );
2401      }
2402
2403  public String fhirType() {
2404    return "StructureMap.group.input";
2405
2406  }
2407
2408  }
2409
2410    @Block()
2411    public static class StructureMapGroupRuleComponent extends BackboneElement implements IBaseBackboneElement {
2412        /**
2413         * Name of the rule for internal references.
2414         */
2415        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2416        @Description(shortDefinition="Name of the rule for internal references", formalDefinition="Name of the rule for internal references." )
2417        protected IdType name;
2418
2419        /**
2420         * Source inputs to the mapping.
2421         */
2422        @Child(name = "source", type = {}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2423        @Description(shortDefinition="Source inputs to the mapping", formalDefinition="Source inputs to the mapping." )
2424        protected List<StructureMapGroupRuleSourceComponent> source;
2425
2426        /**
2427         * Content to create because of this mapping rule.
2428         */
2429        @Child(name = "target", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2430        @Description(shortDefinition="Content to create because of this mapping rule", formalDefinition="Content to create because of this mapping rule." )
2431        protected List<StructureMapGroupRuleTargetComponent> target;
2432
2433        /**
2434         * Rules contained in this rule.
2435         */
2436        @Child(name = "rule", type = {StructureMapGroupRuleComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2437        @Description(shortDefinition="Rules contained in this rule", formalDefinition="Rules contained in this rule." )
2438        protected List<StructureMapGroupRuleComponent> rule;
2439
2440        /**
2441         * Which other rules to apply in the context of this rule.
2442         */
2443        @Child(name = "dependent", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2444        @Description(shortDefinition="Which other rules to apply in the context of this rule", formalDefinition="Which other rules to apply in the context of this rule." )
2445        protected List<StructureMapGroupRuleDependentComponent> dependent;
2446
2447        /**
2448         * Documentation for this instance of data.
2449         */
2450        @Child(name = "documentation", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
2451        @Description(shortDefinition="Documentation for this instance of data", formalDefinition="Documentation for this instance of data." )
2452        protected StringType documentation;
2453
2454        private static final long serialVersionUID = 773925517L;
2455
2456    /**
2457     * Constructor
2458     */
2459      public StructureMapGroupRuleComponent() {
2460        super();
2461      }
2462
2463    /**
2464     * Constructor
2465     */
2466      public StructureMapGroupRuleComponent(IdType name) {
2467        super();
2468        this.name = name;
2469      }
2470
2471        /**
2472         * @return {@link #name} (Name of the rule for internal references.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2473         */
2474        public IdType getNameElement() { 
2475          if (this.name == null)
2476            if (Configuration.errorOnAutoCreate())
2477              throw new Error("Attempt to auto-create StructureMapGroupRuleComponent.name");
2478            else if (Configuration.doAutoCreate())
2479              this.name = new IdType(); // bb
2480          return this.name;
2481        }
2482
2483        public boolean hasNameElement() { 
2484          return this.name != null && !this.name.isEmpty();
2485        }
2486
2487        public boolean hasName() { 
2488          return this.name != null && !this.name.isEmpty();
2489        }
2490
2491        /**
2492         * @param value {@link #name} (Name of the rule for internal references.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2493         */
2494        public StructureMapGroupRuleComponent setNameElement(IdType value) { 
2495          this.name = value;
2496          return this;
2497        }
2498
2499        /**
2500         * @return Name of the rule for internal references.
2501         */
2502        public String getName() { 
2503          return this.name == null ? null : this.name.getValue();
2504        }
2505
2506        /**
2507         * @param value Name of the rule for internal references.
2508         */
2509        public StructureMapGroupRuleComponent setName(String value) { 
2510            if (this.name == null)
2511              this.name = new IdType();
2512            this.name.setValue(value);
2513          return this;
2514        }
2515
2516        /**
2517         * @return {@link #source} (Source inputs to the mapping.)
2518         */
2519        public List<StructureMapGroupRuleSourceComponent> getSource() { 
2520          if (this.source == null)
2521            this.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2522          return this.source;
2523        }
2524
2525        /**
2526         * @return Returns a reference to <code>this</code> for easy method chaining
2527         */
2528        public StructureMapGroupRuleComponent setSource(List<StructureMapGroupRuleSourceComponent> theSource) { 
2529          this.source = theSource;
2530          return this;
2531        }
2532
2533        public boolean hasSource() { 
2534          if (this.source == null)
2535            return false;
2536          for (StructureMapGroupRuleSourceComponent item : this.source)
2537            if (!item.isEmpty())
2538              return true;
2539          return false;
2540        }
2541
2542        public StructureMapGroupRuleSourceComponent addSource() { //3
2543          StructureMapGroupRuleSourceComponent t = new StructureMapGroupRuleSourceComponent();
2544          if (this.source == null)
2545            this.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2546          this.source.add(t);
2547          return t;
2548        }
2549
2550        public StructureMapGroupRuleComponent addSource(StructureMapGroupRuleSourceComponent t) { //3
2551          if (t == null)
2552            return this;
2553          if (this.source == null)
2554            this.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2555          this.source.add(t);
2556          return this;
2557        }
2558
2559        /**
2560         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
2561         */
2562        public StructureMapGroupRuleSourceComponent getSourceFirstRep() { 
2563          if (getSource().isEmpty()) {
2564            addSource();
2565          }
2566          return getSource().get(0);
2567        }
2568
2569        /**
2570         * @return {@link #target} (Content to create because of this mapping rule.)
2571         */
2572        public List<StructureMapGroupRuleTargetComponent> getTarget() { 
2573          if (this.target == null)
2574            this.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2575          return this.target;
2576        }
2577
2578        /**
2579         * @return Returns a reference to <code>this</code> for easy method chaining
2580         */
2581        public StructureMapGroupRuleComponent setTarget(List<StructureMapGroupRuleTargetComponent> theTarget) { 
2582          this.target = theTarget;
2583          return this;
2584        }
2585
2586        public boolean hasTarget() { 
2587          if (this.target == null)
2588            return false;
2589          for (StructureMapGroupRuleTargetComponent item : this.target)
2590            if (!item.isEmpty())
2591              return true;
2592          return false;
2593        }
2594
2595        public StructureMapGroupRuleTargetComponent addTarget() { //3
2596          StructureMapGroupRuleTargetComponent t = new StructureMapGroupRuleTargetComponent();
2597          if (this.target == null)
2598            this.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2599          this.target.add(t);
2600          return t;
2601        }
2602
2603        public StructureMapGroupRuleComponent addTarget(StructureMapGroupRuleTargetComponent t) { //3
2604          if (t == null)
2605            return this;
2606          if (this.target == null)
2607            this.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2608          this.target.add(t);
2609          return this;
2610        }
2611
2612        /**
2613         * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist
2614         */
2615        public StructureMapGroupRuleTargetComponent getTargetFirstRep() { 
2616          if (getTarget().isEmpty()) {
2617            addTarget();
2618          }
2619          return getTarget().get(0);
2620        }
2621
2622        /**
2623         * @return {@link #rule} (Rules contained in this rule.)
2624         */
2625        public List<StructureMapGroupRuleComponent> getRule() { 
2626          if (this.rule == null)
2627            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
2628          return this.rule;
2629        }
2630
2631        /**
2632         * @return Returns a reference to <code>this</code> for easy method chaining
2633         */
2634        public StructureMapGroupRuleComponent setRule(List<StructureMapGroupRuleComponent> theRule) { 
2635          this.rule = theRule;
2636          return this;
2637        }
2638
2639        public boolean hasRule() { 
2640          if (this.rule == null)
2641            return false;
2642          for (StructureMapGroupRuleComponent item : this.rule)
2643            if (!item.isEmpty())
2644              return true;
2645          return false;
2646        }
2647
2648        public StructureMapGroupRuleComponent addRule() { //3
2649          StructureMapGroupRuleComponent t = new StructureMapGroupRuleComponent();
2650          if (this.rule == null)
2651            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
2652          this.rule.add(t);
2653          return t;
2654        }
2655
2656        public StructureMapGroupRuleComponent addRule(StructureMapGroupRuleComponent t) { //3
2657          if (t == null)
2658            return this;
2659          if (this.rule == null)
2660            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
2661          this.rule.add(t);
2662          return this;
2663        }
2664
2665        /**
2666         * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist
2667         */
2668        public StructureMapGroupRuleComponent getRuleFirstRep() { 
2669          if (getRule().isEmpty()) {
2670            addRule();
2671          }
2672          return getRule().get(0);
2673        }
2674
2675        /**
2676         * @return {@link #dependent} (Which other rules to apply in the context of this rule.)
2677         */
2678        public List<StructureMapGroupRuleDependentComponent> getDependent() { 
2679          if (this.dependent == null)
2680            this.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2681          return this.dependent;
2682        }
2683
2684        /**
2685         * @return Returns a reference to <code>this</code> for easy method chaining
2686         */
2687        public StructureMapGroupRuleComponent setDependent(List<StructureMapGroupRuleDependentComponent> theDependent) { 
2688          this.dependent = theDependent;
2689          return this;
2690        }
2691
2692        public boolean hasDependent() { 
2693          if (this.dependent == null)
2694            return false;
2695          for (StructureMapGroupRuleDependentComponent item : this.dependent)
2696            if (!item.isEmpty())
2697              return true;
2698          return false;
2699        }
2700
2701        public StructureMapGroupRuleDependentComponent addDependent() { //3
2702          StructureMapGroupRuleDependentComponent t = new StructureMapGroupRuleDependentComponent();
2703          if (this.dependent == null)
2704            this.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2705          this.dependent.add(t);
2706          return t;
2707        }
2708
2709        public StructureMapGroupRuleComponent addDependent(StructureMapGroupRuleDependentComponent t) { //3
2710          if (t == null)
2711            return this;
2712          if (this.dependent == null)
2713            this.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2714          this.dependent.add(t);
2715          return this;
2716        }
2717
2718        /**
2719         * @return The first repetition of repeating field {@link #dependent}, creating it if it does not already exist
2720         */
2721        public StructureMapGroupRuleDependentComponent getDependentFirstRep() { 
2722          if (getDependent().isEmpty()) {
2723            addDependent();
2724          }
2725          return getDependent().get(0);
2726        }
2727
2728        /**
2729         * @return {@link #documentation} (Documentation for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
2730         */
2731        public StringType getDocumentationElement() { 
2732          if (this.documentation == null)
2733            if (Configuration.errorOnAutoCreate())
2734              throw new Error("Attempt to auto-create StructureMapGroupRuleComponent.documentation");
2735            else if (Configuration.doAutoCreate())
2736              this.documentation = new StringType(); // bb
2737          return this.documentation;
2738        }
2739
2740        public boolean hasDocumentationElement() { 
2741          return this.documentation != null && !this.documentation.isEmpty();
2742        }
2743
2744        public boolean hasDocumentation() { 
2745          return this.documentation != null && !this.documentation.isEmpty();
2746        }
2747
2748        /**
2749         * @param value {@link #documentation} (Documentation for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
2750         */
2751        public StructureMapGroupRuleComponent setDocumentationElement(StringType value) { 
2752          this.documentation = value;
2753          return this;
2754        }
2755
2756        /**
2757         * @return Documentation for this instance of data.
2758         */
2759        public String getDocumentation() { 
2760          return this.documentation == null ? null : this.documentation.getValue();
2761        }
2762
2763        /**
2764         * @param value Documentation for this instance of data.
2765         */
2766        public StructureMapGroupRuleComponent setDocumentation(String value) { 
2767          if (Utilities.noString(value))
2768            this.documentation = null;
2769          else {
2770            if (this.documentation == null)
2771              this.documentation = new StringType();
2772            this.documentation.setValue(value);
2773          }
2774          return this;
2775        }
2776
2777        protected void listChildren(List<Property> children) {
2778          super.listChildren(children);
2779          children.add(new Property("name", "id", "Name of the rule for internal references.", 0, 1, name));
2780          children.add(new Property("source", "", "Source inputs to the mapping.", 0, java.lang.Integer.MAX_VALUE, source));
2781          children.add(new Property("target", "", "Content to create because of this mapping rule.", 0, java.lang.Integer.MAX_VALUE, target));
2782          children.add(new Property("rule", "@StructureMap.group.rule", "Rules contained in this rule.", 0, java.lang.Integer.MAX_VALUE, rule));
2783          children.add(new Property("dependent", "", "Which other rules to apply in the context of this rule.", 0, java.lang.Integer.MAX_VALUE, dependent));
2784          children.add(new Property("documentation", "string", "Documentation for this instance of data.", 0, 1, documentation));
2785        }
2786
2787        @Override
2788        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2789          switch (_hash) {
2790          case 3373707: /*name*/  return new Property("name", "id", "Name of the rule for internal references.", 0, 1, name);
2791          case -896505829: /*source*/  return new Property("source", "", "Source inputs to the mapping.", 0, java.lang.Integer.MAX_VALUE, source);
2792          case -880905839: /*target*/  return new Property("target", "", "Content to create because of this mapping rule.", 0, java.lang.Integer.MAX_VALUE, target);
2793          case 3512060: /*rule*/  return new Property("rule", "@StructureMap.group.rule", "Rules contained in this rule.", 0, java.lang.Integer.MAX_VALUE, rule);
2794          case -1109226753: /*dependent*/  return new Property("dependent", "", "Which other rules to apply in the context of this rule.", 0, java.lang.Integer.MAX_VALUE, dependent);
2795          case 1587405498: /*documentation*/  return new Property("documentation", "string", "Documentation for this instance of data.", 0, 1, documentation);
2796          default: return super.getNamedProperty(_hash, _name, _checkValid);
2797          }
2798
2799        }
2800
2801      @Override
2802      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2803        switch (hash) {
2804        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
2805        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // StructureMapGroupRuleSourceComponent
2806        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // StructureMapGroupRuleTargetComponent
2807        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // StructureMapGroupRuleComponent
2808        case -1109226753: /*dependent*/ return this.dependent == null ? new Base[0] : this.dependent.toArray(new Base[this.dependent.size()]); // StructureMapGroupRuleDependentComponent
2809        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
2810        default: return super.getProperty(hash, name, checkValid);
2811        }
2812
2813      }
2814
2815      @Override
2816      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2817        switch (hash) {
2818        case 3373707: // name
2819          this.name = castToId(value); // IdType
2820          return value;
2821        case -896505829: // source
2822          this.getSource().add((StructureMapGroupRuleSourceComponent) value); // StructureMapGroupRuleSourceComponent
2823          return value;
2824        case -880905839: // target
2825          this.getTarget().add((StructureMapGroupRuleTargetComponent) value); // StructureMapGroupRuleTargetComponent
2826          return value;
2827        case 3512060: // rule
2828          this.getRule().add((StructureMapGroupRuleComponent) value); // StructureMapGroupRuleComponent
2829          return value;
2830        case -1109226753: // dependent
2831          this.getDependent().add((StructureMapGroupRuleDependentComponent) value); // StructureMapGroupRuleDependentComponent
2832          return value;
2833        case 1587405498: // documentation
2834          this.documentation = castToString(value); // StringType
2835          return value;
2836        default: return super.setProperty(hash, name, value);
2837        }
2838
2839      }
2840
2841      @Override
2842      public Base setProperty(String name, Base value) throws FHIRException {
2843        if (name.equals("name")) {
2844          this.name = castToId(value); // IdType
2845        } else if (name.equals("source")) {
2846          this.getSource().add((StructureMapGroupRuleSourceComponent) value);
2847        } else if (name.equals("target")) {
2848          this.getTarget().add((StructureMapGroupRuleTargetComponent) value);
2849        } else if (name.equals("rule")) {
2850          this.getRule().add((StructureMapGroupRuleComponent) value);
2851        } else if (name.equals("dependent")) {
2852          this.getDependent().add((StructureMapGroupRuleDependentComponent) value);
2853        } else if (name.equals("documentation")) {
2854          this.documentation = castToString(value); // StringType
2855        } else
2856          return super.setProperty(name, value);
2857        return value;
2858      }
2859
2860      @Override
2861      public Base makeProperty(int hash, String name) throws FHIRException {
2862        switch (hash) {
2863        case 3373707:  return getNameElement();
2864        case -896505829:  return addSource(); 
2865        case -880905839:  return addTarget(); 
2866        case 3512060:  return addRule(); 
2867        case -1109226753:  return addDependent(); 
2868        case 1587405498:  return getDocumentationElement();
2869        default: return super.makeProperty(hash, name);
2870        }
2871
2872      }
2873
2874      @Override
2875      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2876        switch (hash) {
2877        case 3373707: /*name*/ return new String[] {"id"};
2878        case -896505829: /*source*/ return new String[] {};
2879        case -880905839: /*target*/ return new String[] {};
2880        case 3512060: /*rule*/ return new String[] {"@StructureMap.group.rule"};
2881        case -1109226753: /*dependent*/ return new String[] {};
2882        case 1587405498: /*documentation*/ return new String[] {"string"};
2883        default: return super.getTypesForProperty(hash, name);
2884        }
2885
2886      }
2887
2888      @Override
2889      public Base addChild(String name) throws FHIRException {
2890        if (name.equals("name")) {
2891          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
2892        }
2893        else if (name.equals("source")) {
2894          return addSource();
2895        }
2896        else if (name.equals("target")) {
2897          return addTarget();
2898        }
2899        else if (name.equals("rule")) {
2900          return addRule();
2901        }
2902        else if (name.equals("dependent")) {
2903          return addDependent();
2904        }
2905        else if (name.equals("documentation")) {
2906          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
2907        }
2908        else
2909          return super.addChild(name);
2910      }
2911
2912      public StructureMapGroupRuleComponent copy() {
2913        StructureMapGroupRuleComponent dst = new StructureMapGroupRuleComponent();
2914        copyValues(dst);
2915        dst.name = name == null ? null : name.copy();
2916        if (source != null) {
2917          dst.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2918          for (StructureMapGroupRuleSourceComponent i : source)
2919            dst.source.add(i.copy());
2920        };
2921        if (target != null) {
2922          dst.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2923          for (StructureMapGroupRuleTargetComponent i : target)
2924            dst.target.add(i.copy());
2925        };
2926        if (rule != null) {
2927          dst.rule = new ArrayList<StructureMapGroupRuleComponent>();
2928          for (StructureMapGroupRuleComponent i : rule)
2929            dst.rule.add(i.copy());
2930        };
2931        if (dependent != null) {
2932          dst.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2933          for (StructureMapGroupRuleDependentComponent i : dependent)
2934            dst.dependent.add(i.copy());
2935        };
2936        dst.documentation = documentation == null ? null : documentation.copy();
2937        return dst;
2938      }
2939
2940      @Override
2941      public boolean equalsDeep(Base other_) {
2942        if (!super.equalsDeep(other_))
2943          return false;
2944        if (!(other_ instanceof StructureMapGroupRuleComponent))
2945          return false;
2946        StructureMapGroupRuleComponent o = (StructureMapGroupRuleComponent) other_;
2947        return compareDeep(name, o.name, true) && compareDeep(source, o.source, true) && compareDeep(target, o.target, true)
2948           && compareDeep(rule, o.rule, true) && compareDeep(dependent, o.dependent, true) && compareDeep(documentation, o.documentation, true)
2949          ;
2950      }
2951
2952      @Override
2953      public boolean equalsShallow(Base other_) {
2954        if (!super.equalsShallow(other_))
2955          return false;
2956        if (!(other_ instanceof StructureMapGroupRuleComponent))
2957          return false;
2958        StructureMapGroupRuleComponent o = (StructureMapGroupRuleComponent) other_;
2959        return compareValues(name, o.name, true) && compareValues(documentation, o.documentation, true);
2960      }
2961
2962      public boolean isEmpty() {
2963        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, source, target, rule
2964          , dependent, documentation);
2965      }
2966
2967  public String fhirType() {
2968    return "StructureMap.group.rule";
2969
2970  }
2971
2972// added from java-adornments.txt:
2973
2974  public String toString() {
2975    return StructureMapUtilities.ruleToString(this);
2976  }
2977
2978
2979// end addition
2980  }
2981
2982    @Block()
2983    public static class StructureMapGroupRuleSourceComponent extends BackboneElement implements IBaseBackboneElement {
2984        /**
2985         * Type or variable this rule applies to.
2986         */
2987        @Child(name = "context", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2988        @Description(shortDefinition="Type or variable this rule applies to", formalDefinition="Type or variable this rule applies to." )
2989        protected IdType context;
2990
2991        /**
2992         * Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.
2993         */
2994        @Child(name = "min", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2995        @Description(shortDefinition="Specified minimum cardinality", formalDefinition="Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content." )
2996        protected IntegerType min;
2997
2998        /**
2999         * Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).
3000         */
3001        @Child(name = "max", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
3002        @Description(shortDefinition="Specified maximum cardinality (number or *)", formalDefinition="Specified maximum cardinality for the element - a number or a \"*\". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value)." )
3003        protected StringType max;
3004
3005        /**
3006         * Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.
3007         */
3008        @Child(name = "type", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3009        @Description(shortDefinition="Rule only applies if source has this type", formalDefinition="Specified type for the element. This works as a condition on the mapping - use for polymorphic elements." )
3010        protected StringType type;
3011
3012        /**
3013         * A value to use if there is no existing value in the source object.
3014         */
3015        @Child(name = "defaultValue", type = {}, order=5, min=0, max=1, modifier=false, summary=true)
3016        @Description(shortDefinition="Default value if no value exists", formalDefinition="A value to use if there is no existing value in the source object." )
3017        protected org.hl7.fhir.r4.model.Type defaultValue;
3018
3019        /**
3020         * Optional field for this source.
3021         */
3022        @Child(name = "element", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
3023        @Description(shortDefinition="Optional field for this source", formalDefinition="Optional field for this source." )
3024        protected StringType element;
3025
3026        /**
3027         * How to handle the list mode for this element.
3028         */
3029        @Child(name = "listMode", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
3030        @Description(shortDefinition="first | not_first | last | not_last | only_one", formalDefinition="How to handle the list mode for this element." )
3031        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-source-list-mode")
3032        protected Enumeration<StructureMapSourceListMode> listMode;
3033
3034        /**
3035         * Named context for field, if a field is specified.
3036         */
3037        @Child(name = "variable", type = {IdType.class}, order=8, min=0, max=1, modifier=false, summary=true)
3038        @Description(shortDefinition="Named context for field, if a field is specified", formalDefinition="Named context for field, if a field is specified." )
3039        protected IdType variable;
3040
3041        /**
3042         * FHIRPath expression  - must be true or the rule does not apply.
3043         */
3044        @Child(name = "condition", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
3045        @Description(shortDefinition="FHIRPath expression  - must be true or the rule does not apply", formalDefinition="FHIRPath expression  - must be true or the rule does not apply." )
3046        protected StringType condition;
3047
3048        /**
3049         * FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.
3050         */
3051        @Child(name = "check", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
3052        @Description(shortDefinition="FHIRPath expression  - must be true or the mapping engine throws an error instead of completing", formalDefinition="FHIRPath expression  - must be true or the mapping engine throws an error instead of completing." )
3053        protected StringType check;
3054
3055        private static final long serialVersionUID = -878842729L;
3056
3057    /**
3058     * Constructor
3059     */
3060      public StructureMapGroupRuleSourceComponent() {
3061        super();
3062      }
3063
3064    /**
3065     * Constructor
3066     */
3067      public StructureMapGroupRuleSourceComponent(IdType context) {
3068        super();
3069        this.context = context;
3070      }
3071
3072        /**
3073         * @return {@link #context} (Type or variable this rule applies to.). This is the underlying object with id, value and extensions. The accessor "getContext" gives direct access to the value
3074         */
3075        public IdType getContextElement() { 
3076          if (this.context == null)
3077            if (Configuration.errorOnAutoCreate())
3078              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.context");
3079            else if (Configuration.doAutoCreate())
3080              this.context = new IdType(); // bb
3081          return this.context;
3082        }
3083
3084        public boolean hasContextElement() { 
3085          return this.context != null && !this.context.isEmpty();
3086        }
3087
3088        public boolean hasContext() { 
3089          return this.context != null && !this.context.isEmpty();
3090        }
3091
3092        /**
3093         * @param value {@link #context} (Type or variable this rule applies to.). This is the underlying object with id, value and extensions. The accessor "getContext" gives direct access to the value
3094         */
3095        public StructureMapGroupRuleSourceComponent setContextElement(IdType value) { 
3096          this.context = value;
3097          return this;
3098        }
3099
3100        /**
3101         * @return Type or variable this rule applies to.
3102         */
3103        public String getContext() { 
3104          return this.context == null ? null : this.context.getValue();
3105        }
3106
3107        /**
3108         * @param value Type or variable this rule applies to.
3109         */
3110        public StructureMapGroupRuleSourceComponent setContext(String value) { 
3111            if (this.context == null)
3112              this.context = new IdType();
3113            this.context.setValue(value);
3114          return this;
3115        }
3116
3117        /**
3118         * @return {@link #min} (Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
3119         */
3120        public IntegerType getMinElement() { 
3121          if (this.min == null)
3122            if (Configuration.errorOnAutoCreate())
3123              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.min");
3124            else if (Configuration.doAutoCreate())
3125              this.min = new IntegerType(); // bb
3126          return this.min;
3127        }
3128
3129        public boolean hasMinElement() { 
3130          return this.min != null && !this.min.isEmpty();
3131        }
3132
3133        public boolean hasMin() { 
3134          return this.min != null && !this.min.isEmpty();
3135        }
3136
3137        /**
3138         * @param value {@link #min} (Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
3139         */
3140        public StructureMapGroupRuleSourceComponent setMinElement(IntegerType value) { 
3141          this.min = value;
3142          return this;
3143        }
3144
3145        /**
3146         * @return Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.
3147         */
3148        public int getMin() { 
3149          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
3150        }
3151
3152        /**
3153         * @param value Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.
3154         */
3155        public StructureMapGroupRuleSourceComponent setMin(int value) { 
3156            if (this.min == null)
3157              this.min = new IntegerType();
3158            this.min.setValue(value);
3159          return this;
3160        }
3161
3162        /**
3163         * @return {@link #max} (Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
3164         */
3165        public StringType getMaxElement() { 
3166          if (this.max == null)
3167            if (Configuration.errorOnAutoCreate())
3168              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.max");
3169            else if (Configuration.doAutoCreate())
3170              this.max = new StringType(); // bb
3171          return this.max;
3172        }
3173
3174        public boolean hasMaxElement() { 
3175          return this.max != null && !this.max.isEmpty();
3176        }
3177
3178        public boolean hasMax() { 
3179          return this.max != null && !this.max.isEmpty();
3180        }
3181
3182        /**
3183         * @param value {@link #max} (Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
3184         */
3185        public StructureMapGroupRuleSourceComponent setMaxElement(StringType value) { 
3186          this.max = value;
3187          return this;
3188        }
3189
3190        /**
3191         * @return Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).
3192         */
3193        public String getMax() { 
3194          return this.max == null ? null : this.max.getValue();
3195        }
3196
3197        /**
3198         * @param value Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).
3199         */
3200        public StructureMapGroupRuleSourceComponent setMax(String value) { 
3201          if (Utilities.noString(value))
3202            this.max = null;
3203          else {
3204            if (this.max == null)
3205              this.max = new StringType();
3206            this.max.setValue(value);
3207          }
3208          return this;
3209        }
3210
3211        /**
3212         * @return {@link #type} (Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
3213         */
3214        public StringType getTypeElement() { 
3215          if (this.type == null)
3216            if (Configuration.errorOnAutoCreate())
3217              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.type");
3218            else if (Configuration.doAutoCreate())
3219              this.type = new StringType(); // bb
3220          return this.type;
3221        }
3222
3223        public boolean hasTypeElement() { 
3224          return this.type != null && !this.type.isEmpty();
3225        }
3226
3227        public boolean hasType() { 
3228          return this.type != null && !this.type.isEmpty();
3229        }
3230
3231        /**
3232         * @param value {@link #type} (Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
3233         */
3234        public StructureMapGroupRuleSourceComponent setTypeElement(StringType value) { 
3235          this.type = value;
3236          return this;
3237        }
3238
3239        /**
3240         * @return Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.
3241         */
3242        public String getType() { 
3243          return this.type == null ? null : this.type.getValue();
3244        }
3245
3246        /**
3247         * @param value Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.
3248         */
3249        public StructureMapGroupRuleSourceComponent setType(String value) { 
3250          if (Utilities.noString(value))
3251            this.type = null;
3252          else {
3253            if (this.type == null)
3254              this.type = new StringType();
3255            this.type.setValue(value);
3256          }
3257          return this;
3258        }
3259
3260        /**
3261         * @return {@link #defaultValue} (A value to use if there is no existing value in the source object.)
3262         */
3263        public org.hl7.fhir.r4.model.Type getDefaultValue() { 
3264          return this.defaultValue;
3265        }
3266
3267        public boolean hasDefaultValue() { 
3268          return this.defaultValue != null && !this.defaultValue.isEmpty();
3269        }
3270
3271        /**
3272         * @param value {@link #defaultValue} (A value to use if there is no existing value in the source object.)
3273         */
3274        public StructureMapGroupRuleSourceComponent setDefaultValue(org.hl7.fhir.r4.model.Type value) { 
3275          this.defaultValue = value;
3276          return this;
3277        }
3278
3279        /**
3280         * @return {@link #element} (Optional field for this source.). This is the underlying object with id, value and extensions. The accessor "getElement" gives direct access to the value
3281         */
3282        public StringType getElementElement() { 
3283          if (this.element == null)
3284            if (Configuration.errorOnAutoCreate())
3285              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.element");
3286            else if (Configuration.doAutoCreate())
3287              this.element = new StringType(); // bb
3288          return this.element;
3289        }
3290
3291        public boolean hasElementElement() { 
3292          return this.element != null && !this.element.isEmpty();
3293        }
3294
3295        public boolean hasElement() { 
3296          return this.element != null && !this.element.isEmpty();
3297        }
3298
3299        /**
3300         * @param value {@link #element} (Optional field for this source.). This is the underlying object with id, value and extensions. The accessor "getElement" gives direct access to the value
3301         */
3302        public StructureMapGroupRuleSourceComponent setElementElement(StringType value) { 
3303          this.element = value;
3304          return this;
3305        }
3306
3307        /**
3308         * @return Optional field for this source.
3309         */
3310        public String getElement() { 
3311          return this.element == null ? null : this.element.getValue();
3312        }
3313
3314        /**
3315         * @param value Optional field for this source.
3316         */
3317        public StructureMapGroupRuleSourceComponent setElement(String value) { 
3318          if (Utilities.noString(value))
3319            this.element = null;
3320          else {
3321            if (this.element == null)
3322              this.element = new StringType();
3323            this.element.setValue(value);
3324          }
3325          return this;
3326        }
3327
3328        /**
3329         * @return {@link #listMode} (How to handle the list mode for this element.). This is the underlying object with id, value and extensions. The accessor "getListMode" gives direct access to the value
3330         */
3331        public Enumeration<StructureMapSourceListMode> getListModeElement() { 
3332          if (this.listMode == null)
3333            if (Configuration.errorOnAutoCreate())
3334              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.listMode");
3335            else if (Configuration.doAutoCreate())
3336              this.listMode = new Enumeration<StructureMapSourceListMode>(new StructureMapSourceListModeEnumFactory()); // bb
3337          return this.listMode;
3338        }
3339
3340        public boolean hasListModeElement() { 
3341          return this.listMode != null && !this.listMode.isEmpty();
3342        }
3343
3344        public boolean hasListMode() { 
3345          return this.listMode != null && !this.listMode.isEmpty();
3346        }
3347
3348        /**
3349         * @param value {@link #listMode} (How to handle the list mode for this element.). This is the underlying object with id, value and extensions. The accessor "getListMode" gives direct access to the value
3350         */
3351        public StructureMapGroupRuleSourceComponent setListModeElement(Enumeration<StructureMapSourceListMode> value) { 
3352          this.listMode = value;
3353          return this;
3354        }
3355
3356        /**
3357         * @return How to handle the list mode for this element.
3358         */
3359        public StructureMapSourceListMode getListMode() { 
3360          return this.listMode == null ? null : this.listMode.getValue();
3361        }
3362
3363        /**
3364         * @param value How to handle the list mode for this element.
3365         */
3366        public StructureMapGroupRuleSourceComponent setListMode(StructureMapSourceListMode value) { 
3367          if (value == null)
3368            this.listMode = null;
3369          else {
3370            if (this.listMode == null)
3371              this.listMode = new Enumeration<StructureMapSourceListMode>(new StructureMapSourceListModeEnumFactory());
3372            this.listMode.setValue(value);
3373          }
3374          return this;
3375        }
3376
3377        /**
3378         * @return {@link #variable} (Named context for field, if a field is specified.). This is the underlying object with id, value and extensions. The accessor "getVariable" gives direct access to the value
3379         */
3380        public IdType getVariableElement() { 
3381          if (this.variable == null)
3382            if (Configuration.errorOnAutoCreate())
3383              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.variable");
3384            else if (Configuration.doAutoCreate())
3385              this.variable = new IdType(); // bb
3386          return this.variable;
3387        }
3388
3389        public boolean hasVariableElement() { 
3390          return this.variable != null && !this.variable.isEmpty();
3391        }
3392
3393        public boolean hasVariable() { 
3394          return this.variable != null && !this.variable.isEmpty();
3395        }
3396
3397        /**
3398         * @param value {@link #variable} (Named context for field, if a field is specified.). This is the underlying object with id, value and extensions. The accessor "getVariable" gives direct access to the value
3399         */
3400        public StructureMapGroupRuleSourceComponent setVariableElement(IdType value) { 
3401          this.variable = value;
3402          return this;
3403        }
3404
3405        /**
3406         * @return Named context for field, if a field is specified.
3407         */
3408        public String getVariable() { 
3409          return this.variable == null ? null : this.variable.getValue();
3410        }
3411
3412        /**
3413         * @param value Named context for field, if a field is specified.
3414         */
3415        public StructureMapGroupRuleSourceComponent setVariable(String value) { 
3416          if (Utilities.noString(value))
3417            this.variable = null;
3418          else {
3419            if (this.variable == null)
3420              this.variable = new IdType();
3421            this.variable.setValue(value);
3422          }
3423          return this;
3424        }
3425
3426        /**
3427         * @return {@link #condition} (FHIRPath expression  - must be true or the rule does not apply.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
3428         */
3429        public StringType getConditionElement() { 
3430          if (this.condition == null)
3431            if (Configuration.errorOnAutoCreate())
3432              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.condition");
3433            else if (Configuration.doAutoCreate())
3434              this.condition = new StringType(); // bb
3435          return this.condition;
3436        }
3437
3438        public boolean hasConditionElement() { 
3439          return this.condition != null && !this.condition.isEmpty();
3440        }
3441
3442        public boolean hasCondition() { 
3443          return this.condition != null && !this.condition.isEmpty();
3444        }
3445
3446        /**
3447         * @param value {@link #condition} (FHIRPath expression  - must be true or the rule does not apply.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
3448         */
3449        public StructureMapGroupRuleSourceComponent setConditionElement(StringType value) { 
3450          this.condition = value;
3451          return this;
3452        }
3453
3454        /**
3455         * @return FHIRPath expression  - must be true or the rule does not apply.
3456         */
3457        public String getCondition() { 
3458          return this.condition == null ? null : this.condition.getValue();
3459        }
3460
3461        /**
3462         * @param value FHIRPath expression  - must be true or the rule does not apply.
3463         */
3464        public StructureMapGroupRuleSourceComponent setCondition(String value) { 
3465          if (Utilities.noString(value))
3466            this.condition = null;
3467          else {
3468            if (this.condition == null)
3469              this.condition = new StringType();
3470            this.condition.setValue(value);
3471          }
3472          return this;
3473        }
3474
3475        /**
3476         * @return {@link #check} (FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.). This is the underlying object with id, value and extensions. The accessor "getCheck" gives direct access to the value
3477         */
3478        public StringType getCheckElement() { 
3479          if (this.check == null)
3480            if (Configuration.errorOnAutoCreate())
3481              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.check");
3482            else if (Configuration.doAutoCreate())
3483              this.check = new StringType(); // bb
3484          return this.check;
3485        }
3486
3487        public boolean hasCheckElement() { 
3488          return this.check != null && !this.check.isEmpty();
3489        }
3490
3491        public boolean hasCheck() { 
3492          return this.check != null && !this.check.isEmpty();
3493        }
3494
3495        /**
3496         * @param value {@link #check} (FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.). This is the underlying object with id, value and extensions. The accessor "getCheck" gives direct access to the value
3497         */
3498        public StructureMapGroupRuleSourceComponent setCheckElement(StringType value) { 
3499          this.check = value;
3500          return this;
3501        }
3502
3503        /**
3504         * @return FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.
3505         */
3506        public String getCheck() { 
3507          return this.check == null ? null : this.check.getValue();
3508        }
3509
3510        /**
3511         * @param value FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.
3512         */
3513        public StructureMapGroupRuleSourceComponent setCheck(String value) { 
3514          if (Utilities.noString(value))
3515            this.check = null;
3516          else {
3517            if (this.check == null)
3518              this.check = new StringType();
3519            this.check.setValue(value);
3520          }
3521          return this;
3522        }
3523
3524        protected void listChildren(List<Property> children) {
3525          super.listChildren(children);
3526          children.add(new Property("context", "id", "Type or variable this rule applies to.", 0, 1, context));
3527          children.add(new Property("min", "integer", "Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.", 0, 1, min));
3528          children.add(new Property("max", "string", "Specified maximum cardinality for the element - a number or a \"*\". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).", 0, 1, max));
3529          children.add(new Property("type", "string", "Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.", 0, 1, type));
3530          children.add(new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue));
3531          children.add(new Property("element", "string", "Optional field for this source.", 0, 1, element));
3532          children.add(new Property("listMode", "code", "How to handle the list mode for this element.", 0, 1, listMode));
3533          children.add(new Property("variable", "id", "Named context for field, if a field is specified.", 0, 1, variable));
3534          children.add(new Property("condition", "string", "FHIRPath expression  - must be true or the rule does not apply.", 0, 1, condition));
3535          children.add(new Property("check", "string", "FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.", 0, 1, check));
3536        }
3537
3538        @Override
3539        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3540          switch (_hash) {
3541          case 951530927: /*context*/  return new Property("context", "id", "Type or variable this rule applies to.", 0, 1, context);
3542          case 108114: /*min*/  return new Property("min", "integer", "Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.", 0, 1, min);
3543          case 107876: /*max*/  return new Property("max", "string", "Specified maximum cardinality for the element - a number or a \"*\". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).", 0, 1, max);
3544          case 3575610: /*type*/  return new Property("type", "string", "Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.", 0, 1, type);
3545          case 587922128: /*defaultValue[x]*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3546          case -659125328: /*defaultValue*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3547          case 1470297600: /*defaultValueBase64Binary*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3548          case 600437336: /*defaultValueBoolean*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3549          case 264593188: /*defaultValueCanonical*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3550          case 1044993469: /*defaultValueCode*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3551          case 1045010302: /*defaultValueDate*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3552          case 1220374379: /*defaultValueDateTime*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3553          case 2077989249: /*defaultValueDecimal*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3554          case -2059245333: /*defaultValueId*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3555          case -1801671663: /*defaultValueInstant*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3556          case -1801189522: /*defaultValueInteger*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3557          case -325436225: /*defaultValueMarkdown*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3558          case 587910138: /*defaultValueOid*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3559          case -737344154: /*defaultValuePositiveInt*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3560          case -320515103: /*defaultValueString*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3561          case 1045494429: /*defaultValueTime*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3562          case 539117290: /*defaultValueUnsignedInt*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3563          case 587916188: /*defaultValueUri*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3564          case 587916191: /*defaultValueUrl*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3565          case 1045535627: /*defaultValueUuid*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3566          case -611966428: /*defaultValueAddress*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3567          case -1851689217: /*defaultValueAnnotation*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3568          case 2034820339: /*defaultValueAttachment*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3569          case -410434095: /*defaultValueCodeableConcept*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3570          case -783616198: /*defaultValueCoding*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3571          case -344740576: /*defaultValueContactPoint*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3572          case -975393912: /*defaultValueHumanName*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3573          case -1915078535: /*defaultValueIdentifier*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3574          case -420255343: /*defaultValuePeriod*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3575          case -1857379237: /*defaultValueQuantity*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3576          case -1951495315: /*defaultValueRange*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3577          case -1951489477: /*defaultValueRatio*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3578          case -1488914053: /*defaultValueReference*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3579          case -449641228: /*defaultValueSampledData*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3580          case 509825768: /*defaultValueSignature*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3581          case -302193638: /*defaultValueTiming*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3582          case -754548089: /*defaultValueDosage*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3583          case -1662836996: /*element*/  return new Property("element", "string", "Optional field for this source.", 0, 1, element);
3584          case 1345445729: /*listMode*/  return new Property("listMode", "code", "How to handle the list mode for this element.", 0, 1, listMode);
3585          case -1249586564: /*variable*/  return new Property("variable", "id", "Named context for field, if a field is specified.", 0, 1, variable);
3586          case -861311717: /*condition*/  return new Property("condition", "string", "FHIRPath expression  - must be true or the rule does not apply.", 0, 1, condition);
3587          case 94627080: /*check*/  return new Property("check", "string", "FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.", 0, 1, check);
3588          default: return super.getNamedProperty(_hash, _name, _checkValid);
3589          }
3590
3591        }
3592
3593      @Override
3594      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3595        switch (hash) {
3596        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // IdType
3597        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // IntegerType
3598        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
3599        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // StringType
3600        case -659125328: /*defaultValue*/ return this.defaultValue == null ? new Base[0] : new Base[] {this.defaultValue}; // org.hl7.fhir.r4.model.Type
3601        case -1662836996: /*element*/ return this.element == null ? new Base[0] : new Base[] {this.element}; // StringType
3602        case 1345445729: /*listMode*/ return this.listMode == null ? new Base[0] : new Base[] {this.listMode}; // Enumeration<StructureMapSourceListMode>
3603        case -1249586564: /*variable*/ return this.variable == null ? new Base[0] : new Base[] {this.variable}; // IdType
3604        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // StringType
3605        case 94627080: /*check*/ return this.check == null ? new Base[0] : new Base[] {this.check}; // StringType
3606        default: return super.getProperty(hash, name, checkValid);
3607        }
3608
3609      }
3610
3611      @Override
3612      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3613        switch (hash) {
3614        case 951530927: // context
3615          this.context = castToId(value); // IdType
3616          return value;
3617        case 108114: // min
3618          this.min = castToInteger(value); // IntegerType
3619          return value;
3620        case 107876: // max
3621          this.max = castToString(value); // StringType
3622          return value;
3623        case 3575610: // type
3624          this.type = castToString(value); // StringType
3625          return value;
3626        case -659125328: // defaultValue
3627          this.defaultValue = castToType(value); // org.hl7.fhir.r4.model.Type
3628          return value;
3629        case -1662836996: // element
3630          this.element = castToString(value); // StringType
3631          return value;
3632        case 1345445729: // listMode
3633          value = new StructureMapSourceListModeEnumFactory().fromType(castToCode(value));
3634          this.listMode = (Enumeration) value; // Enumeration<StructureMapSourceListMode>
3635          return value;
3636        case -1249586564: // variable
3637          this.variable = castToId(value); // IdType
3638          return value;
3639        case -861311717: // condition
3640          this.condition = castToString(value); // StringType
3641          return value;
3642        case 94627080: // check
3643          this.check = castToString(value); // StringType
3644          return value;
3645        default: return super.setProperty(hash, name, value);
3646        }
3647
3648      }
3649
3650      @Override
3651      public Base setProperty(String name, Base value) throws FHIRException {
3652        if (name.equals("context")) {
3653          this.context = castToId(value); // IdType
3654        } else if (name.equals("min")) {
3655          this.min = castToInteger(value); // IntegerType
3656        } else if (name.equals("max")) {
3657          this.max = castToString(value); // StringType
3658        } else if (name.equals("type")) {
3659          this.type = castToString(value); // StringType
3660        } else if (name.equals("defaultValue[x]")) {
3661          this.defaultValue = castToType(value); // org.hl7.fhir.r4.model.Type
3662        } else if (name.equals("element")) {
3663          this.element = castToString(value); // StringType
3664        } else if (name.equals("listMode")) {
3665          value = new StructureMapSourceListModeEnumFactory().fromType(castToCode(value));
3666          this.listMode = (Enumeration) value; // Enumeration<StructureMapSourceListMode>
3667        } else if (name.equals("variable")) {
3668          this.variable = castToId(value); // IdType
3669        } else if (name.equals("condition")) {
3670          this.condition = castToString(value); // StringType
3671        } else if (name.equals("check")) {
3672          this.check = castToString(value); // StringType
3673        } else
3674          return super.setProperty(name, value);
3675        return value;
3676      }
3677
3678      @Override
3679      public Base makeProperty(int hash, String name) throws FHIRException {
3680        switch (hash) {
3681        case 951530927:  return getContextElement();
3682        case 108114:  return getMinElement();
3683        case 107876:  return getMaxElement();
3684        case 3575610:  return getTypeElement();
3685        case 587922128:  return getDefaultValue(); 
3686        case -659125328:  return getDefaultValue(); 
3687        case -1662836996:  return getElementElement();
3688        case 1345445729:  return getListModeElement();
3689        case -1249586564:  return getVariableElement();
3690        case -861311717:  return getConditionElement();
3691        case 94627080:  return getCheckElement();
3692        default: return super.makeProperty(hash, name);
3693        }
3694
3695      }
3696
3697      @Override
3698      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3699        switch (hash) {
3700        case 951530927: /*context*/ return new String[] {"id"};
3701        case 108114: /*min*/ return new String[] {"integer"};
3702        case 107876: /*max*/ return new String[] {"string"};
3703        case 3575610: /*type*/ return new String[] {"string"};
3704        case -659125328: /*defaultValue*/ return new String[] {"*"};
3705        case -1662836996: /*element*/ return new String[] {"string"};
3706        case 1345445729: /*listMode*/ return new String[] {"code"};
3707        case -1249586564: /*variable*/ return new String[] {"id"};
3708        case -861311717: /*condition*/ return new String[] {"string"};
3709        case 94627080: /*check*/ return new String[] {"string"};
3710        default: return super.getTypesForProperty(hash, name);
3711        }
3712
3713      }
3714
3715      @Override
3716      public Base addChild(String name) throws FHIRException {
3717        if (name.equals("context")) {
3718          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.context");
3719        }
3720        else if (name.equals("min")) {
3721          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.min");
3722        }
3723        else if (name.equals("max")) {
3724          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.max");
3725        }
3726        else if (name.equals("type")) {
3727          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.type");
3728        }
3729        else if (name.equals("defaultValueBase64Binary")) {
3730          this.defaultValue = new Base64BinaryType();
3731          return this.defaultValue;
3732        }
3733        else if (name.equals("defaultValueBoolean")) {
3734          this.defaultValue = new BooleanType();
3735          return this.defaultValue;
3736        }
3737        else if (name.equals("defaultValueCanonical")) {
3738          this.defaultValue = new CanonicalType();
3739          return this.defaultValue;
3740        }
3741        else if (name.equals("defaultValueCode")) {
3742          this.defaultValue = new CodeType();
3743          return this.defaultValue;
3744        }
3745        else if (name.equals("defaultValueDate")) {
3746          this.defaultValue = new DateType();
3747          return this.defaultValue;
3748        }
3749        else if (name.equals("defaultValueDateTime")) {
3750          this.defaultValue = new DateTimeType();
3751          return this.defaultValue;
3752        }
3753        else if (name.equals("defaultValueDecimal")) {
3754          this.defaultValue = new DecimalType();
3755          return this.defaultValue;
3756        }
3757        else if (name.equals("defaultValueId")) {
3758          this.defaultValue = new IdType();
3759          return this.defaultValue;
3760        }
3761        else if (name.equals("defaultValueInstant")) {
3762          this.defaultValue = new InstantType();
3763          return this.defaultValue;
3764        }
3765        else if (name.equals("defaultValueInteger")) {
3766          this.defaultValue = new IntegerType();
3767          return this.defaultValue;
3768        }
3769        else if (name.equals("defaultValueMarkdown")) {
3770          this.defaultValue = new MarkdownType();
3771          return this.defaultValue;
3772        }
3773        else if (name.equals("defaultValueOid")) {
3774          this.defaultValue = new OidType();
3775          return this.defaultValue;
3776        }
3777        else if (name.equals("defaultValuePositiveInt")) {
3778          this.defaultValue = new PositiveIntType();
3779          return this.defaultValue;
3780        }
3781        else if (name.equals("defaultValueString")) {
3782          this.defaultValue = new StringType();
3783          return this.defaultValue;
3784        }
3785        else if (name.equals("defaultValueTime")) {
3786          this.defaultValue = new TimeType();
3787          return this.defaultValue;
3788        }
3789        else if (name.equals("defaultValueUnsignedInt")) {
3790          this.defaultValue = new UnsignedIntType();
3791          return this.defaultValue;
3792        }
3793        else if (name.equals("defaultValueUri")) {
3794          this.defaultValue = new UriType();
3795          return this.defaultValue;
3796        }
3797        else if (name.equals("defaultValueUrl")) {
3798          this.defaultValue = new UrlType();
3799          return this.defaultValue;
3800        }
3801        else if (name.equals("defaultValueUuid")) {
3802          this.defaultValue = new UuidType();
3803          return this.defaultValue;
3804        }
3805        else if (name.equals("defaultValueAddress")) {
3806          this.defaultValue = new Address();
3807          return this.defaultValue;
3808        }
3809        else if (name.equals("defaultValueAge")) {
3810          this.defaultValue = new Age();
3811          return this.defaultValue;
3812        }
3813        else if (name.equals("defaultValueAnnotation")) {
3814          this.defaultValue = new Annotation();
3815          return this.defaultValue;
3816        }
3817        else if (name.equals("defaultValueAttachment")) {
3818          this.defaultValue = new Attachment();
3819          return this.defaultValue;
3820        }
3821        else if (name.equals("defaultValueCodeableConcept")) {
3822          this.defaultValue = new CodeableConcept();
3823          return this.defaultValue;
3824        }
3825        else if (name.equals("defaultValueCoding")) {
3826          this.defaultValue = new Coding();
3827          return this.defaultValue;
3828        }
3829        else if (name.equals("defaultValueContactPoint")) {
3830          this.defaultValue = new ContactPoint();
3831          return this.defaultValue;
3832        }
3833        else if (name.equals("defaultValueCount")) {
3834          this.defaultValue = new Count();
3835          return this.defaultValue;
3836        }
3837        else if (name.equals("defaultValueDistance")) {
3838          this.defaultValue = new Distance();
3839          return this.defaultValue;
3840        }
3841        else if (name.equals("defaultValueDuration")) {
3842          this.defaultValue = new Duration();
3843          return this.defaultValue;
3844        }
3845        else if (name.equals("defaultValueHumanName")) {
3846          this.defaultValue = new HumanName();
3847          return this.defaultValue;
3848        }
3849        else if (name.equals("defaultValueIdentifier")) {
3850          this.defaultValue = new Identifier();
3851          return this.defaultValue;
3852        }
3853        else if (name.equals("defaultValueMoney")) {
3854          this.defaultValue = new Money();
3855          return this.defaultValue;
3856        }
3857        else if (name.equals("defaultValuePeriod")) {
3858          this.defaultValue = new Period();
3859          return this.defaultValue;
3860        }
3861        else if (name.equals("defaultValueQuantity")) {
3862          this.defaultValue = new Quantity();
3863          return this.defaultValue;
3864        }
3865        else if (name.equals("defaultValueRange")) {
3866          this.defaultValue = new Range();
3867          return this.defaultValue;
3868        }
3869        else if (name.equals("defaultValueRatio")) {
3870          this.defaultValue = new Ratio();
3871          return this.defaultValue;
3872        }
3873        else if (name.equals("defaultValueReference")) {
3874          this.defaultValue = new Reference();
3875          return this.defaultValue;
3876        }
3877        else if (name.equals("defaultValueSampledData")) {
3878          this.defaultValue = new SampledData();
3879          return this.defaultValue;
3880        }
3881        else if (name.equals("defaultValueSignature")) {
3882          this.defaultValue = new Signature();
3883          return this.defaultValue;
3884        }
3885        else if (name.equals("defaultValueTiming")) {
3886          this.defaultValue = new Timing();
3887          return this.defaultValue;
3888        }
3889        else if (name.equals("defaultValueParameterDefinition")) {
3890          this.defaultValue = new ParameterDefinition();
3891          return this.defaultValue;
3892        }
3893        else if (name.equals("defaultValueDataRequirement")) {
3894          this.defaultValue = new DataRequirement();
3895          return this.defaultValue;
3896        }
3897        else if (name.equals("defaultValueRelatedArtifact")) {
3898          this.defaultValue = new RelatedArtifact();
3899          return this.defaultValue;
3900        }
3901        else if (name.equals("defaultValueContactDetail")) {
3902          this.defaultValue = new ContactDetail();
3903          return this.defaultValue;
3904        }
3905        else if (name.equals("defaultValueContributor")) {
3906          this.defaultValue = new Contributor();
3907          return this.defaultValue;
3908        }
3909        else if (name.equals("defaultValueTriggerDefinition")) {
3910          this.defaultValue = new TriggerDefinition();
3911          return this.defaultValue;
3912        }
3913        else if (name.equals("defaultValueUsageContext")) {
3914          this.defaultValue = new UsageContext();
3915          return this.defaultValue;
3916        }
3917        else if (name.equals("defaultValueDosage")) {
3918          this.defaultValue = new Dosage();
3919          return this.defaultValue;
3920        }
3921        else if (name.equals("element")) {
3922          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.element");
3923        }
3924        else if (name.equals("listMode")) {
3925          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.listMode");
3926        }
3927        else if (name.equals("variable")) {
3928          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.variable");
3929        }
3930        else if (name.equals("condition")) {
3931          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.condition");
3932        }
3933        else if (name.equals("check")) {
3934          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.check");
3935        }
3936        else
3937          return super.addChild(name);
3938      }
3939
3940      public StructureMapGroupRuleSourceComponent copy() {
3941        StructureMapGroupRuleSourceComponent dst = new StructureMapGroupRuleSourceComponent();
3942        copyValues(dst);
3943        dst.context = context == null ? null : context.copy();
3944        dst.min = min == null ? null : min.copy();
3945        dst.max = max == null ? null : max.copy();
3946        dst.type = type == null ? null : type.copy();
3947        dst.defaultValue = defaultValue == null ? null : defaultValue.copy();
3948        dst.element = element == null ? null : element.copy();
3949        dst.listMode = listMode == null ? null : listMode.copy();
3950        dst.variable = variable == null ? null : variable.copy();
3951        dst.condition = condition == null ? null : condition.copy();
3952        dst.check = check == null ? null : check.copy();
3953        return dst;
3954      }
3955
3956      @Override
3957      public boolean equalsDeep(Base other_) {
3958        if (!super.equalsDeep(other_))
3959          return false;
3960        if (!(other_ instanceof StructureMapGroupRuleSourceComponent))
3961          return false;
3962        StructureMapGroupRuleSourceComponent o = (StructureMapGroupRuleSourceComponent) other_;
3963        return compareDeep(context, o.context, true) && compareDeep(min, o.min, true) && compareDeep(max, o.max, true)
3964           && compareDeep(type, o.type, true) && compareDeep(defaultValue, o.defaultValue, true) && compareDeep(element, o.element, true)
3965           && compareDeep(listMode, o.listMode, true) && compareDeep(variable, o.variable, true) && compareDeep(condition, o.condition, true)
3966           && compareDeep(check, o.check, true);
3967      }
3968
3969      @Override
3970      public boolean equalsShallow(Base other_) {
3971        if (!super.equalsShallow(other_))
3972          return false;
3973        if (!(other_ instanceof StructureMapGroupRuleSourceComponent))
3974          return false;
3975        StructureMapGroupRuleSourceComponent o = (StructureMapGroupRuleSourceComponent) other_;
3976        return compareValues(context, o.context, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
3977           && compareValues(type, o.type, true) && compareValues(element, o.element, true) && compareValues(listMode, o.listMode, true)
3978           && compareValues(variable, o.variable, true) && compareValues(condition, o.condition, true) && compareValues(check, o.check, true)
3979          ;
3980      }
3981
3982      public boolean isEmpty() {
3983        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(context, min, max, type
3984          , defaultValue, element, listMode, variable, condition, check);
3985      }
3986
3987  public String fhirType() {
3988    return "StructureMap.group.rule.source";
3989
3990  }
3991
3992// added from java-adornments.txt:
3993
3994  public String toString() {
3995    return StructureMapUtilities.sourceToString(this);
3996  }
3997
3998
3999// end addition
4000  }
4001
4002    @Block()
4003    public static class StructureMapGroupRuleTargetComponent extends BackboneElement implements IBaseBackboneElement {
4004        /**
4005         * Type or variable this rule applies to.
4006         */
4007        @Child(name = "context", type = {IdType.class}, order=1, min=0, max=1, modifier=false, summary=true)
4008        @Description(shortDefinition="Type or variable this rule applies to", formalDefinition="Type or variable this rule applies to." )
4009        protected IdType context;
4010
4011        /**
4012         * How to interpret the context.
4013         */
4014        @Child(name = "contextType", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
4015        @Description(shortDefinition="type | variable", formalDefinition="How to interpret the context." )
4016        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-context-type")
4017        protected Enumeration<StructureMapContextType> contextType;
4018
4019        /**
4020         * Field to create in the context.
4021         */
4022        @Child(name = "element", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
4023        @Description(shortDefinition="Field to create in the context", formalDefinition="Field to create in the context." )
4024        protected StringType element;
4025
4026        /**
4027         * Named context for field, if desired, and a field is specified.
4028         */
4029        @Child(name = "variable", type = {IdType.class}, order=4, min=0, max=1, modifier=false, summary=true)
4030        @Description(shortDefinition="Named context for field, if desired, and a field is specified", formalDefinition="Named context for field, if desired, and a field is specified." )
4031        protected IdType variable;
4032
4033        /**
4034         * If field is a list, how to manage the list.
4035         */
4036        @Child(name = "listMode", type = {CodeType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4037        @Description(shortDefinition="first | share | last | collate", formalDefinition="If field is a list, how to manage the list." )
4038        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-target-list-mode")
4039        protected List<Enumeration<StructureMapTargetListMode>> listMode;
4040
4041        /**
4042         * Internal rule reference for shared list items.
4043         */
4044        @Child(name = "listRuleId", type = {IdType.class}, order=6, min=0, max=1, modifier=false, summary=true)
4045        @Description(shortDefinition="Internal rule reference for shared list items", formalDefinition="Internal rule reference for shared list items." )
4046        protected IdType listRuleId;
4047
4048        /**
4049         * How the data is copied / created.
4050         */
4051        @Child(name = "transform", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
4052        @Description(shortDefinition="create | copy +", formalDefinition="How the data is copied / created." )
4053        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-transform")
4054        protected Enumeration<StructureMapTransform> transform;
4055
4056        /**
4057         * Parameters to the transform.
4058         */
4059        @Child(name = "parameter", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4060        @Description(shortDefinition="Parameters to the transform", formalDefinition="Parameters to the transform." )
4061        protected List<StructureMapGroupRuleTargetParameterComponent> parameter;
4062
4063        private static final long serialVersionUID = -1441766429L;
4064
4065    /**
4066     * Constructor
4067     */
4068      public StructureMapGroupRuleTargetComponent() {
4069        super();
4070      }
4071
4072        /**
4073         * @return {@link #context} (Type or variable this rule applies to.). This is the underlying object with id, value and extensions. The accessor "getContext" gives direct access to the value
4074         */
4075        public IdType getContextElement() { 
4076          if (this.context == null)
4077            if (Configuration.errorOnAutoCreate())
4078              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.context");
4079            else if (Configuration.doAutoCreate())
4080              this.context = new IdType(); // bb
4081          return this.context;
4082        }
4083
4084        public boolean hasContextElement() { 
4085          return this.context != null && !this.context.isEmpty();
4086        }
4087
4088        public boolean hasContext() { 
4089          return this.context != null && !this.context.isEmpty();
4090        }
4091
4092        /**
4093         * @param value {@link #context} (Type or variable this rule applies to.). This is the underlying object with id, value and extensions. The accessor "getContext" gives direct access to the value
4094         */
4095        public StructureMapGroupRuleTargetComponent setContextElement(IdType value) { 
4096          this.context = value;
4097          return this;
4098        }
4099
4100        /**
4101         * @return Type or variable this rule applies to.
4102         */
4103        public String getContext() { 
4104          return this.context == null ? null : this.context.getValue();
4105        }
4106
4107        /**
4108         * @param value Type or variable this rule applies to.
4109         */
4110        public StructureMapGroupRuleTargetComponent setContext(String value) { 
4111          if (Utilities.noString(value))
4112            this.context = null;
4113          else {
4114            if (this.context == null)
4115              this.context = new IdType();
4116            this.context.setValue(value);
4117          }
4118          return this;
4119        }
4120
4121        /**
4122         * @return {@link #contextType} (How to interpret the context.). This is the underlying object with id, value and extensions. The accessor "getContextType" gives direct access to the value
4123         */
4124        public Enumeration<StructureMapContextType> getContextTypeElement() { 
4125          if (this.contextType == null)
4126            if (Configuration.errorOnAutoCreate())
4127              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.contextType");
4128            else if (Configuration.doAutoCreate())
4129              this.contextType = new Enumeration<StructureMapContextType>(new StructureMapContextTypeEnumFactory()); // bb
4130          return this.contextType;
4131        }
4132
4133        public boolean hasContextTypeElement() { 
4134          return this.contextType != null && !this.contextType.isEmpty();
4135        }
4136
4137        public boolean hasContextType() { 
4138          return this.contextType != null && !this.contextType.isEmpty();
4139        }
4140
4141        /**
4142         * @param value {@link #contextType} (How to interpret the context.). This is the underlying object with id, value and extensions. The accessor "getContextType" gives direct access to the value
4143         */
4144        public StructureMapGroupRuleTargetComponent setContextTypeElement(Enumeration<StructureMapContextType> value) { 
4145          this.contextType = value;
4146          return this;
4147        }
4148
4149        /**
4150         * @return How to interpret the context.
4151         */
4152        public StructureMapContextType getContextType() { 
4153          return this.contextType == null ? null : this.contextType.getValue();
4154        }
4155
4156        /**
4157         * @param value How to interpret the context.
4158         */
4159        public StructureMapGroupRuleTargetComponent setContextType(StructureMapContextType value) { 
4160          if (value == null)
4161            this.contextType = null;
4162          else {
4163            if (this.contextType == null)
4164              this.contextType = new Enumeration<StructureMapContextType>(new StructureMapContextTypeEnumFactory());
4165            this.contextType.setValue(value);
4166          }
4167          return this;
4168        }
4169
4170        /**
4171         * @return {@link #element} (Field to create in the context.). This is the underlying object with id, value and extensions. The accessor "getElement" gives direct access to the value
4172         */
4173        public StringType getElementElement() { 
4174          if (this.element == null)
4175            if (Configuration.errorOnAutoCreate())
4176              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.element");
4177            else if (Configuration.doAutoCreate())
4178              this.element = new StringType(); // bb
4179          return this.element;
4180        }
4181
4182        public boolean hasElementElement() { 
4183          return this.element != null && !this.element.isEmpty();
4184        }
4185
4186        public boolean hasElement() { 
4187          return this.element != null && !this.element.isEmpty();
4188        }
4189
4190        /**
4191         * @param value {@link #element} (Field to create in the context.). This is the underlying object with id, value and extensions. The accessor "getElement" gives direct access to the value
4192         */
4193        public StructureMapGroupRuleTargetComponent setElementElement(StringType value) { 
4194          this.element = value;
4195          return this;
4196        }
4197
4198        /**
4199         * @return Field to create in the context.
4200         */
4201        public String getElement() { 
4202          return this.element == null ? null : this.element.getValue();
4203        }
4204
4205        /**
4206         * @param value Field to create in the context.
4207         */
4208        public StructureMapGroupRuleTargetComponent setElement(String value) { 
4209          if (Utilities.noString(value))
4210            this.element = null;
4211          else {
4212            if (this.element == null)
4213              this.element = new StringType();
4214            this.element.setValue(value);
4215          }
4216          return this;
4217        }
4218
4219        /**
4220         * @return {@link #variable} (Named context for field, if desired, and a field is specified.). This is the underlying object with id, value and extensions. The accessor "getVariable" gives direct access to the value
4221         */
4222        public IdType getVariableElement() { 
4223          if (this.variable == null)
4224            if (Configuration.errorOnAutoCreate())
4225              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.variable");
4226            else if (Configuration.doAutoCreate())
4227              this.variable = new IdType(); // bb
4228          return this.variable;
4229        }
4230
4231        public boolean hasVariableElement() { 
4232          return this.variable != null && !this.variable.isEmpty();
4233        }
4234
4235        public boolean hasVariable() { 
4236          return this.variable != null && !this.variable.isEmpty();
4237        }
4238
4239        /**
4240         * @param value {@link #variable} (Named context for field, if desired, and a field is specified.). This is the underlying object with id, value and extensions. The accessor "getVariable" gives direct access to the value
4241         */
4242        public StructureMapGroupRuleTargetComponent setVariableElement(IdType value) { 
4243          this.variable = value;
4244          return this;
4245        }
4246
4247        /**
4248         * @return Named context for field, if desired, and a field is specified.
4249         */
4250        public String getVariable() { 
4251          return this.variable == null ? null : this.variable.getValue();
4252        }
4253
4254        /**
4255         * @param value Named context for field, if desired, and a field is specified.
4256         */
4257        public StructureMapGroupRuleTargetComponent setVariable(String value) { 
4258          if (Utilities.noString(value))
4259            this.variable = null;
4260          else {
4261            if (this.variable == null)
4262              this.variable = new IdType();
4263            this.variable.setValue(value);
4264          }
4265          return this;
4266        }
4267
4268        /**
4269         * @return {@link #listMode} (If field is a list, how to manage the list.)
4270         */
4271        public List<Enumeration<StructureMapTargetListMode>> getListMode() { 
4272          if (this.listMode == null)
4273            this.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4274          return this.listMode;
4275        }
4276
4277        /**
4278         * @return Returns a reference to <code>this</code> for easy method chaining
4279         */
4280        public StructureMapGroupRuleTargetComponent setListMode(List<Enumeration<StructureMapTargetListMode>> theListMode) { 
4281          this.listMode = theListMode;
4282          return this;
4283        }
4284
4285        public boolean hasListMode() { 
4286          if (this.listMode == null)
4287            return false;
4288          for (Enumeration<StructureMapTargetListMode> item : this.listMode)
4289            if (!item.isEmpty())
4290              return true;
4291          return false;
4292        }
4293
4294        /**
4295         * @return {@link #listMode} (If field is a list, how to manage the list.)
4296         */
4297        public Enumeration<StructureMapTargetListMode> addListModeElement() {//2 
4298          Enumeration<StructureMapTargetListMode> t = new Enumeration<StructureMapTargetListMode>(new StructureMapTargetListModeEnumFactory());
4299          if (this.listMode == null)
4300            this.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4301          this.listMode.add(t);
4302          return t;
4303        }
4304
4305        /**
4306         * @param value {@link #listMode} (If field is a list, how to manage the list.)
4307         */
4308        public StructureMapGroupRuleTargetComponent addListMode(StructureMapTargetListMode value) { //1
4309          Enumeration<StructureMapTargetListMode> t = new Enumeration<StructureMapTargetListMode>(new StructureMapTargetListModeEnumFactory());
4310          t.setValue(value);
4311          if (this.listMode == null)
4312            this.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4313          this.listMode.add(t);
4314          return this;
4315        }
4316
4317        /**
4318         * @param value {@link #listMode} (If field is a list, how to manage the list.)
4319         */
4320        public boolean hasListMode(StructureMapTargetListMode value) { 
4321          if (this.listMode == null)
4322            return false;
4323          for (Enumeration<StructureMapTargetListMode> v : this.listMode)
4324            if (v.getValue().equals(value)) // code
4325              return true;
4326          return false;
4327        }
4328
4329        /**
4330         * @return {@link #listRuleId} (Internal rule reference for shared list items.). This is the underlying object with id, value and extensions. The accessor "getListRuleId" gives direct access to the value
4331         */
4332        public IdType getListRuleIdElement() { 
4333          if (this.listRuleId == null)
4334            if (Configuration.errorOnAutoCreate())
4335              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.listRuleId");
4336            else if (Configuration.doAutoCreate())
4337              this.listRuleId = new IdType(); // bb
4338          return this.listRuleId;
4339        }
4340
4341        public boolean hasListRuleIdElement() { 
4342          return this.listRuleId != null && !this.listRuleId.isEmpty();
4343        }
4344
4345        public boolean hasListRuleId() { 
4346          return this.listRuleId != null && !this.listRuleId.isEmpty();
4347        }
4348
4349        /**
4350         * @param value {@link #listRuleId} (Internal rule reference for shared list items.). This is the underlying object with id, value and extensions. The accessor "getListRuleId" gives direct access to the value
4351         */
4352        public StructureMapGroupRuleTargetComponent setListRuleIdElement(IdType value) { 
4353          this.listRuleId = value;
4354          return this;
4355        }
4356
4357        /**
4358         * @return Internal rule reference for shared list items.
4359         */
4360        public String getListRuleId() { 
4361          return this.listRuleId == null ? null : this.listRuleId.getValue();
4362        }
4363
4364        /**
4365         * @param value Internal rule reference for shared list items.
4366         */
4367        public StructureMapGroupRuleTargetComponent setListRuleId(String value) { 
4368          if (Utilities.noString(value))
4369            this.listRuleId = null;
4370          else {
4371            if (this.listRuleId == null)
4372              this.listRuleId = new IdType();
4373            this.listRuleId.setValue(value);
4374          }
4375          return this;
4376        }
4377
4378        /**
4379         * @return {@link #transform} (How the data is copied / created.). This is the underlying object with id, value and extensions. The accessor "getTransform" gives direct access to the value
4380         */
4381        public Enumeration<StructureMapTransform> getTransformElement() { 
4382          if (this.transform == null)
4383            if (Configuration.errorOnAutoCreate())
4384              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.transform");
4385            else if (Configuration.doAutoCreate())
4386              this.transform = new Enumeration<StructureMapTransform>(new StructureMapTransformEnumFactory()); // bb
4387          return this.transform;
4388        }
4389
4390        public boolean hasTransformElement() { 
4391          return this.transform != null && !this.transform.isEmpty();
4392        }
4393
4394        public boolean hasTransform() { 
4395          return this.transform != null && !this.transform.isEmpty();
4396        }
4397
4398        /**
4399         * @param value {@link #transform} (How the data is copied / created.). This is the underlying object with id, value and extensions. The accessor "getTransform" gives direct access to the value
4400         */
4401        public StructureMapGroupRuleTargetComponent setTransformElement(Enumeration<StructureMapTransform> value) { 
4402          this.transform = value;
4403          return this;
4404        }
4405
4406        /**
4407         * @return How the data is copied / created.
4408         */
4409        public StructureMapTransform getTransform() { 
4410          return this.transform == null ? null : this.transform.getValue();
4411        }
4412
4413        /**
4414         * @param value How the data is copied / created.
4415         */
4416        public StructureMapGroupRuleTargetComponent setTransform(StructureMapTransform value) { 
4417          if (value == null)
4418            this.transform = null;
4419          else {
4420            if (this.transform == null)
4421              this.transform = new Enumeration<StructureMapTransform>(new StructureMapTransformEnumFactory());
4422            this.transform.setValue(value);
4423          }
4424          return this;
4425        }
4426
4427        /**
4428         * @return {@link #parameter} (Parameters to the transform.)
4429         */
4430        public List<StructureMapGroupRuleTargetParameterComponent> getParameter() { 
4431          if (this.parameter == null)
4432            this.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4433          return this.parameter;
4434        }
4435
4436        /**
4437         * @return Returns a reference to <code>this</code> for easy method chaining
4438         */
4439        public StructureMapGroupRuleTargetComponent setParameter(List<StructureMapGroupRuleTargetParameterComponent> theParameter) { 
4440          this.parameter = theParameter;
4441          return this;
4442        }
4443
4444        public boolean hasParameter() { 
4445          if (this.parameter == null)
4446            return false;
4447          for (StructureMapGroupRuleTargetParameterComponent item : this.parameter)
4448            if (!item.isEmpty())
4449              return true;
4450          return false;
4451        }
4452
4453        public StructureMapGroupRuleTargetParameterComponent addParameter() { //3
4454          StructureMapGroupRuleTargetParameterComponent t = new StructureMapGroupRuleTargetParameterComponent();
4455          if (this.parameter == null)
4456            this.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4457          this.parameter.add(t);
4458          return t;
4459        }
4460
4461        public StructureMapGroupRuleTargetComponent addParameter(StructureMapGroupRuleTargetParameterComponent t) { //3
4462          if (t == null)
4463            return this;
4464          if (this.parameter == null)
4465            this.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4466          this.parameter.add(t);
4467          return this;
4468        }
4469
4470        /**
4471         * @return The first repetition of repeating field {@link #parameter}, creating it if it does not already exist
4472         */
4473        public StructureMapGroupRuleTargetParameterComponent getParameterFirstRep() { 
4474          if (getParameter().isEmpty()) {
4475            addParameter();
4476          }
4477          return getParameter().get(0);
4478        }
4479
4480        protected void listChildren(List<Property> children) {
4481          super.listChildren(children);
4482          children.add(new Property("context", "id", "Type or variable this rule applies to.", 0, 1, context));
4483          children.add(new Property("contextType", "code", "How to interpret the context.", 0, 1, contextType));
4484          children.add(new Property("element", "string", "Field to create in the context.", 0, 1, element));
4485          children.add(new Property("variable", "id", "Named context for field, if desired, and a field is specified.", 0, 1, variable));
4486          children.add(new Property("listMode", "code", "If field is a list, how to manage the list.", 0, java.lang.Integer.MAX_VALUE, listMode));
4487          children.add(new Property("listRuleId", "id", "Internal rule reference for shared list items.", 0, 1, listRuleId));
4488          children.add(new Property("transform", "code", "How the data is copied / created.", 0, 1, transform));
4489          children.add(new Property("parameter", "", "Parameters to the transform.", 0, java.lang.Integer.MAX_VALUE, parameter));
4490        }
4491
4492        @Override
4493        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4494          switch (_hash) {
4495          case 951530927: /*context*/  return new Property("context", "id", "Type or variable this rule applies to.", 0, 1, context);
4496          case -102839927: /*contextType*/  return new Property("contextType", "code", "How to interpret the context.", 0, 1, contextType);
4497          case -1662836996: /*element*/  return new Property("element", "string", "Field to create in the context.", 0, 1, element);
4498          case -1249586564: /*variable*/  return new Property("variable", "id", "Named context for field, if desired, and a field is specified.", 0, 1, variable);
4499          case 1345445729: /*listMode*/  return new Property("listMode", "code", "If field is a list, how to manage the list.", 0, java.lang.Integer.MAX_VALUE, listMode);
4500          case 337117045: /*listRuleId*/  return new Property("listRuleId", "id", "Internal rule reference for shared list items.", 0, 1, listRuleId);
4501          case 1052666732: /*transform*/  return new Property("transform", "code", "How the data is copied / created.", 0, 1, transform);
4502          case 1954460585: /*parameter*/  return new Property("parameter", "", "Parameters to the transform.", 0, java.lang.Integer.MAX_VALUE, parameter);
4503          default: return super.getNamedProperty(_hash, _name, _checkValid);
4504          }
4505
4506        }
4507
4508      @Override
4509      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4510        switch (hash) {
4511        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // IdType
4512        case -102839927: /*contextType*/ return this.contextType == null ? new Base[0] : new Base[] {this.contextType}; // Enumeration<StructureMapContextType>
4513        case -1662836996: /*element*/ return this.element == null ? new Base[0] : new Base[] {this.element}; // StringType
4514        case -1249586564: /*variable*/ return this.variable == null ? new Base[0] : new Base[] {this.variable}; // IdType
4515        case 1345445729: /*listMode*/ return this.listMode == null ? new Base[0] : this.listMode.toArray(new Base[this.listMode.size()]); // Enumeration<StructureMapTargetListMode>
4516        case 337117045: /*listRuleId*/ return this.listRuleId == null ? new Base[0] : new Base[] {this.listRuleId}; // IdType
4517        case 1052666732: /*transform*/ return this.transform == null ? new Base[0] : new Base[] {this.transform}; // Enumeration<StructureMapTransform>
4518        case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // StructureMapGroupRuleTargetParameterComponent
4519        default: return super.getProperty(hash, name, checkValid);
4520        }
4521
4522      }
4523
4524      @Override
4525      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4526        switch (hash) {
4527        case 951530927: // context
4528          this.context = castToId(value); // IdType
4529          return value;
4530        case -102839927: // contextType
4531          value = new StructureMapContextTypeEnumFactory().fromType(castToCode(value));
4532          this.contextType = (Enumeration) value; // Enumeration<StructureMapContextType>
4533          return value;
4534        case -1662836996: // element
4535          this.element = castToString(value); // StringType
4536          return value;
4537        case -1249586564: // variable
4538          this.variable = castToId(value); // IdType
4539          return value;
4540        case 1345445729: // listMode
4541          value = new StructureMapTargetListModeEnumFactory().fromType(castToCode(value));
4542          this.getListMode().add((Enumeration) value); // Enumeration<StructureMapTargetListMode>
4543          return value;
4544        case 337117045: // listRuleId
4545          this.listRuleId = castToId(value); // IdType
4546          return value;
4547        case 1052666732: // transform
4548          value = new StructureMapTransformEnumFactory().fromType(castToCode(value));
4549          this.transform = (Enumeration) value; // Enumeration<StructureMapTransform>
4550          return value;
4551        case 1954460585: // parameter
4552          this.getParameter().add((StructureMapGroupRuleTargetParameterComponent) value); // StructureMapGroupRuleTargetParameterComponent
4553          return value;
4554        default: return super.setProperty(hash, name, value);
4555        }
4556
4557      }
4558
4559      @Override
4560      public Base setProperty(String name, Base value) throws FHIRException {
4561        if (name.equals("context")) {
4562          this.context = castToId(value); // IdType
4563        } else if (name.equals("contextType")) {
4564          value = new StructureMapContextTypeEnumFactory().fromType(castToCode(value));
4565          this.contextType = (Enumeration) value; // Enumeration<StructureMapContextType>
4566        } else if (name.equals("element")) {
4567          this.element = castToString(value); // StringType
4568        } else if (name.equals("variable")) {
4569          this.variable = castToId(value); // IdType
4570        } else if (name.equals("listMode")) {
4571          value = new StructureMapTargetListModeEnumFactory().fromType(castToCode(value));
4572          this.getListMode().add((Enumeration) value);
4573        } else if (name.equals("listRuleId")) {
4574          this.listRuleId = castToId(value); // IdType
4575        } else if (name.equals("transform")) {
4576          value = new StructureMapTransformEnumFactory().fromType(castToCode(value));
4577          this.transform = (Enumeration) value; // Enumeration<StructureMapTransform>
4578        } else if (name.equals("parameter")) {
4579          this.getParameter().add((StructureMapGroupRuleTargetParameterComponent) value);
4580        } else
4581          return super.setProperty(name, value);
4582        return value;
4583      }
4584
4585      @Override
4586      public Base makeProperty(int hash, String name) throws FHIRException {
4587        switch (hash) {
4588        case 951530927:  return getContextElement();
4589        case -102839927:  return getContextTypeElement();
4590        case -1662836996:  return getElementElement();
4591        case -1249586564:  return getVariableElement();
4592        case 1345445729:  return addListModeElement();
4593        case 337117045:  return getListRuleIdElement();
4594        case 1052666732:  return getTransformElement();
4595        case 1954460585:  return addParameter(); 
4596        default: return super.makeProperty(hash, name);
4597        }
4598
4599      }
4600
4601      @Override
4602      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4603        switch (hash) {
4604        case 951530927: /*context*/ return new String[] {"id"};
4605        case -102839927: /*contextType*/ return new String[] {"code"};
4606        case -1662836996: /*element*/ return new String[] {"string"};
4607        case -1249586564: /*variable*/ return new String[] {"id"};
4608        case 1345445729: /*listMode*/ return new String[] {"code"};
4609        case 337117045: /*listRuleId*/ return new String[] {"id"};
4610        case 1052666732: /*transform*/ return new String[] {"code"};
4611        case 1954460585: /*parameter*/ return new String[] {};
4612        default: return super.getTypesForProperty(hash, name);
4613        }
4614
4615      }
4616
4617      @Override
4618      public Base addChild(String name) throws FHIRException {
4619        if (name.equals("context")) {
4620          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.context");
4621        }
4622        else if (name.equals("contextType")) {
4623          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.contextType");
4624        }
4625        else if (name.equals("element")) {
4626          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.element");
4627        }
4628        else if (name.equals("variable")) {
4629          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.variable");
4630        }
4631        else if (name.equals("listMode")) {
4632          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.listMode");
4633        }
4634        else if (name.equals("listRuleId")) {
4635          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.listRuleId");
4636        }
4637        else if (name.equals("transform")) {
4638          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.transform");
4639        }
4640        else if (name.equals("parameter")) {
4641          return addParameter();
4642        }
4643        else
4644          return super.addChild(name);
4645      }
4646
4647      public StructureMapGroupRuleTargetComponent copy() {
4648        StructureMapGroupRuleTargetComponent dst = new StructureMapGroupRuleTargetComponent();
4649        copyValues(dst);
4650        dst.context = context == null ? null : context.copy();
4651        dst.contextType = contextType == null ? null : contextType.copy();
4652        dst.element = element == null ? null : element.copy();
4653        dst.variable = variable == null ? null : variable.copy();
4654        if (listMode != null) {
4655          dst.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4656          for (Enumeration<StructureMapTargetListMode> i : listMode)
4657            dst.listMode.add(i.copy());
4658        };
4659        dst.listRuleId = listRuleId == null ? null : listRuleId.copy();
4660        dst.transform = transform == null ? null : transform.copy();
4661        if (parameter != null) {
4662          dst.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4663          for (StructureMapGroupRuleTargetParameterComponent i : parameter)
4664            dst.parameter.add(i.copy());
4665        };
4666        return dst;
4667      }
4668
4669      @Override
4670      public boolean equalsDeep(Base other_) {
4671        if (!super.equalsDeep(other_))
4672          return false;
4673        if (!(other_ instanceof StructureMapGroupRuleTargetComponent))
4674          return false;
4675        StructureMapGroupRuleTargetComponent o = (StructureMapGroupRuleTargetComponent) other_;
4676        return compareDeep(context, o.context, true) && compareDeep(contextType, o.contextType, true) && compareDeep(element, o.element, true)
4677           && compareDeep(variable, o.variable, true) && compareDeep(listMode, o.listMode, true) && compareDeep(listRuleId, o.listRuleId, true)
4678           && compareDeep(transform, o.transform, true) && compareDeep(parameter, o.parameter, true);
4679      }
4680
4681      @Override
4682      public boolean equalsShallow(Base other_) {
4683        if (!super.equalsShallow(other_))
4684          return false;
4685        if (!(other_ instanceof StructureMapGroupRuleTargetComponent))
4686          return false;
4687        StructureMapGroupRuleTargetComponent o = (StructureMapGroupRuleTargetComponent) other_;
4688        return compareValues(context, o.context, true) && compareValues(contextType, o.contextType, true) && compareValues(element, o.element, true)
4689           && compareValues(variable, o.variable, true) && compareValues(listMode, o.listMode, true) && compareValues(listRuleId, o.listRuleId, true)
4690           && compareValues(transform, o.transform, true);
4691      }
4692
4693      public boolean isEmpty() {
4694        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(context, contextType, element
4695          , variable, listMode, listRuleId, transform, parameter);
4696      }
4697
4698  public String fhirType() {
4699    return "StructureMap.group.rule.target";
4700
4701  }
4702
4703// added from java-adornments.txt:
4704
4705  public String toString() {
4706    return StructureMapUtilities.targetToString(this);
4707  }
4708
4709
4710// end addition
4711  }
4712
4713    @Block()
4714    public static class StructureMapGroupRuleTargetParameterComponent extends BackboneElement implements IBaseBackboneElement {
4715        /**
4716         * Parameter value - variable or literal.
4717         */
4718        @Child(name = "value", type = {IdType.class, StringType.class, BooleanType.class, IntegerType.class, DecimalType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4719        @Description(shortDefinition="Parameter value - variable or literal", formalDefinition="Parameter value - variable or literal." )
4720        protected Type value;
4721
4722        private static final long serialVersionUID = -732981989L;
4723
4724    /**
4725     * Constructor
4726     */
4727      public StructureMapGroupRuleTargetParameterComponent() {
4728        super();
4729      }
4730
4731    /**
4732     * Constructor
4733     */
4734      public StructureMapGroupRuleTargetParameterComponent(Type value) {
4735        super();
4736        this.value = value;
4737      }
4738
4739        /**
4740         * @return {@link #value} (Parameter value - variable or literal.)
4741         */
4742        public Type getValue() { 
4743          return this.value;
4744        }
4745
4746        /**
4747         * @return {@link #value} (Parameter value - variable or literal.)
4748         */
4749        public IdType getValueIdType() throws FHIRException { 
4750          if (this.value == null)
4751            return null;
4752          if (!(this.value instanceof IdType))
4753            throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.value.getClass().getName()+" was encountered");
4754          return (IdType) this.value;
4755        }
4756
4757        public boolean hasValueIdType() { 
4758          return this != null && this.value instanceof IdType;
4759        }
4760
4761        /**
4762         * @return {@link #value} (Parameter value - variable or literal.)
4763         */
4764        public StringType getValueStringType() throws FHIRException { 
4765          if (this.value == null)
4766            return null;
4767          if (!(this.value instanceof StringType))
4768            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
4769          return (StringType) this.value;
4770        }
4771
4772        public boolean hasValueStringType() { 
4773          return this != null && this.value instanceof StringType;
4774        }
4775
4776        /**
4777         * @return {@link #value} (Parameter value - variable or literal.)
4778         */
4779        public BooleanType getValueBooleanType() throws FHIRException { 
4780          if (this.value == null)
4781            return null;
4782          if (!(this.value instanceof BooleanType))
4783            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
4784          return (BooleanType) this.value;
4785        }
4786
4787        public boolean hasValueBooleanType() { 
4788          return this != null && this.value instanceof BooleanType;
4789        }
4790
4791        /**
4792         * @return {@link #value} (Parameter value - variable or literal.)
4793         */
4794        public IntegerType getValueIntegerType() throws FHIRException { 
4795          if (this.value == null)
4796            return null;
4797          if (!(this.value instanceof IntegerType))
4798            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
4799          return (IntegerType) this.value;
4800        }
4801
4802        public boolean hasValueIntegerType() { 
4803          return this != null && this.value instanceof IntegerType;
4804        }
4805
4806        /**
4807         * @return {@link #value} (Parameter value - variable or literal.)
4808         */
4809        public DecimalType getValueDecimalType() throws FHIRException { 
4810          if (this.value == null)
4811            return null;
4812          if (!(this.value instanceof DecimalType))
4813            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
4814          return (DecimalType) this.value;
4815        }
4816
4817        public boolean hasValueDecimalType() { 
4818          return this != null && this.value instanceof DecimalType;
4819        }
4820
4821        public boolean hasValue() { 
4822          return this.value != null && !this.value.isEmpty();
4823        }
4824
4825        /**
4826         * @param value {@link #value} (Parameter value - variable or literal.)
4827         */
4828        public StructureMapGroupRuleTargetParameterComponent setValue(Type value) { 
4829          if (value != null && !(value instanceof IdType || value instanceof StringType || value instanceof BooleanType || value instanceof IntegerType || value instanceof DecimalType))
4830            throw new Error("Not the right type for StructureMap.group.rule.target.parameter.value[x]: "+value.fhirType());
4831          this.value = value;
4832          return this;
4833        }
4834
4835        protected void listChildren(List<Property> children) {
4836          super.listChildren(children);
4837          children.add(new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value));
4838        }
4839
4840        @Override
4841        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4842          switch (_hash) {
4843          case -1410166417: /*value[x]*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4844          case 111972721: /*value*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4845          case 231604844: /*valueId*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4846          case -1424603934: /*valueString*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4847          case 733421943: /*valueBoolean*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4848          case -1668204915: /*valueInteger*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4849          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4850          default: return super.getNamedProperty(_hash, _name, _checkValid);
4851          }
4852
4853        }
4854
4855      @Override
4856      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4857        switch (hash) {
4858        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
4859        default: return super.getProperty(hash, name, checkValid);
4860        }
4861
4862      }
4863
4864      @Override
4865      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4866        switch (hash) {
4867        case 111972721: // value
4868          this.value = castToType(value); // Type
4869          return value;
4870        default: return super.setProperty(hash, name, value);
4871        }
4872
4873      }
4874
4875      @Override
4876      public Base setProperty(String name, Base value) throws FHIRException {
4877        if (name.equals("value[x]")) {
4878          this.value = castToType(value); // Type
4879        } else
4880          return super.setProperty(name, value);
4881        return value;
4882      }
4883
4884      @Override
4885      public Base makeProperty(int hash, String name) throws FHIRException {
4886        switch (hash) {
4887        case -1410166417:  return getValue(); 
4888        case 111972721:  return getValue(); 
4889        default: return super.makeProperty(hash, name);
4890        }
4891
4892      }
4893
4894      @Override
4895      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4896        switch (hash) {
4897        case 111972721: /*value*/ return new String[] {"id", "string", "boolean", "integer", "decimal"};
4898        default: return super.getTypesForProperty(hash, name);
4899        }
4900
4901      }
4902
4903      @Override
4904      public Base addChild(String name) throws FHIRException {
4905        if (name.equals("valueId")) {
4906          this.value = new IdType();
4907          return this.value;
4908        }
4909        else if (name.equals("valueString")) {
4910          this.value = new StringType();
4911          return this.value;
4912        }
4913        else if (name.equals("valueBoolean")) {
4914          this.value = new BooleanType();
4915          return this.value;
4916        }
4917        else if (name.equals("valueInteger")) {
4918          this.value = new IntegerType();
4919          return this.value;
4920        }
4921        else if (name.equals("valueDecimal")) {
4922          this.value = new DecimalType();
4923          return this.value;
4924        }
4925        else
4926          return super.addChild(name);
4927      }
4928
4929      public StructureMapGroupRuleTargetParameterComponent copy() {
4930        StructureMapGroupRuleTargetParameterComponent dst = new StructureMapGroupRuleTargetParameterComponent();
4931        copyValues(dst);
4932        dst.value = value == null ? null : value.copy();
4933        return dst;
4934      }
4935
4936      @Override
4937      public boolean equalsDeep(Base other_) {
4938        if (!super.equalsDeep(other_))
4939          return false;
4940        if (!(other_ instanceof StructureMapGroupRuleTargetParameterComponent))
4941          return false;
4942        StructureMapGroupRuleTargetParameterComponent o = (StructureMapGroupRuleTargetParameterComponent) other_;
4943        return compareDeep(value, o.value, true);
4944      }
4945
4946      @Override
4947      public boolean equalsShallow(Base other_) {
4948        if (!super.equalsShallow(other_))
4949          return false;
4950        if (!(other_ instanceof StructureMapGroupRuleTargetParameterComponent))
4951          return false;
4952        StructureMapGroupRuleTargetParameterComponent o = (StructureMapGroupRuleTargetParameterComponent) other_;
4953        return true;
4954      }
4955
4956      public boolean isEmpty() {
4957        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
4958      }
4959
4960  public String fhirType() {
4961    return "StructureMap.group.rule.target.parameter";
4962
4963  }
4964
4965// added from java-adornments.txt:
4966
4967      public String toString() {
4968        return value == null ? "null!" : value.toString();
4969      }
4970
4971
4972
4973// end addition
4974  }
4975
4976    @Block()
4977    public static class StructureMapGroupRuleDependentComponent extends BackboneElement implements IBaseBackboneElement {
4978        /**
4979         * Name of a rule or group to apply.
4980         */
4981        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4982        @Description(shortDefinition="Name of a rule or group to apply", formalDefinition="Name of a rule or group to apply." )
4983        protected IdType name;
4984
4985        /**
4986         * Variable to pass to the rule or group.
4987         */
4988        @Child(name = "variable", type = {StringType.class}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4989        @Description(shortDefinition="Variable to pass to the rule or group", formalDefinition="Variable to pass to the rule or group." )
4990        protected List<StringType> variable;
4991
4992        private static final long serialVersionUID = 1021661591L;
4993
4994    /**
4995     * Constructor
4996     */
4997      public StructureMapGroupRuleDependentComponent() {
4998        super();
4999      }
5000
5001    /**
5002     * Constructor
5003     */
5004      public StructureMapGroupRuleDependentComponent(IdType name) {
5005        super();
5006        this.name = name;
5007      }
5008
5009        /**
5010         * @return {@link #name} (Name of a rule or group to apply.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
5011         */
5012        public IdType getNameElement() { 
5013          if (this.name == null)
5014            if (Configuration.errorOnAutoCreate())
5015              throw new Error("Attempt to auto-create StructureMapGroupRuleDependentComponent.name");
5016            else if (Configuration.doAutoCreate())
5017              this.name = new IdType(); // bb
5018          return this.name;
5019        }
5020
5021        public boolean hasNameElement() { 
5022          return this.name != null && !this.name.isEmpty();
5023        }
5024
5025        public boolean hasName() { 
5026          return this.name != null && !this.name.isEmpty();
5027        }
5028
5029        /**
5030         * @param value {@link #name} (Name of a rule or group to apply.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
5031         */
5032        public StructureMapGroupRuleDependentComponent setNameElement(IdType value) { 
5033          this.name = value;
5034          return this;
5035        }
5036
5037        /**
5038         * @return Name of a rule or group to apply.
5039         */
5040        public String getName() { 
5041          return this.name == null ? null : this.name.getValue();
5042        }
5043
5044        /**
5045         * @param value Name of a rule or group to apply.
5046         */
5047        public StructureMapGroupRuleDependentComponent setName(String value) { 
5048            if (this.name == null)
5049              this.name = new IdType();
5050            this.name.setValue(value);
5051          return this;
5052        }
5053
5054        /**
5055         * @return {@link #variable} (Variable to pass to the rule or group.)
5056         */
5057        public List<StringType> getVariable() { 
5058          if (this.variable == null)
5059            this.variable = new ArrayList<StringType>();
5060          return this.variable;
5061        }
5062
5063        /**
5064         * @return Returns a reference to <code>this</code> for easy method chaining
5065         */
5066        public StructureMapGroupRuleDependentComponent setVariable(List<StringType> theVariable) { 
5067          this.variable = theVariable;
5068          return this;
5069        }
5070
5071        public boolean hasVariable() { 
5072          if (this.variable == null)
5073            return false;
5074          for (StringType item : this.variable)
5075            if (!item.isEmpty())
5076              return true;
5077          return false;
5078        }
5079
5080        /**
5081         * @return {@link #variable} (Variable to pass to the rule or group.)
5082         */
5083        public StringType addVariableElement() {//2 
5084          StringType t = new StringType();
5085          if (this.variable == null)
5086            this.variable = new ArrayList<StringType>();
5087          this.variable.add(t);
5088          return t;
5089        }
5090
5091        /**
5092         * @param value {@link #variable} (Variable to pass to the rule or group.)
5093         */
5094        public StructureMapGroupRuleDependentComponent addVariable(String value) { //1
5095          StringType t = new StringType();
5096          t.setValue(value);
5097          if (this.variable == null)
5098            this.variable = new ArrayList<StringType>();
5099          this.variable.add(t);
5100          return this;
5101        }
5102
5103        /**
5104         * @param value {@link #variable} (Variable to pass to the rule or group.)
5105         */
5106        public boolean hasVariable(String value) { 
5107          if (this.variable == null)
5108            return false;
5109          for (StringType v : this.variable)
5110            if (v.getValue().equals(value)) // string
5111              return true;
5112          return false;
5113        }
5114
5115        protected void listChildren(List<Property> children) {
5116          super.listChildren(children);
5117          children.add(new Property("name", "id", "Name of a rule or group to apply.", 0, 1, name));
5118          children.add(new Property("variable", "string", "Variable to pass to the rule or group.", 0, java.lang.Integer.MAX_VALUE, variable));
5119        }
5120
5121        @Override
5122        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5123          switch (_hash) {
5124          case 3373707: /*name*/  return new Property("name", "id", "Name of a rule or group to apply.", 0, 1, name);
5125          case -1249586564: /*variable*/  return new Property("variable", "string", "Variable to pass to the rule or group.", 0, java.lang.Integer.MAX_VALUE, variable);
5126          default: return super.getNamedProperty(_hash, _name, _checkValid);
5127          }
5128
5129        }
5130
5131      @Override
5132      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5133        switch (hash) {
5134        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
5135        case -1249586564: /*variable*/ return this.variable == null ? new Base[0] : this.variable.toArray(new Base[this.variable.size()]); // StringType
5136        default: return super.getProperty(hash, name, checkValid);
5137        }
5138
5139      }
5140
5141      @Override
5142      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5143        switch (hash) {
5144        case 3373707: // name
5145          this.name = castToId(value); // IdType
5146          return value;
5147        case -1249586564: // variable
5148          this.getVariable().add(castToString(value)); // StringType
5149          return value;
5150        default: return super.setProperty(hash, name, value);
5151        }
5152
5153      }
5154
5155      @Override
5156      public Base setProperty(String name, Base value) throws FHIRException {
5157        if (name.equals("name")) {
5158          this.name = castToId(value); // IdType
5159        } else if (name.equals("variable")) {
5160          this.getVariable().add(castToString(value));
5161        } else
5162          return super.setProperty(name, value);
5163        return value;
5164      }
5165
5166      @Override
5167      public Base makeProperty(int hash, String name) throws FHIRException {
5168        switch (hash) {
5169        case 3373707:  return getNameElement();
5170        case -1249586564:  return addVariableElement();
5171        default: return super.makeProperty(hash, name);
5172        }
5173
5174      }
5175
5176      @Override
5177      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5178        switch (hash) {
5179        case 3373707: /*name*/ return new String[] {"id"};
5180        case -1249586564: /*variable*/ return new String[] {"string"};
5181        default: return super.getTypesForProperty(hash, name);
5182        }
5183
5184      }
5185
5186      @Override
5187      public Base addChild(String name) throws FHIRException {
5188        if (name.equals("name")) {
5189          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
5190        }
5191        else if (name.equals("variable")) {
5192          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.variable");
5193        }
5194        else
5195          return super.addChild(name);
5196      }
5197
5198      public StructureMapGroupRuleDependentComponent copy() {
5199        StructureMapGroupRuleDependentComponent dst = new StructureMapGroupRuleDependentComponent();
5200        copyValues(dst);
5201        dst.name = name == null ? null : name.copy();
5202        if (variable != null) {
5203          dst.variable = new ArrayList<StringType>();
5204          for (StringType i : variable)
5205            dst.variable.add(i.copy());
5206        };
5207        return dst;
5208      }
5209
5210      @Override
5211      public boolean equalsDeep(Base other_) {
5212        if (!super.equalsDeep(other_))
5213          return false;
5214        if (!(other_ instanceof StructureMapGroupRuleDependentComponent))
5215          return false;
5216        StructureMapGroupRuleDependentComponent o = (StructureMapGroupRuleDependentComponent) other_;
5217        return compareDeep(name, o.name, true) && compareDeep(variable, o.variable, true);
5218      }
5219
5220      @Override
5221      public boolean equalsShallow(Base other_) {
5222        if (!super.equalsShallow(other_))
5223          return false;
5224        if (!(other_ instanceof StructureMapGroupRuleDependentComponent))
5225          return false;
5226        StructureMapGroupRuleDependentComponent o = (StructureMapGroupRuleDependentComponent) other_;
5227        return compareValues(name, o.name, true) && compareValues(variable, o.variable, true);
5228      }
5229
5230      public boolean isEmpty() {
5231        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, variable);
5232      }
5233
5234  public String fhirType() {
5235    return "StructureMap.group.rule.dependent";
5236
5237  }
5238
5239  }
5240
5241    /**
5242     * A formal identifier that is used to identify this structure map when it is represented in other formats, or referenced in a specification, model, design or an instance.
5243     */
5244    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5245    @Description(shortDefinition="Additional identifier for the structure map", formalDefinition="A formal identifier that is used to identify this structure map when it is represented in other formats, or referenced in a specification, model, design or an instance." )
5246    protected List<Identifier> identifier;
5247
5248    /**
5249     * Explanation of why this structure map is needed and why it has been designed as it has.
5250     */
5251    @Child(name = "purpose", type = {MarkdownType.class}, order=1, min=0, max=1, modifier=false, summary=false)
5252    @Description(shortDefinition="Why this structure map is defined", formalDefinition="Explanation of why this structure map is needed and why it has been designed as it has." )
5253    protected MarkdownType purpose;
5254
5255    /**
5256     * A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.
5257     */
5258    @Child(name = "copyright", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
5259    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map." )
5260    protected MarkdownType copyright;
5261
5262    /**
5263     * A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced.
5264     */
5265    @Child(name = "structure", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5266    @Description(shortDefinition="Structure Definition used by this map", formalDefinition="A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced." )
5267    protected List<StructureMapStructureComponent> structure;
5268
5269    /**
5270     * Other maps used by this map (canonical URLs).
5271     */
5272    @Child(name = "import", type = {CanonicalType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5273    @Description(shortDefinition="Other maps used by this map (canonical URLs)", formalDefinition="Other maps used by this map (canonical URLs)." )
5274    protected List<CanonicalType> import_;
5275
5276    /**
5277     * Organizes the mapping into manageable chunks for human review/ease of maintenance.
5278     */
5279    @Child(name = "group", type = {}, order=5, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5280    @Description(shortDefinition="Named sections for reader convenience", formalDefinition="Organizes the mapping into manageable chunks for human review/ease of maintenance." )
5281    protected List<StructureMapGroupComponent> group;
5282
5283    private static final long serialVersionUID = 263060597L;
5284
5285  /**
5286   * Constructor
5287   */
5288    public StructureMap() {
5289      super();
5290    }
5291
5292  /**
5293   * Constructor
5294   */
5295    public StructureMap(UriType url, StringType name, Enumeration<PublicationStatus> status) {
5296      super();
5297      this.url = url;
5298      this.name = name;
5299      this.status = status;
5300    }
5301
5302    /**
5303     * @return {@link #url} (An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which this structure map is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
5304     */
5305    public UriType getUrlElement() { 
5306      if (this.url == null)
5307        if (Configuration.errorOnAutoCreate())
5308          throw new Error("Attempt to auto-create StructureMap.url");
5309        else if (Configuration.doAutoCreate())
5310          this.url = new UriType(); // bb
5311      return this.url;
5312    }
5313
5314    public boolean hasUrlElement() { 
5315      return this.url != null && !this.url.isEmpty();
5316    }
5317
5318    public boolean hasUrl() { 
5319      return this.url != null && !this.url.isEmpty();
5320    }
5321
5322    /**
5323     * @param value {@link #url} (An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which this structure map is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
5324     */
5325    public StructureMap setUrlElement(UriType value) { 
5326      this.url = value;
5327      return this;
5328    }
5329
5330    /**
5331     * @return An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which this structure map is (or will be) published.
5332     */
5333    public String getUrl() { 
5334      return this.url == null ? null : this.url.getValue();
5335    }
5336
5337    /**
5338     * @param value An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which this structure map is (or will be) published.
5339     */
5340    public StructureMap setUrl(String value) { 
5341        if (this.url == null)
5342          this.url = new UriType();
5343        this.url.setValue(value);
5344      return this;
5345    }
5346
5347    /**
5348     * @return {@link #identifier} (A formal identifier that is used to identify this structure map when it is represented in other formats, or referenced in a specification, model, design or an instance.)
5349     */
5350    public List<Identifier> getIdentifier() { 
5351      if (this.identifier == null)
5352        this.identifier = new ArrayList<Identifier>();
5353      return this.identifier;
5354    }
5355
5356    /**
5357     * @return Returns a reference to <code>this</code> for easy method chaining
5358     */
5359    public StructureMap setIdentifier(List<Identifier> theIdentifier) { 
5360      this.identifier = theIdentifier;
5361      return this;
5362    }
5363
5364    public boolean hasIdentifier() { 
5365      if (this.identifier == null)
5366        return false;
5367      for (Identifier item : this.identifier)
5368        if (!item.isEmpty())
5369          return true;
5370      return false;
5371    }
5372
5373    public Identifier addIdentifier() { //3
5374      Identifier t = new Identifier();
5375      if (this.identifier == null)
5376        this.identifier = new ArrayList<Identifier>();
5377      this.identifier.add(t);
5378      return t;
5379    }
5380
5381    public StructureMap addIdentifier(Identifier t) { //3
5382      if (t == null)
5383        return this;
5384      if (this.identifier == null)
5385        this.identifier = new ArrayList<Identifier>();
5386      this.identifier.add(t);
5387      return this;
5388    }
5389
5390    /**
5391     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
5392     */
5393    public Identifier getIdentifierFirstRep() { 
5394      if (getIdentifier().isEmpty()) {
5395        addIdentifier();
5396      }
5397      return getIdentifier().get(0);
5398    }
5399
5400    /**
5401     * @return {@link #version} (The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
5402     */
5403    public StringType getVersionElement() { 
5404      if (this.version == null)
5405        if (Configuration.errorOnAutoCreate())
5406          throw new Error("Attempt to auto-create StructureMap.version");
5407        else if (Configuration.doAutoCreate())
5408          this.version = new StringType(); // bb
5409      return this.version;
5410    }
5411
5412    public boolean hasVersionElement() { 
5413      return this.version != null && !this.version.isEmpty();
5414    }
5415
5416    public boolean hasVersion() { 
5417      return this.version != null && !this.version.isEmpty();
5418    }
5419
5420    /**
5421     * @param value {@link #version} (The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
5422     */
5423    public StructureMap setVersionElement(StringType value) { 
5424      this.version = value;
5425      return this;
5426    }
5427
5428    /**
5429     * @return The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
5430     */
5431    public String getVersion() { 
5432      return this.version == null ? null : this.version.getValue();
5433    }
5434
5435    /**
5436     * @param value The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
5437     */
5438    public StructureMap setVersion(String value) { 
5439      if (Utilities.noString(value))
5440        this.version = null;
5441      else {
5442        if (this.version == null)
5443          this.version = new StringType();
5444        this.version.setValue(value);
5445      }
5446      return this;
5447    }
5448
5449    /**
5450     * @return {@link #name} (A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
5451     */
5452    public StringType getNameElement() { 
5453      if (this.name == null)
5454        if (Configuration.errorOnAutoCreate())
5455          throw new Error("Attempt to auto-create StructureMap.name");
5456        else if (Configuration.doAutoCreate())
5457          this.name = new StringType(); // bb
5458      return this.name;
5459    }
5460
5461    public boolean hasNameElement() { 
5462      return this.name != null && !this.name.isEmpty();
5463    }
5464
5465    public boolean hasName() { 
5466      return this.name != null && !this.name.isEmpty();
5467    }
5468
5469    /**
5470     * @param value {@link #name} (A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
5471     */
5472    public StructureMap setNameElement(StringType value) { 
5473      this.name = value;
5474      return this;
5475    }
5476
5477    /**
5478     * @return A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.
5479     */
5480    public String getName() { 
5481      return this.name == null ? null : this.name.getValue();
5482    }
5483
5484    /**
5485     * @param value A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.
5486     */
5487    public StructureMap setName(String value) { 
5488        if (this.name == null)
5489          this.name = new StringType();
5490        this.name.setValue(value);
5491      return this;
5492    }
5493
5494    /**
5495     * @return {@link #title} (A short, descriptive, user-friendly title for the structure map.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
5496     */
5497    public StringType getTitleElement() { 
5498      if (this.title == null)
5499        if (Configuration.errorOnAutoCreate())
5500          throw new Error("Attempt to auto-create StructureMap.title");
5501        else if (Configuration.doAutoCreate())
5502          this.title = new StringType(); // bb
5503      return this.title;
5504    }
5505
5506    public boolean hasTitleElement() { 
5507      return this.title != null && !this.title.isEmpty();
5508    }
5509
5510    public boolean hasTitle() { 
5511      return this.title != null && !this.title.isEmpty();
5512    }
5513
5514    /**
5515     * @param value {@link #title} (A short, descriptive, user-friendly title for the structure map.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
5516     */
5517    public StructureMap setTitleElement(StringType value) { 
5518      this.title = value;
5519      return this;
5520    }
5521
5522    /**
5523     * @return A short, descriptive, user-friendly title for the structure map.
5524     */
5525    public String getTitle() { 
5526      return this.title == null ? null : this.title.getValue();
5527    }
5528
5529    /**
5530     * @param value A short, descriptive, user-friendly title for the structure map.
5531     */
5532    public StructureMap setTitle(String value) { 
5533      if (Utilities.noString(value))
5534        this.title = null;
5535      else {
5536        if (this.title == null)
5537          this.title = new StringType();
5538        this.title.setValue(value);
5539      }
5540      return this;
5541    }
5542
5543    /**
5544     * @return {@link #status} (The status of this structure map. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
5545     */
5546    public Enumeration<PublicationStatus> getStatusElement() { 
5547      if (this.status == null)
5548        if (Configuration.errorOnAutoCreate())
5549          throw new Error("Attempt to auto-create StructureMap.status");
5550        else if (Configuration.doAutoCreate())
5551          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
5552      return this.status;
5553    }
5554
5555    public boolean hasStatusElement() { 
5556      return this.status != null && !this.status.isEmpty();
5557    }
5558
5559    public boolean hasStatus() { 
5560      return this.status != null && !this.status.isEmpty();
5561    }
5562
5563    /**
5564     * @param value {@link #status} (The status of this structure map. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
5565     */
5566    public StructureMap setStatusElement(Enumeration<PublicationStatus> value) { 
5567      this.status = value;
5568      return this;
5569    }
5570
5571    /**
5572     * @return The status of this structure map. Enables tracking the life-cycle of the content.
5573     */
5574    public PublicationStatus getStatus() { 
5575      return this.status == null ? null : this.status.getValue();
5576    }
5577
5578    /**
5579     * @param value The status of this structure map. Enables tracking the life-cycle of the content.
5580     */
5581    public StructureMap setStatus(PublicationStatus value) { 
5582        if (this.status == null)
5583          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
5584        this.status.setValue(value);
5585      return this;
5586    }
5587
5588    /**
5589     * @return {@link #experimental} (A Boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
5590     */
5591    public BooleanType getExperimentalElement() { 
5592      if (this.experimental == null)
5593        if (Configuration.errorOnAutoCreate())
5594          throw new Error("Attempt to auto-create StructureMap.experimental");
5595        else if (Configuration.doAutoCreate())
5596          this.experimental = new BooleanType(); // bb
5597      return this.experimental;
5598    }
5599
5600    public boolean hasExperimentalElement() { 
5601      return this.experimental != null && !this.experimental.isEmpty();
5602    }
5603
5604    public boolean hasExperimental() { 
5605      return this.experimental != null && !this.experimental.isEmpty();
5606    }
5607
5608    /**
5609     * @param value {@link #experimental} (A Boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
5610     */
5611    public StructureMap setExperimentalElement(BooleanType value) { 
5612      this.experimental = value;
5613      return this;
5614    }
5615
5616    /**
5617     * @return A Boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
5618     */
5619    public boolean getExperimental() { 
5620      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
5621    }
5622
5623    /**
5624     * @param value A Boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
5625     */
5626    public StructureMap setExperimental(boolean value) { 
5627        if (this.experimental == null)
5628          this.experimental = new BooleanType();
5629        this.experimental.setValue(value);
5630      return this;
5631    }
5632
5633    /**
5634     * @return {@link #date} (The date  (and optionally time) when the structure map was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
5635     */
5636    public DateTimeType getDateElement() { 
5637      if (this.date == null)
5638        if (Configuration.errorOnAutoCreate())
5639          throw new Error("Attempt to auto-create StructureMap.date");
5640        else if (Configuration.doAutoCreate())
5641          this.date = new DateTimeType(); // bb
5642      return this.date;
5643    }
5644
5645    public boolean hasDateElement() { 
5646      return this.date != null && !this.date.isEmpty();
5647    }
5648
5649    public boolean hasDate() { 
5650      return this.date != null && !this.date.isEmpty();
5651    }
5652
5653    /**
5654     * @param value {@link #date} (The date  (and optionally time) when the structure map was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
5655     */
5656    public StructureMap setDateElement(DateTimeType value) { 
5657      this.date = value;
5658      return this;
5659    }
5660
5661    /**
5662     * @return The date  (and optionally time) when the structure map was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.
5663     */
5664    public Date getDate() { 
5665      return this.date == null ? null : this.date.getValue();
5666    }
5667
5668    /**
5669     * @param value The date  (and optionally time) when the structure map was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.
5670     */
5671    public StructureMap setDate(Date value) { 
5672      if (value == null)
5673        this.date = null;
5674      else {
5675        if (this.date == null)
5676          this.date = new DateTimeType();
5677        this.date.setValue(value);
5678      }
5679      return this;
5680    }
5681
5682    /**
5683     * @return {@link #publisher} (The name of the organization or individual that published the structure map.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
5684     */
5685    public StringType getPublisherElement() { 
5686      if (this.publisher == null)
5687        if (Configuration.errorOnAutoCreate())
5688          throw new Error("Attempt to auto-create StructureMap.publisher");
5689        else if (Configuration.doAutoCreate())
5690          this.publisher = new StringType(); // bb
5691      return this.publisher;
5692    }
5693
5694    public boolean hasPublisherElement() { 
5695      return this.publisher != null && !this.publisher.isEmpty();
5696    }
5697
5698    public boolean hasPublisher() { 
5699      return this.publisher != null && !this.publisher.isEmpty();
5700    }
5701
5702    /**
5703     * @param value {@link #publisher} (The name of the organization or individual that published the structure map.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
5704     */
5705    public StructureMap setPublisherElement(StringType value) { 
5706      this.publisher = value;
5707      return this;
5708    }
5709
5710    /**
5711     * @return The name of the organization or individual that published the structure map.
5712     */
5713    public String getPublisher() { 
5714      return this.publisher == null ? null : this.publisher.getValue();
5715    }
5716
5717    /**
5718     * @param value The name of the organization or individual that published the structure map.
5719     */
5720    public StructureMap setPublisher(String value) { 
5721      if (Utilities.noString(value))
5722        this.publisher = null;
5723      else {
5724        if (this.publisher == null)
5725          this.publisher = new StringType();
5726        this.publisher.setValue(value);
5727      }
5728      return this;
5729    }
5730
5731    /**
5732     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
5733     */
5734    public List<ContactDetail> getContact() { 
5735      if (this.contact == null)
5736        this.contact = new ArrayList<ContactDetail>();
5737      return this.contact;
5738    }
5739
5740    /**
5741     * @return Returns a reference to <code>this</code> for easy method chaining
5742     */
5743    public StructureMap setContact(List<ContactDetail> theContact) { 
5744      this.contact = theContact;
5745      return this;
5746    }
5747
5748    public boolean hasContact() { 
5749      if (this.contact == null)
5750        return false;
5751      for (ContactDetail item : this.contact)
5752        if (!item.isEmpty())
5753          return true;
5754      return false;
5755    }
5756
5757    public ContactDetail addContact() { //3
5758      ContactDetail t = new ContactDetail();
5759      if (this.contact == null)
5760        this.contact = new ArrayList<ContactDetail>();
5761      this.contact.add(t);
5762      return t;
5763    }
5764
5765    public StructureMap addContact(ContactDetail t) { //3
5766      if (t == null)
5767        return this;
5768      if (this.contact == null)
5769        this.contact = new ArrayList<ContactDetail>();
5770      this.contact.add(t);
5771      return this;
5772    }
5773
5774    /**
5775     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
5776     */
5777    public ContactDetail getContactFirstRep() { 
5778      if (getContact().isEmpty()) {
5779        addContact();
5780      }
5781      return getContact().get(0);
5782    }
5783
5784    /**
5785     * @return {@link #description} (A free text natural language description of the structure map from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
5786     */
5787    public MarkdownType getDescriptionElement() { 
5788      if (this.description == null)
5789        if (Configuration.errorOnAutoCreate())
5790          throw new Error("Attempt to auto-create StructureMap.description");
5791        else if (Configuration.doAutoCreate())
5792          this.description = new MarkdownType(); // bb
5793      return this.description;
5794    }
5795
5796    public boolean hasDescriptionElement() { 
5797      return this.description != null && !this.description.isEmpty();
5798    }
5799
5800    public boolean hasDescription() { 
5801      return this.description != null && !this.description.isEmpty();
5802    }
5803
5804    /**
5805     * @param value {@link #description} (A free text natural language description of the structure map from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
5806     */
5807    public StructureMap setDescriptionElement(MarkdownType value) { 
5808      this.description = value;
5809      return this;
5810    }
5811
5812    /**
5813     * @return A free text natural language description of the structure map from a consumer's perspective.
5814     */
5815    public String getDescription() { 
5816      return this.description == null ? null : this.description.getValue();
5817    }
5818
5819    /**
5820     * @param value A free text natural language description of the structure map from a consumer's perspective.
5821     */
5822    public StructureMap setDescription(String value) { 
5823      if (value == null)
5824        this.description = null;
5825      else {
5826        if (this.description == null)
5827          this.description = new MarkdownType();
5828        this.description.setValue(value);
5829      }
5830      return this;
5831    }
5832
5833    /**
5834     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate structure map instances.)
5835     */
5836    public List<UsageContext> getUseContext() { 
5837      if (this.useContext == null)
5838        this.useContext = new ArrayList<UsageContext>();
5839      return this.useContext;
5840    }
5841
5842    /**
5843     * @return Returns a reference to <code>this</code> for easy method chaining
5844     */
5845    public StructureMap setUseContext(List<UsageContext> theUseContext) { 
5846      this.useContext = theUseContext;
5847      return this;
5848    }
5849
5850    public boolean hasUseContext() { 
5851      if (this.useContext == null)
5852        return false;
5853      for (UsageContext item : this.useContext)
5854        if (!item.isEmpty())
5855          return true;
5856      return false;
5857    }
5858
5859    public UsageContext addUseContext() { //3
5860      UsageContext t = new UsageContext();
5861      if (this.useContext == null)
5862        this.useContext = new ArrayList<UsageContext>();
5863      this.useContext.add(t);
5864      return t;
5865    }
5866
5867    public StructureMap addUseContext(UsageContext t) { //3
5868      if (t == null)
5869        return this;
5870      if (this.useContext == null)
5871        this.useContext = new ArrayList<UsageContext>();
5872      this.useContext.add(t);
5873      return this;
5874    }
5875
5876    /**
5877     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
5878     */
5879    public UsageContext getUseContextFirstRep() { 
5880      if (getUseContext().isEmpty()) {
5881        addUseContext();
5882      }
5883      return getUseContext().get(0);
5884    }
5885
5886    /**
5887     * @return {@link #jurisdiction} (A legal or geographic region in which the structure map is intended to be used.)
5888     */
5889    public List<CodeableConcept> getJurisdiction() { 
5890      if (this.jurisdiction == null)
5891        this.jurisdiction = new ArrayList<CodeableConcept>();
5892      return this.jurisdiction;
5893    }
5894
5895    /**
5896     * @return Returns a reference to <code>this</code> for easy method chaining
5897     */
5898    public StructureMap setJurisdiction(List<CodeableConcept> theJurisdiction) { 
5899      this.jurisdiction = theJurisdiction;
5900      return this;
5901    }
5902
5903    public boolean hasJurisdiction() { 
5904      if (this.jurisdiction == null)
5905        return false;
5906      for (CodeableConcept item : this.jurisdiction)
5907        if (!item.isEmpty())
5908          return true;
5909      return false;
5910    }
5911
5912    public CodeableConcept addJurisdiction() { //3
5913      CodeableConcept t = new CodeableConcept();
5914      if (this.jurisdiction == null)
5915        this.jurisdiction = new ArrayList<CodeableConcept>();
5916      this.jurisdiction.add(t);
5917      return t;
5918    }
5919
5920    public StructureMap addJurisdiction(CodeableConcept t) { //3
5921      if (t == null)
5922        return this;
5923      if (this.jurisdiction == null)
5924        this.jurisdiction = new ArrayList<CodeableConcept>();
5925      this.jurisdiction.add(t);
5926      return this;
5927    }
5928
5929    /**
5930     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
5931     */
5932    public CodeableConcept getJurisdictionFirstRep() { 
5933      if (getJurisdiction().isEmpty()) {
5934        addJurisdiction();
5935      }
5936      return getJurisdiction().get(0);
5937    }
5938
5939    /**
5940     * @return {@link #purpose} (Explanation of why this structure map is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
5941     */
5942    public MarkdownType getPurposeElement() { 
5943      if (this.purpose == null)
5944        if (Configuration.errorOnAutoCreate())
5945          throw new Error("Attempt to auto-create StructureMap.purpose");
5946        else if (Configuration.doAutoCreate())
5947          this.purpose = new MarkdownType(); // bb
5948      return this.purpose;
5949    }
5950
5951    public boolean hasPurposeElement() { 
5952      return this.purpose != null && !this.purpose.isEmpty();
5953    }
5954
5955    public boolean hasPurpose() { 
5956      return this.purpose != null && !this.purpose.isEmpty();
5957    }
5958
5959    /**
5960     * @param value {@link #purpose} (Explanation of why this structure map is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
5961     */
5962    public StructureMap setPurposeElement(MarkdownType value) { 
5963      this.purpose = value;
5964      return this;
5965    }
5966
5967    /**
5968     * @return Explanation of why this structure map is needed and why it has been designed as it has.
5969     */
5970    public String getPurpose() { 
5971      return this.purpose == null ? null : this.purpose.getValue();
5972    }
5973
5974    /**
5975     * @param value Explanation of why this structure map is needed and why it has been designed as it has.
5976     */
5977    public StructureMap setPurpose(String value) { 
5978      if (value == null)
5979        this.purpose = null;
5980      else {
5981        if (this.purpose == null)
5982          this.purpose = new MarkdownType();
5983        this.purpose.setValue(value);
5984      }
5985      return this;
5986    }
5987
5988    /**
5989     * @return {@link #copyright} (A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
5990     */
5991    public MarkdownType getCopyrightElement() { 
5992      if (this.copyright == null)
5993        if (Configuration.errorOnAutoCreate())
5994          throw new Error("Attempt to auto-create StructureMap.copyright");
5995        else if (Configuration.doAutoCreate())
5996          this.copyright = new MarkdownType(); // bb
5997      return this.copyright;
5998    }
5999
6000    public boolean hasCopyrightElement() { 
6001      return this.copyright != null && !this.copyright.isEmpty();
6002    }
6003
6004    public boolean hasCopyright() { 
6005      return this.copyright != null && !this.copyright.isEmpty();
6006    }
6007
6008    /**
6009     * @param value {@link #copyright} (A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
6010     */
6011    public StructureMap setCopyrightElement(MarkdownType value) { 
6012      this.copyright = value;
6013      return this;
6014    }
6015
6016    /**
6017     * @return A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.
6018     */
6019    public String getCopyright() { 
6020      return this.copyright == null ? null : this.copyright.getValue();
6021    }
6022
6023    /**
6024     * @param value A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.
6025     */
6026    public StructureMap setCopyright(String value) { 
6027      if (value == null)
6028        this.copyright = null;
6029      else {
6030        if (this.copyright == null)
6031          this.copyright = new MarkdownType();
6032        this.copyright.setValue(value);
6033      }
6034      return this;
6035    }
6036
6037    /**
6038     * @return {@link #structure} (A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced.)
6039     */
6040    public List<StructureMapStructureComponent> getStructure() { 
6041      if (this.structure == null)
6042        this.structure = new ArrayList<StructureMapStructureComponent>();
6043      return this.structure;
6044    }
6045
6046    /**
6047     * @return Returns a reference to <code>this</code> for easy method chaining
6048     */
6049    public StructureMap setStructure(List<StructureMapStructureComponent> theStructure) { 
6050      this.structure = theStructure;
6051      return this;
6052    }
6053
6054    public boolean hasStructure() { 
6055      if (this.structure == null)
6056        return false;
6057      for (StructureMapStructureComponent item : this.structure)
6058        if (!item.isEmpty())
6059          return true;
6060      return false;
6061    }
6062
6063    public StructureMapStructureComponent addStructure() { //3
6064      StructureMapStructureComponent t = new StructureMapStructureComponent();
6065      if (this.structure == null)
6066        this.structure = new ArrayList<StructureMapStructureComponent>();
6067      this.structure.add(t);
6068      return t;
6069    }
6070
6071    public StructureMap addStructure(StructureMapStructureComponent t) { //3
6072      if (t == null)
6073        return this;
6074      if (this.structure == null)
6075        this.structure = new ArrayList<StructureMapStructureComponent>();
6076      this.structure.add(t);
6077      return this;
6078    }
6079
6080    /**
6081     * @return The first repetition of repeating field {@link #structure}, creating it if it does not already exist
6082     */
6083    public StructureMapStructureComponent getStructureFirstRep() { 
6084      if (getStructure().isEmpty()) {
6085        addStructure();
6086      }
6087      return getStructure().get(0);
6088    }
6089
6090    /**
6091     * @return {@link #import_} (Other maps used by this map (canonical URLs).)
6092     */
6093    public List<CanonicalType> getImport() { 
6094      if (this.import_ == null)
6095        this.import_ = new ArrayList<CanonicalType>();
6096      return this.import_;
6097    }
6098
6099    /**
6100     * @return Returns a reference to <code>this</code> for easy method chaining
6101     */
6102    public StructureMap setImport(List<CanonicalType> theImport) { 
6103      this.import_ = theImport;
6104      return this;
6105    }
6106
6107    public boolean hasImport() { 
6108      if (this.import_ == null)
6109        return false;
6110      for (CanonicalType item : this.import_)
6111        if (!item.isEmpty())
6112          return true;
6113      return false;
6114    }
6115
6116    /**
6117     * @return {@link #import_} (Other maps used by this map (canonical URLs).)
6118     */
6119    public CanonicalType addImportElement() {//2 
6120      CanonicalType t = new CanonicalType();
6121      if (this.import_ == null)
6122        this.import_ = new ArrayList<CanonicalType>();
6123      this.import_.add(t);
6124      return t;
6125    }
6126
6127    /**
6128     * @param value {@link #import_} (Other maps used by this map (canonical URLs).)
6129     */
6130    public StructureMap addImport(String value) { //1
6131      CanonicalType t = new CanonicalType();
6132      t.setValue(value);
6133      if (this.import_ == null)
6134        this.import_ = new ArrayList<CanonicalType>();
6135      this.import_.add(t);
6136      return this;
6137    }
6138
6139    /**
6140     * @param value {@link #import_} (Other maps used by this map (canonical URLs).)
6141     */
6142    public boolean hasImport(String value) { 
6143      if (this.import_ == null)
6144        return false;
6145      for (CanonicalType v : this.import_)
6146        if (v.getValue().equals(value)) // canonical(StructureMap)
6147          return true;
6148      return false;
6149    }
6150
6151    /**
6152     * @return {@link #group} (Organizes the mapping into manageable chunks for human review/ease of maintenance.)
6153     */
6154    public List<StructureMapGroupComponent> getGroup() { 
6155      if (this.group == null)
6156        this.group = new ArrayList<StructureMapGroupComponent>();
6157      return this.group;
6158    }
6159
6160    /**
6161     * @return Returns a reference to <code>this</code> for easy method chaining
6162     */
6163    public StructureMap setGroup(List<StructureMapGroupComponent> theGroup) { 
6164      this.group = theGroup;
6165      return this;
6166    }
6167
6168    public boolean hasGroup() { 
6169      if (this.group == null)
6170        return false;
6171      for (StructureMapGroupComponent item : this.group)
6172        if (!item.isEmpty())
6173          return true;
6174      return false;
6175    }
6176
6177    public StructureMapGroupComponent addGroup() { //3
6178      StructureMapGroupComponent t = new StructureMapGroupComponent();
6179      if (this.group == null)
6180        this.group = new ArrayList<StructureMapGroupComponent>();
6181      this.group.add(t);
6182      return t;
6183    }
6184
6185    public StructureMap addGroup(StructureMapGroupComponent t) { //3
6186      if (t == null)
6187        return this;
6188      if (this.group == null)
6189        this.group = new ArrayList<StructureMapGroupComponent>();
6190      this.group.add(t);
6191      return this;
6192    }
6193
6194    /**
6195     * @return The first repetition of repeating field {@link #group}, creating it if it does not already exist
6196     */
6197    public StructureMapGroupComponent getGroupFirstRep() { 
6198      if (getGroup().isEmpty()) {
6199        addGroup();
6200      }
6201      return getGroup().get(0);
6202    }
6203
6204      protected void listChildren(List<Property> children) {
6205        super.listChildren(children);
6206        children.add(new Property("url", "uri", "An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which this structure map is (or will be) published.", 0, 1, url));
6207        children.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this structure map when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
6208        children.add(new Property("version", "string", "The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.", 0, 1, version));
6209        children.add(new Property("name", "string", "A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name));
6210        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the structure map.", 0, 1, title));
6211        children.add(new Property("status", "code", "The status of this structure map. Enables tracking the life-cycle of the content.", 0, 1, status));
6212        children.add(new Property("experimental", "boolean", "A Boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental));
6213        children.add(new Property("date", "dateTime", "The date  (and optionally time) when the structure map was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.", 0, 1, date));
6214        children.add(new Property("publisher", "string", "The name of the organization or individual that published the structure map.", 0, 1, publisher));
6215        children.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
6216        children.add(new Property("description", "markdown", "A free text natural language description of the structure map from a consumer's perspective.", 0, 1, description));
6217        children.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate structure map instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
6218        children.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the structure map is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
6219        children.add(new Property("purpose", "markdown", "Explanation of why this structure map is needed and why it has been designed as it has.", 0, 1, purpose));
6220        children.add(new Property("copyright", "markdown", "A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.", 0, 1, copyright));
6221        children.add(new Property("structure", "", "A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced.", 0, java.lang.Integer.MAX_VALUE, structure));
6222        children.add(new Property("import", "canonical(StructureMap)", "Other maps used by this map (canonical URLs).", 0, java.lang.Integer.MAX_VALUE, import_));
6223        children.add(new Property("group", "", "Organizes the mapping into manageable chunks for human review/ease of maintenance.", 0, java.lang.Integer.MAX_VALUE, group));
6224      }
6225
6226      @Override
6227      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6228        switch (_hash) {
6229        case 116079: /*url*/  return new Property("url", "uri", "An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which this structure map is (or will be) published.", 0, 1, url);
6230        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A formal identifier that is used to identify this structure map when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier);
6231        case 351608024: /*version*/  return new Property("version", "string", "The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.", 0, 1, version);
6232        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name);
6233        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the structure map.", 0, 1, title);
6234        case -892481550: /*status*/  return new Property("status", "code", "The status of this structure map. Enables tracking the life-cycle of the content.", 0, 1, status);
6235        case -404562712: /*experimental*/  return new Property("experimental", "boolean", "A Boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental);
6236        case 3076014: /*date*/  return new Property("date", "dateTime", "The date  (and optionally time) when the structure map was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.", 0, 1, date);
6237        case 1447404028: /*publisher*/  return new Property("publisher", "string", "The name of the organization or individual that published the structure map.", 0, 1, publisher);
6238        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact);
6239        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the structure map from a consumer's perspective.", 0, 1, description);
6240        case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate structure map instances.", 0, java.lang.Integer.MAX_VALUE, useContext);
6241        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the structure map is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
6242        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explanation of why this structure map is needed and why it has been designed as it has.", 0, 1, purpose);
6243        case 1522889671: /*copyright*/  return new Property("copyright", "markdown", "A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.", 0, 1, copyright);
6244        case 144518515: /*structure*/  return new Property("structure", "", "A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced.", 0, java.lang.Integer.MAX_VALUE, structure);
6245        case -1184795739: /*import*/  return new Property("import", "canonical(StructureMap)", "Other maps used by this map (canonical URLs).", 0, java.lang.Integer.MAX_VALUE, import_);
6246        case 98629247: /*group*/  return new Property("group", "", "Organizes the mapping into manageable chunks for human review/ease of maintenance.", 0, java.lang.Integer.MAX_VALUE, group);
6247        default: return super.getNamedProperty(_hash, _name, _checkValid);
6248        }
6249
6250      }
6251
6252      @Override
6253      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6254        switch (hash) {
6255        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
6256        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
6257        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
6258        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
6259        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
6260        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
6261        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
6262        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
6263        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
6264        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
6265        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
6266        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
6267        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
6268        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
6269        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
6270        case 144518515: /*structure*/ return this.structure == null ? new Base[0] : this.structure.toArray(new Base[this.structure.size()]); // StructureMapStructureComponent
6271        case -1184795739: /*import*/ return this.import_ == null ? new Base[0] : this.import_.toArray(new Base[this.import_.size()]); // CanonicalType
6272        case 98629247: /*group*/ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // StructureMapGroupComponent
6273        default: return super.getProperty(hash, name, checkValid);
6274        }
6275
6276      }
6277
6278      @Override
6279      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6280        switch (hash) {
6281        case 116079: // url
6282          this.url = castToUri(value); // UriType
6283          return value;
6284        case -1618432855: // identifier
6285          this.getIdentifier().add(castToIdentifier(value)); // Identifier
6286          return value;
6287        case 351608024: // version
6288          this.version = castToString(value); // StringType
6289          return value;
6290        case 3373707: // name
6291          this.name = castToString(value); // StringType
6292          return value;
6293        case 110371416: // title
6294          this.title = castToString(value); // StringType
6295          return value;
6296        case -892481550: // status
6297          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
6298          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
6299          return value;
6300        case -404562712: // experimental
6301          this.experimental = castToBoolean(value); // BooleanType
6302          return value;
6303        case 3076014: // date
6304          this.date = castToDateTime(value); // DateTimeType
6305          return value;
6306        case 1447404028: // publisher
6307          this.publisher = castToString(value); // StringType
6308          return value;
6309        case 951526432: // contact
6310          this.getContact().add(castToContactDetail(value)); // ContactDetail
6311          return value;
6312        case -1724546052: // description
6313          this.description = castToMarkdown(value); // MarkdownType
6314          return value;
6315        case -669707736: // useContext
6316          this.getUseContext().add(castToUsageContext(value)); // UsageContext
6317          return value;
6318        case -507075711: // jurisdiction
6319          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
6320          return value;
6321        case -220463842: // purpose
6322          this.purpose = castToMarkdown(value); // MarkdownType
6323          return value;
6324        case 1522889671: // copyright
6325          this.copyright = castToMarkdown(value); // MarkdownType
6326          return value;
6327        case 144518515: // structure
6328          this.getStructure().add((StructureMapStructureComponent) value); // StructureMapStructureComponent
6329          return value;
6330        case -1184795739: // import
6331          this.getImport().add(castToCanonical(value)); // CanonicalType
6332          return value;
6333        case 98629247: // group
6334          this.getGroup().add((StructureMapGroupComponent) value); // StructureMapGroupComponent
6335          return value;
6336        default: return super.setProperty(hash, name, value);
6337        }
6338
6339      }
6340
6341      @Override
6342      public Base setProperty(String name, Base value) throws FHIRException {
6343        if (name.equals("url")) {
6344          this.url = castToUri(value); // UriType
6345        } else if (name.equals("identifier")) {
6346          this.getIdentifier().add(castToIdentifier(value));
6347        } else if (name.equals("version")) {
6348          this.version = castToString(value); // StringType
6349        } else if (name.equals("name")) {
6350          this.name = castToString(value); // StringType
6351        } else if (name.equals("title")) {
6352          this.title = castToString(value); // StringType
6353        } else if (name.equals("status")) {
6354          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
6355          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
6356        } else if (name.equals("experimental")) {
6357          this.experimental = castToBoolean(value); // BooleanType
6358        } else if (name.equals("date")) {
6359          this.date = castToDateTime(value); // DateTimeType
6360        } else if (name.equals("publisher")) {
6361          this.publisher = castToString(value); // StringType
6362        } else if (name.equals("contact")) {
6363          this.getContact().add(castToContactDetail(value));
6364        } else if (name.equals("description")) {
6365          this.description = castToMarkdown(value); // MarkdownType
6366        } else if (name.equals("useContext")) {
6367          this.getUseContext().add(castToUsageContext(value));
6368        } else if (name.equals("jurisdiction")) {
6369          this.getJurisdiction().add(castToCodeableConcept(value));
6370        } else if (name.equals("purpose")) {
6371          this.purpose = castToMarkdown(value); // MarkdownType
6372        } else if (name.equals("copyright")) {
6373          this.copyright = castToMarkdown(value); // MarkdownType
6374        } else if (name.equals("structure")) {
6375          this.getStructure().add((StructureMapStructureComponent) value);
6376        } else if (name.equals("import")) {
6377          this.getImport().add(castToCanonical(value));
6378        } else if (name.equals("group")) {
6379          this.getGroup().add((StructureMapGroupComponent) value);
6380        } else
6381          return super.setProperty(name, value);
6382        return value;
6383      }
6384
6385      @Override
6386      public Base makeProperty(int hash, String name) throws FHIRException {
6387        switch (hash) {
6388        case 116079:  return getUrlElement();
6389        case -1618432855:  return addIdentifier(); 
6390        case 351608024:  return getVersionElement();
6391        case 3373707:  return getNameElement();
6392        case 110371416:  return getTitleElement();
6393        case -892481550:  return getStatusElement();
6394        case -404562712:  return getExperimentalElement();
6395        case 3076014:  return getDateElement();
6396        case 1447404028:  return getPublisherElement();
6397        case 951526432:  return addContact(); 
6398        case -1724546052:  return getDescriptionElement();
6399        case -669707736:  return addUseContext(); 
6400        case -507075711:  return addJurisdiction(); 
6401        case -220463842:  return getPurposeElement();
6402        case 1522889671:  return getCopyrightElement();
6403        case 144518515:  return addStructure(); 
6404        case -1184795739:  return addImportElement();
6405        case 98629247:  return addGroup(); 
6406        default: return super.makeProperty(hash, name);
6407        }
6408
6409      }
6410
6411      @Override
6412      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6413        switch (hash) {
6414        case 116079: /*url*/ return new String[] {"uri"};
6415        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
6416        case 351608024: /*version*/ return new String[] {"string"};
6417        case 3373707: /*name*/ return new String[] {"string"};
6418        case 110371416: /*title*/ return new String[] {"string"};
6419        case -892481550: /*status*/ return new String[] {"code"};
6420        case -404562712: /*experimental*/ return new String[] {"boolean"};
6421        case 3076014: /*date*/ return new String[] {"dateTime"};
6422        case 1447404028: /*publisher*/ return new String[] {"string"};
6423        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
6424        case -1724546052: /*description*/ return new String[] {"markdown"};
6425        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
6426        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
6427        case -220463842: /*purpose*/ return new String[] {"markdown"};
6428        case 1522889671: /*copyright*/ return new String[] {"markdown"};
6429        case 144518515: /*structure*/ return new String[] {};
6430        case -1184795739: /*import*/ return new String[] {"canonical"};
6431        case 98629247: /*group*/ return new String[] {};
6432        default: return super.getTypesForProperty(hash, name);
6433        }
6434
6435      }
6436
6437      @Override
6438      public Base addChild(String name) throws FHIRException {
6439        if (name.equals("url")) {
6440          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.url");
6441        }
6442        else if (name.equals("identifier")) {
6443          return addIdentifier();
6444        }
6445        else if (name.equals("version")) {
6446          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.version");
6447        }
6448        else if (name.equals("name")) {
6449          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
6450        }
6451        else if (name.equals("title")) {
6452          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.title");
6453        }
6454        else if (name.equals("status")) {
6455          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.status");
6456        }
6457        else if (name.equals("experimental")) {
6458          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.experimental");
6459        }
6460        else if (name.equals("date")) {
6461          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.date");
6462        }
6463        else if (name.equals("publisher")) {
6464          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.publisher");
6465        }
6466        else if (name.equals("contact")) {
6467          return addContact();
6468        }
6469        else if (name.equals("description")) {
6470          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.description");
6471        }
6472        else if (name.equals("useContext")) {
6473          return addUseContext();
6474        }
6475        else if (name.equals("jurisdiction")) {
6476          return addJurisdiction();
6477        }
6478        else if (name.equals("purpose")) {
6479          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.purpose");
6480        }
6481        else if (name.equals("copyright")) {
6482          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.copyright");
6483        }
6484        else if (name.equals("structure")) {
6485          return addStructure();
6486        }
6487        else if (name.equals("import")) {
6488          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.import");
6489        }
6490        else if (name.equals("group")) {
6491          return addGroup();
6492        }
6493        else
6494          return super.addChild(name);
6495      }
6496
6497  public String fhirType() {
6498    return "StructureMap";
6499
6500  }
6501
6502      public StructureMap copy() {
6503        StructureMap dst = new StructureMap();
6504        copyValues(dst);
6505        dst.url = url == null ? null : url.copy();
6506        if (identifier != null) {
6507          dst.identifier = new ArrayList<Identifier>();
6508          for (Identifier i : identifier)
6509            dst.identifier.add(i.copy());
6510        };
6511        dst.version = version == null ? null : version.copy();
6512        dst.name = name == null ? null : name.copy();
6513        dst.title = title == null ? null : title.copy();
6514        dst.status = status == null ? null : status.copy();
6515        dst.experimental = experimental == null ? null : experimental.copy();
6516        dst.date = date == null ? null : date.copy();
6517        dst.publisher = publisher == null ? null : publisher.copy();
6518        if (contact != null) {
6519          dst.contact = new ArrayList<ContactDetail>();
6520          for (ContactDetail i : contact)
6521            dst.contact.add(i.copy());
6522        };
6523        dst.description = description == null ? null : description.copy();
6524        if (useContext != null) {
6525          dst.useContext = new ArrayList<UsageContext>();
6526          for (UsageContext i : useContext)
6527            dst.useContext.add(i.copy());
6528        };
6529        if (jurisdiction != null) {
6530          dst.jurisdiction = new ArrayList<CodeableConcept>();
6531          for (CodeableConcept i : jurisdiction)
6532            dst.jurisdiction.add(i.copy());
6533        };
6534        dst.purpose = purpose == null ? null : purpose.copy();
6535        dst.copyright = copyright == null ? null : copyright.copy();
6536        if (structure != null) {
6537          dst.structure = new ArrayList<StructureMapStructureComponent>();
6538          for (StructureMapStructureComponent i : structure)
6539            dst.structure.add(i.copy());
6540        };
6541        if (import_ != null) {
6542          dst.import_ = new ArrayList<CanonicalType>();
6543          for (CanonicalType i : import_)
6544            dst.import_.add(i.copy());
6545        };
6546        if (group != null) {
6547          dst.group = new ArrayList<StructureMapGroupComponent>();
6548          for (StructureMapGroupComponent i : group)
6549            dst.group.add(i.copy());
6550        };
6551        return dst;
6552      }
6553
6554      protected StructureMap typedCopy() {
6555        return copy();
6556      }
6557
6558      @Override
6559      public boolean equalsDeep(Base other_) {
6560        if (!super.equalsDeep(other_))
6561          return false;
6562        if (!(other_ instanceof StructureMap))
6563          return false;
6564        StructureMap o = (StructureMap) other_;
6565        return compareDeep(identifier, o.identifier, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
6566           && compareDeep(structure, o.structure, true) && compareDeep(import_, o.import_, true) && compareDeep(group, o.group, true)
6567          ;
6568      }
6569
6570      @Override
6571      public boolean equalsShallow(Base other_) {
6572        if (!super.equalsShallow(other_))
6573          return false;
6574        if (!(other_ instanceof StructureMap))
6575          return false;
6576        StructureMap o = (StructureMap) other_;
6577        return compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true);
6578      }
6579
6580      public boolean isEmpty() {
6581        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, purpose, copyright
6582          , structure, import_, group);
6583      }
6584
6585  @Override
6586  public ResourceType getResourceType() {
6587    return ResourceType.StructureMap;
6588   }
6589
6590 /**
6591   * Search parameter: <b>date</b>
6592   * <p>
6593   * Description: <b>The structure map publication date</b><br>
6594   * Type: <b>date</b><br>
6595   * Path: <b>StructureMap.date</b><br>
6596   * </p>
6597   */
6598  @SearchParamDefinition(name="date", path="StructureMap.date", description="The structure map publication date", type="date" )
6599  public static final String SP_DATE = "date";
6600 /**
6601   * <b>Fluent Client</b> search parameter constant for <b>date</b>
6602   * <p>
6603   * Description: <b>The structure map publication date</b><br>
6604   * Type: <b>date</b><br>
6605   * Path: <b>StructureMap.date</b><br>
6606   * </p>
6607   */
6608  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
6609
6610 /**
6611   * Search parameter: <b>identifier</b>
6612   * <p>
6613   * Description: <b>External identifier for the structure map</b><br>
6614   * Type: <b>token</b><br>
6615   * Path: <b>StructureMap.identifier</b><br>
6616   * </p>
6617   */
6618  @SearchParamDefinition(name="identifier", path="StructureMap.identifier", description="External identifier for the structure map", type="token" )
6619  public static final String SP_IDENTIFIER = "identifier";
6620 /**
6621   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
6622   * <p>
6623   * Description: <b>External identifier for the structure map</b><br>
6624   * Type: <b>token</b><br>
6625   * Path: <b>StructureMap.identifier</b><br>
6626   * </p>
6627   */
6628  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
6629
6630 /**
6631   * Search parameter: <b>jurisdiction</b>
6632   * <p>
6633   * Description: <b>Intended jurisdiction for the structure map</b><br>
6634   * Type: <b>token</b><br>
6635   * Path: <b>StructureMap.jurisdiction</b><br>
6636   * </p>
6637   */
6638  @SearchParamDefinition(name="jurisdiction", path="StructureMap.jurisdiction", description="Intended jurisdiction for the structure map", type="token" )
6639  public static final String SP_JURISDICTION = "jurisdiction";
6640 /**
6641   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
6642   * <p>
6643   * Description: <b>Intended jurisdiction for the structure map</b><br>
6644   * Type: <b>token</b><br>
6645   * Path: <b>StructureMap.jurisdiction</b><br>
6646   * </p>
6647   */
6648  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
6649
6650 /**
6651   * Search parameter: <b>name</b>
6652   * <p>
6653   * Description: <b>Computationally friendly name of the structure map</b><br>
6654   * Type: <b>string</b><br>
6655   * Path: <b>StructureMap.name</b><br>
6656   * </p>
6657   */
6658  @SearchParamDefinition(name="name", path="StructureMap.name", description="Computationally friendly name of the structure map", type="string" )
6659  public static final String SP_NAME = "name";
6660 /**
6661   * <b>Fluent Client</b> search parameter constant for <b>name</b>
6662   * <p>
6663   * Description: <b>Computationally friendly name of the structure map</b><br>
6664   * Type: <b>string</b><br>
6665   * Path: <b>StructureMap.name</b><br>
6666   * </p>
6667   */
6668  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
6669
6670 /**
6671   * Search parameter: <b>description</b>
6672   * <p>
6673   * Description: <b>The description of the structure map</b><br>
6674   * Type: <b>string</b><br>
6675   * Path: <b>StructureMap.description</b><br>
6676   * </p>
6677   */
6678  @SearchParamDefinition(name="description", path="StructureMap.description", description="The description of the structure map", type="string" )
6679  public static final String SP_DESCRIPTION = "description";
6680 /**
6681   * <b>Fluent Client</b> search parameter constant for <b>description</b>
6682   * <p>
6683   * Description: <b>The description of the structure map</b><br>
6684   * Type: <b>string</b><br>
6685   * Path: <b>StructureMap.description</b><br>
6686   * </p>
6687   */
6688  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
6689
6690 /**
6691   * Search parameter: <b>publisher</b>
6692   * <p>
6693   * Description: <b>Name of the publisher of the structure map</b><br>
6694   * Type: <b>string</b><br>
6695   * Path: <b>StructureMap.publisher</b><br>
6696   * </p>
6697   */
6698  @SearchParamDefinition(name="publisher", path="StructureMap.publisher", description="Name of the publisher of the structure map", type="string" )
6699  public static final String SP_PUBLISHER = "publisher";
6700 /**
6701   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
6702   * <p>
6703   * Description: <b>Name of the publisher of the structure map</b><br>
6704   * Type: <b>string</b><br>
6705   * Path: <b>StructureMap.publisher</b><br>
6706   * </p>
6707   */
6708  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
6709
6710 /**
6711   * Search parameter: <b>title</b>
6712   * <p>
6713   * Description: <b>The human-friendly name of the structure map</b><br>
6714   * Type: <b>string</b><br>
6715   * Path: <b>StructureMap.title</b><br>
6716   * </p>
6717   */
6718  @SearchParamDefinition(name="title", path="StructureMap.title", description="The human-friendly name of the structure map", type="string" )
6719  public static final String SP_TITLE = "title";
6720 /**
6721   * <b>Fluent Client</b> search parameter constant for <b>title</b>
6722   * <p>
6723   * Description: <b>The human-friendly name of the structure map</b><br>
6724   * Type: <b>string</b><br>
6725   * Path: <b>StructureMap.title</b><br>
6726   * </p>
6727   */
6728  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
6729
6730 /**
6731   * Search parameter: <b>version</b>
6732   * <p>
6733   * Description: <b>The business version of the structure map</b><br>
6734   * Type: <b>token</b><br>
6735   * Path: <b>StructureMap.version</b><br>
6736   * </p>
6737   */
6738  @SearchParamDefinition(name="version", path="StructureMap.version", description="The business version of the structure map", type="token" )
6739  public static final String SP_VERSION = "version";
6740 /**
6741   * <b>Fluent Client</b> search parameter constant for <b>version</b>
6742   * <p>
6743   * Description: <b>The business version of the structure map</b><br>
6744   * Type: <b>token</b><br>
6745   * Path: <b>StructureMap.version</b><br>
6746   * </p>
6747   */
6748  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
6749
6750 /**
6751   * Search parameter: <b>url</b>
6752   * <p>
6753   * Description: <b>The uri that identifies the structure map</b><br>
6754   * Type: <b>uri</b><br>
6755   * Path: <b>StructureMap.url</b><br>
6756   * </p>
6757   */
6758  @SearchParamDefinition(name="url", path="StructureMap.url", description="The uri that identifies the structure map", type="uri" )
6759  public static final String SP_URL = "url";
6760 /**
6761   * <b>Fluent Client</b> search parameter constant for <b>url</b>
6762   * <p>
6763   * Description: <b>The uri that identifies the structure map</b><br>
6764   * Type: <b>uri</b><br>
6765   * Path: <b>StructureMap.url</b><br>
6766   * </p>
6767   */
6768  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
6769
6770 /**
6771   * Search parameter: <b>status</b>
6772   * <p>
6773   * Description: <b>The current status of the structure map</b><br>
6774   * Type: <b>token</b><br>
6775   * Path: <b>StructureMap.status</b><br>
6776   * </p>
6777   */
6778  @SearchParamDefinition(name="status", path="StructureMap.status", description="The current status of the structure map", type="token" )
6779  public static final String SP_STATUS = "status";
6780 /**
6781   * <b>Fluent Client</b> search parameter constant for <b>status</b>
6782   * <p>
6783   * Description: <b>The current status of the structure map</b><br>
6784   * Type: <b>token</b><br>
6785   * Path: <b>StructureMap.status</b><br>
6786   * </p>
6787   */
6788  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
6789
6790// added from java-adornments.txt:
6791
6792  public String toString() {
6793    return StructureMapUtilities.render(this);
6794  }
6795
6796
6797// end addition
6798
6799}
6800