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