001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.r4.model.Enumerations.*;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.ChildOrder;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047import org.hl7.fhir.instance.model.api.*;
048import org.hl7.fhir.exceptions.FHIRException;
049/**
050 * A structured set of questions intended to guide the collection of answers from end-users. Questionnaires provide detailed control over order, presentation, phraseology and grouping to allow coherent, consistent data collection.
051 */
052@ResourceDef(name="Questionnaire", profile="http://hl7.org/fhir/StructureDefinition/Questionnaire")
053@ChildOrder(names={"url", "identifier", "version", "name", "title", "derivedFrom", "status", "experimental", "subjectType", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "copyright", "approvalDate", "lastReviewDate", "effectivePeriod", "code", "item"})
054public class Questionnaire extends MetadataResource {
055
056    public enum QuestionnaireItemType {
057        /**
058         * An item with no direct answer but should have at least one child item.
059         */
060        GROUP, 
061        /**
062         * Text for display that will not capture an answer or have child items.
063         */
064        DISPLAY, 
065        /**
066         * An item that defines a specific answer to be captured, and which may have child items. (the answer provided in the QuestionnaireResponse should be of the defined datatype).
067         */
068        QUESTION, 
069        /**
070         * Question with a yes/no answer (valueBoolean).
071         */
072        BOOLEAN, 
073        /**
074         * Question with is a real number answer (valueDecimal).
075         */
076        DECIMAL, 
077        /**
078         * Question with an integer answer (valueInteger).
079         */
080        INTEGER, 
081        /**
082         * Question with a date answer (valueDate).
083         */
084        DATE, 
085        /**
086         * Question with a date and time answer (valueDateTime).
087         */
088        DATETIME, 
089        /**
090         * Question with a time (hour:minute:second) answer independent of date. (valueTime).
091         */
092        TIME, 
093        /**
094         * Question with a short (few words to short sentence) free-text entry answer (valueString).
095         */
096        STRING, 
097        /**
098         * Question with a long (potentially multi-paragraph) free-text entry answer (valueString).
099         */
100        TEXT, 
101        /**
102         * Question with a URL (website, FTP site, etc.) answer (valueUri).
103         */
104        URL, 
105        /**
106         * Question with a Coding drawn from a list of possible answers (specified in either the answerOption property, or via the valueset referenced in the answerValueSet property) as an answer (valueCoding).
107         */
108        CHOICE, 
109        /**
110         * Answer is a Coding drawn from a list of possible answers (as with the choice type) or a free-text entry in a string (valueCoding or valueString).
111         */
112        OPENCHOICE, 
113        /**
114         * Question with binary content such as an image, PDF, etc. as an answer (valueAttachment).
115         */
116        ATTACHMENT, 
117        /**
118         * Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference).
119         */
120        REFERENCE, 
121        /**
122         * Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity) There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit should be captured (or the unit that has a ucum conversion from the provided unit).
123         */
124        QUANTITY, 
125        /**
126         * added to help the parsers with the generic types
127         */
128        NULL;
129        public static QuestionnaireItemType fromCode(String codeString) throws FHIRException {
130            if (codeString == null || "".equals(codeString))
131                return null;
132        if ("group".equals(codeString))
133          return GROUP;
134        if ("display".equals(codeString))
135          return DISPLAY;
136        if ("question".equals(codeString))
137          return QUESTION;
138        if ("boolean".equals(codeString))
139          return BOOLEAN;
140        if ("decimal".equals(codeString))
141          return DECIMAL;
142        if ("integer".equals(codeString))
143          return INTEGER;
144        if ("date".equals(codeString))
145          return DATE;
146        if ("dateTime".equals(codeString))
147          return DATETIME;
148        if ("time".equals(codeString))
149          return TIME;
150        if ("string".equals(codeString))
151          return STRING;
152        if ("text".equals(codeString))
153          return TEXT;
154        if ("url".equals(codeString))
155          return URL;
156        if ("choice".equals(codeString))
157          return CHOICE;
158        if ("open-choice".equals(codeString))
159          return OPENCHOICE;
160        if ("attachment".equals(codeString))
161          return ATTACHMENT;
162        if ("reference".equals(codeString))
163          return REFERENCE;
164        if ("quantity".equals(codeString))
165          return QUANTITY;
166        if (Configuration.isAcceptInvalidEnums())
167          return null;
168        else
169          throw new FHIRException("Unknown QuestionnaireItemType code '"+codeString+"'");
170        }
171        public String toCode() {
172          switch (this) {
173            case GROUP: return "group";
174            case DISPLAY: return "display";
175            case QUESTION: return "question";
176            case BOOLEAN: return "boolean";
177            case DECIMAL: return "decimal";
178            case INTEGER: return "integer";
179            case DATE: return "date";
180            case DATETIME: return "dateTime";
181            case TIME: return "time";
182            case STRING: return "string";
183            case TEXT: return "text";
184            case URL: return "url";
185            case CHOICE: return "choice";
186            case OPENCHOICE: return "open-choice";
187            case ATTACHMENT: return "attachment";
188            case REFERENCE: return "reference";
189            case QUANTITY: return "quantity";
190            case NULL: return null;
191            default: return "?";
192          }
193        }
194        public String getSystem() {
195          switch (this) {
196            case GROUP: return "http://hl7.org/fhir/item-type";
197            case DISPLAY: return "http://hl7.org/fhir/item-type";
198            case QUESTION: return "http://hl7.org/fhir/item-type";
199            case BOOLEAN: return "http://hl7.org/fhir/item-type";
200            case DECIMAL: return "http://hl7.org/fhir/item-type";
201            case INTEGER: return "http://hl7.org/fhir/item-type";
202            case DATE: return "http://hl7.org/fhir/item-type";
203            case DATETIME: return "http://hl7.org/fhir/item-type";
204            case TIME: return "http://hl7.org/fhir/item-type";
205            case STRING: return "http://hl7.org/fhir/item-type";
206            case TEXT: return "http://hl7.org/fhir/item-type";
207            case URL: return "http://hl7.org/fhir/item-type";
208            case CHOICE: return "http://hl7.org/fhir/item-type";
209            case OPENCHOICE: return "http://hl7.org/fhir/item-type";
210            case ATTACHMENT: return "http://hl7.org/fhir/item-type";
211            case REFERENCE: return "http://hl7.org/fhir/item-type";
212            case QUANTITY: return "http://hl7.org/fhir/item-type";
213            case NULL: return null;
214            default: return "?";
215          }
216        }
217        public String getDefinition() {
218          switch (this) {
219            case GROUP: return "An item with no direct answer but should have at least one child item.";
220            case DISPLAY: return "Text for display that will not capture an answer or have child items.";
221            case QUESTION: return "An item that defines a specific answer to be captured, and which may have child items. (the answer provided in the QuestionnaireResponse should be of the defined datatype).";
222            case BOOLEAN: return "Question with a yes/no answer (valueBoolean).";
223            case DECIMAL: return "Question with is a real number answer (valueDecimal).";
224            case INTEGER: return "Question with an integer answer (valueInteger).";
225            case DATE: return "Question with a date answer (valueDate).";
226            case DATETIME: return "Question with a date and time answer (valueDateTime).";
227            case TIME: return "Question with a time (hour:minute:second) answer independent of date. (valueTime).";
228            case STRING: return "Question with a short (few words to short sentence) free-text entry answer (valueString).";
229            case TEXT: return "Question with a long (potentially multi-paragraph) free-text entry answer (valueString).";
230            case URL: return "Question with a URL (website, FTP site, etc.) answer (valueUri).";
231            case CHOICE: return "Question with a Coding drawn from a list of possible answers (specified in either the answerOption property, or via the valueset referenced in the answerValueSet property) as an answer (valueCoding).";
232            case OPENCHOICE: return "Answer is a Coding drawn from a list of possible answers (as with the choice type) or a free-text entry in a string (valueCoding or valueString).";
233            case ATTACHMENT: return "Question with binary content such as an image, PDF, etc. as an answer (valueAttachment).";
234            case REFERENCE: return "Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference).";
235            case QUANTITY: return "Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity) There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit should be captured (or the unit that has a ucum conversion from the provided unit).";
236            case NULL: return null;
237            default: return "?";
238          }
239        }
240        public String getDisplay() {
241          switch (this) {
242            case GROUP: return "Group";
243            case DISPLAY: return "Display";
244            case QUESTION: return "Question";
245            case BOOLEAN: return "Boolean";
246            case DECIMAL: return "Decimal";
247            case INTEGER: return "Integer";
248            case DATE: return "Date";
249            case DATETIME: return "Date Time";
250            case TIME: return "Time";
251            case STRING: return "String";
252            case TEXT: return "Text";
253            case URL: return "Url";
254            case CHOICE: return "Choice";
255            case OPENCHOICE: return "Open Choice";
256            case ATTACHMENT: return "Attachment";
257            case REFERENCE: return "Reference";
258            case QUANTITY: return "Quantity";
259            case NULL: return null;
260            default: return "?";
261          }
262        }
263    }
264
265  public static class QuestionnaireItemTypeEnumFactory implements EnumFactory<QuestionnaireItemType> {
266    public QuestionnaireItemType fromCode(String codeString) throws IllegalArgumentException {
267      if (codeString == null || "".equals(codeString))
268            if (codeString == null || "".equals(codeString))
269                return null;
270        if ("group".equals(codeString))
271          return QuestionnaireItemType.GROUP;
272        if ("display".equals(codeString))
273          return QuestionnaireItemType.DISPLAY;
274        if ("question".equals(codeString))
275          return QuestionnaireItemType.QUESTION;
276        if ("boolean".equals(codeString))
277          return QuestionnaireItemType.BOOLEAN;
278        if ("decimal".equals(codeString))
279          return QuestionnaireItemType.DECIMAL;
280        if ("integer".equals(codeString))
281          return QuestionnaireItemType.INTEGER;
282        if ("date".equals(codeString))
283          return QuestionnaireItemType.DATE;
284        if ("dateTime".equals(codeString))
285          return QuestionnaireItemType.DATETIME;
286        if ("time".equals(codeString))
287          return QuestionnaireItemType.TIME;
288        if ("string".equals(codeString))
289          return QuestionnaireItemType.STRING;
290        if ("text".equals(codeString))
291          return QuestionnaireItemType.TEXT;
292        if ("url".equals(codeString))
293          return QuestionnaireItemType.URL;
294        if ("choice".equals(codeString))
295          return QuestionnaireItemType.CHOICE;
296        if ("open-choice".equals(codeString))
297          return QuestionnaireItemType.OPENCHOICE;
298        if ("attachment".equals(codeString))
299          return QuestionnaireItemType.ATTACHMENT;
300        if ("reference".equals(codeString))
301          return QuestionnaireItemType.REFERENCE;
302        if ("quantity".equals(codeString))
303          return QuestionnaireItemType.QUANTITY;
304        throw new IllegalArgumentException("Unknown QuestionnaireItemType code '"+codeString+"'");
305        }
306        public Enumeration<QuestionnaireItemType> fromType(Base code) throws FHIRException {
307          if (code == null)
308            return null;
309          if (code.isEmpty())
310            return new Enumeration<QuestionnaireItemType>(this);
311          String codeString = ((PrimitiveType) code).asStringValue();
312          if (codeString == null || "".equals(codeString))
313            return null;
314        if ("group".equals(codeString))
315          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.GROUP);
316        if ("display".equals(codeString))
317          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DISPLAY);
318        if ("question".equals(codeString))
319          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.QUESTION);
320        if ("boolean".equals(codeString))
321          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.BOOLEAN);
322        if ("decimal".equals(codeString))
323          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DECIMAL);
324        if ("integer".equals(codeString))
325          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.INTEGER);
326        if ("date".equals(codeString))
327          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DATE);
328        if ("dateTime".equals(codeString))
329          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DATETIME);
330        if ("time".equals(codeString))
331          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.TIME);
332        if ("string".equals(codeString))
333          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.STRING);
334        if ("text".equals(codeString))
335          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.TEXT);
336        if ("url".equals(codeString))
337          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.URL);
338        if ("choice".equals(codeString))
339          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.CHOICE);
340        if ("open-choice".equals(codeString))
341          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.OPENCHOICE);
342        if ("attachment".equals(codeString))
343          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.ATTACHMENT);
344        if ("reference".equals(codeString))
345          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.REFERENCE);
346        if ("quantity".equals(codeString))
347          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.QUANTITY);
348        throw new FHIRException("Unknown QuestionnaireItemType code '"+codeString+"'");
349        }
350    public String toCode(QuestionnaireItemType code) {
351      if (code == QuestionnaireItemType.GROUP)
352        return "group";
353      if (code == QuestionnaireItemType.DISPLAY)
354        return "display";
355      if (code == QuestionnaireItemType.QUESTION)
356        return "question";
357      if (code == QuestionnaireItemType.BOOLEAN)
358        return "boolean";
359      if (code == QuestionnaireItemType.DECIMAL)
360        return "decimal";
361      if (code == QuestionnaireItemType.INTEGER)
362        return "integer";
363      if (code == QuestionnaireItemType.DATE)
364        return "date";
365      if (code == QuestionnaireItemType.DATETIME)
366        return "dateTime";
367      if (code == QuestionnaireItemType.TIME)
368        return "time";
369      if (code == QuestionnaireItemType.STRING)
370        return "string";
371      if (code == QuestionnaireItemType.TEXT)
372        return "text";
373      if (code == QuestionnaireItemType.URL)
374        return "url";
375      if (code == QuestionnaireItemType.CHOICE)
376        return "choice";
377      if (code == QuestionnaireItemType.OPENCHOICE)
378        return "open-choice";
379      if (code == QuestionnaireItemType.ATTACHMENT)
380        return "attachment";
381      if (code == QuestionnaireItemType.REFERENCE)
382        return "reference";
383      if (code == QuestionnaireItemType.QUANTITY)
384        return "quantity";
385      return "?";
386      }
387    public String toSystem(QuestionnaireItemType code) {
388      return code.getSystem();
389      }
390    }
391
392    public enum QuestionnaireItemOperator {
393        /**
394         * True if whether an answer exists is equal to the enableWhen answer (which must be a boolean).
395         */
396        EXISTS, 
397        /**
398         * True if whether at least one answer has a value that is equal to the enableWhen answer.
399         */
400        EQUAL, 
401        /**
402         * True if whether at least no answer has a value that is equal to the enableWhen answer.
403         */
404        NOT_EQUAL, 
405        /**
406         * True if whether at least no answer has a value that is greater than the enableWhen answer.
407         */
408        GREATER_THAN, 
409        /**
410         * True if whether at least no answer has a value that is less than the enableWhen answer.
411         */
412        LESS_THAN, 
413        /**
414         * True if whether at least no answer has a value that is greater or equal to the enableWhen answer.
415         */
416        GREATER_OR_EQUAL, 
417        /**
418         * True if whether at least no answer has a value that is less or equal to the enableWhen answer.
419         */
420        LESS_OR_EQUAL, 
421        /**
422         * added to help the parsers with the generic types
423         */
424        NULL;
425        public static QuestionnaireItemOperator fromCode(String codeString) throws FHIRException {
426            if (codeString == null || "".equals(codeString))
427                return null;
428        if ("exists".equals(codeString))
429          return EXISTS;
430        if ("=".equals(codeString))
431          return EQUAL;
432        if ("!=".equals(codeString))
433          return NOT_EQUAL;
434        if (">".equals(codeString))
435          return GREATER_THAN;
436        if ("<".equals(codeString))
437          return LESS_THAN;
438        if (">=".equals(codeString))
439          return GREATER_OR_EQUAL;
440        if ("<=".equals(codeString))
441          return LESS_OR_EQUAL;
442        if (Configuration.isAcceptInvalidEnums())
443          return null;
444        else
445          throw new FHIRException("Unknown QuestionnaireItemOperator code '"+codeString+"'");
446        }
447        public String toCode() {
448          switch (this) {
449            case EXISTS: return "exists";
450            case EQUAL: return "=";
451            case NOT_EQUAL: return "!=";
452            case GREATER_THAN: return ">";
453            case LESS_THAN: return "<";
454            case GREATER_OR_EQUAL: return ">=";
455            case LESS_OR_EQUAL: return "<=";
456            case NULL: return null;
457            default: return "?";
458          }
459        }
460        public String getSystem() {
461          switch (this) {
462            case EXISTS: return "http://hl7.org/fhir/questionnaire-enable-operator";
463            case EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
464            case NOT_EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
465            case GREATER_THAN: return "http://hl7.org/fhir/questionnaire-enable-operator";
466            case LESS_THAN: return "http://hl7.org/fhir/questionnaire-enable-operator";
467            case GREATER_OR_EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
468            case LESS_OR_EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
469            case NULL: return null;
470            default: return "?";
471          }
472        }
473        public String getDefinition() {
474          switch (this) {
475            case EXISTS: return "True if whether an answer exists is equal to the enableWhen answer (which must be a boolean).";
476            case EQUAL: return "True if whether at least one answer has a value that is equal to the enableWhen answer.";
477            case NOT_EQUAL: return "True if whether at least no answer has a value that is equal to the enableWhen answer.";
478            case GREATER_THAN: return "True if whether at least no answer has a value that is greater than the enableWhen answer.";
479            case LESS_THAN: return "True if whether at least no answer has a value that is less than the enableWhen answer.";
480            case GREATER_OR_EQUAL: return "True if whether at least no answer has a value that is greater or equal to the enableWhen answer.";
481            case LESS_OR_EQUAL: return "True if whether at least no answer has a value that is less or equal to the enableWhen answer.";
482            case NULL: return null;
483            default: return "?";
484          }
485        }
486        public String getDisplay() {
487          switch (this) {
488            case EXISTS: return "Exists";
489            case EQUAL: return "Equals";
490            case NOT_EQUAL: return "Not Equals";
491            case GREATER_THAN: return "Greater Than";
492            case LESS_THAN: return "Less Than";
493            case GREATER_OR_EQUAL: return "Greater or Equals";
494            case LESS_OR_EQUAL: return "Less or Equals";
495            case NULL: return null;
496            default: return "?";
497          }
498        }
499    }
500
501  public static class QuestionnaireItemOperatorEnumFactory implements EnumFactory<QuestionnaireItemOperator> {
502    public QuestionnaireItemOperator fromCode(String codeString) throws IllegalArgumentException {
503      if (codeString == null || "".equals(codeString))
504            if (codeString == null || "".equals(codeString))
505                return null;
506        if ("exists".equals(codeString))
507          return QuestionnaireItemOperator.EXISTS;
508        if ("=".equals(codeString))
509          return QuestionnaireItemOperator.EQUAL;
510        if ("!=".equals(codeString))
511          return QuestionnaireItemOperator.NOT_EQUAL;
512        if (">".equals(codeString))
513          return QuestionnaireItemOperator.GREATER_THAN;
514        if ("<".equals(codeString))
515          return QuestionnaireItemOperator.LESS_THAN;
516        if (">=".equals(codeString))
517          return QuestionnaireItemOperator.GREATER_OR_EQUAL;
518        if ("<=".equals(codeString))
519          return QuestionnaireItemOperator.LESS_OR_EQUAL;
520        throw new IllegalArgumentException("Unknown QuestionnaireItemOperator code '"+codeString+"'");
521        }
522        public Enumeration<QuestionnaireItemOperator> fromType(Base code) throws FHIRException {
523          if (code == null)
524            return null;
525          if (code.isEmpty())
526            return new Enumeration<QuestionnaireItemOperator>(this);
527          String codeString = ((PrimitiveType) code).asStringValue();
528          if (codeString == null || "".equals(codeString))
529            return null;
530        if ("exists".equals(codeString))
531          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.EXISTS);
532        if ("=".equals(codeString))
533          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.EQUAL);
534        if ("!=".equals(codeString))
535          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.NOT_EQUAL);
536        if (">".equals(codeString))
537          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.GREATER_THAN);
538        if ("<".equals(codeString))
539          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.LESS_THAN);
540        if (">=".equals(codeString))
541          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.GREATER_OR_EQUAL);
542        if ("<=".equals(codeString))
543          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.LESS_OR_EQUAL);
544        throw new FHIRException("Unknown QuestionnaireItemOperator code '"+codeString+"'");
545        }
546    public String toCode(QuestionnaireItemOperator code) {
547      if (code == QuestionnaireItemOperator.EXISTS)
548        return "exists";
549      if (code == QuestionnaireItemOperator.EQUAL)
550        return "=";
551      if (code == QuestionnaireItemOperator.NOT_EQUAL)
552        return "!=";
553      if (code == QuestionnaireItemOperator.GREATER_THAN)
554        return ">";
555      if (code == QuestionnaireItemOperator.LESS_THAN)
556        return "<";
557      if (code == QuestionnaireItemOperator.GREATER_OR_EQUAL)
558        return ">=";
559      if (code == QuestionnaireItemOperator.LESS_OR_EQUAL)
560        return "<=";
561      return "?";
562      }
563    public String toSystem(QuestionnaireItemOperator code) {
564      return code.getSystem();
565      }
566    }
567
568    public enum EnableWhenBehavior {
569        /**
570         * Enable the question when all the enableWhen criteria are satisfied.
571         */
572        ALL, 
573        /**
574         * Enable the question when any of the enableWhen criteria are satisfied.
575         */
576        ANY, 
577        /**
578         * added to help the parsers with the generic types
579         */
580        NULL;
581        public static EnableWhenBehavior fromCode(String codeString) throws FHIRException {
582            if (codeString == null || "".equals(codeString))
583                return null;
584        if ("all".equals(codeString))
585          return ALL;
586        if ("any".equals(codeString))
587          return ANY;
588        if (Configuration.isAcceptInvalidEnums())
589          return null;
590        else
591          throw new FHIRException("Unknown EnableWhenBehavior code '"+codeString+"'");
592        }
593        public String toCode() {
594          switch (this) {
595            case ALL: return "all";
596            case ANY: return "any";
597            case NULL: return null;
598            default: return "?";
599          }
600        }
601        public String getSystem() {
602          switch (this) {
603            case ALL: return "http://hl7.org/fhir/questionnaire-enable-behavior";
604            case ANY: return "http://hl7.org/fhir/questionnaire-enable-behavior";
605            case NULL: return null;
606            default: return "?";
607          }
608        }
609        public String getDefinition() {
610          switch (this) {
611            case ALL: return "Enable the question when all the enableWhen criteria are satisfied.";
612            case ANY: return "Enable the question when any of the enableWhen criteria are satisfied.";
613            case NULL: return null;
614            default: return "?";
615          }
616        }
617        public String getDisplay() {
618          switch (this) {
619            case ALL: return "All";
620            case ANY: return "Any";
621            case NULL: return null;
622            default: return "?";
623          }
624        }
625    }
626
627  public static class EnableWhenBehaviorEnumFactory implements EnumFactory<EnableWhenBehavior> {
628    public EnableWhenBehavior fromCode(String codeString) throws IllegalArgumentException {
629      if (codeString == null || "".equals(codeString))
630            if (codeString == null || "".equals(codeString))
631                return null;
632        if ("all".equals(codeString))
633          return EnableWhenBehavior.ALL;
634        if ("any".equals(codeString))
635          return EnableWhenBehavior.ANY;
636        throw new IllegalArgumentException("Unknown EnableWhenBehavior code '"+codeString+"'");
637        }
638        public Enumeration<EnableWhenBehavior> fromType(Base code) throws FHIRException {
639          if (code == null)
640            return null;
641          if (code.isEmpty())
642            return new Enumeration<EnableWhenBehavior>(this);
643          String codeString = ((PrimitiveType) code).asStringValue();
644          if (codeString == null || "".equals(codeString))
645            return null;
646        if ("all".equals(codeString))
647          return new Enumeration<EnableWhenBehavior>(this, EnableWhenBehavior.ALL);
648        if ("any".equals(codeString))
649          return new Enumeration<EnableWhenBehavior>(this, EnableWhenBehavior.ANY);
650        throw new FHIRException("Unknown EnableWhenBehavior code '"+codeString+"'");
651        }
652    public String toCode(EnableWhenBehavior code) {
653      if (code == EnableWhenBehavior.ALL)
654        return "all";
655      if (code == EnableWhenBehavior.ANY)
656        return "any";
657      return "?";
658      }
659    public String toSystem(EnableWhenBehavior code) {
660      return code.getSystem();
661      }
662    }
663
664    @Block()
665    public static class QuestionnaireItemComponent extends BackboneElement implements IBaseBackboneElement {
666        /**
667         * An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
668         */
669        @Child(name = "linkId", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
670        @Description(shortDefinition="Unique id for item in questionnaire", formalDefinition="An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource." )
671        protected StringType linkId;
672
673        /**
674         * This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:
675
676* code (ElementDefinition.code) 
677* type (ElementDefinition.type) 
678* required (ElementDefinition.min) 
679* repeats (ElementDefinition.max) 
680* maxLength (ElementDefinition.maxLength) 
681* answerValueSet (ElementDefinition.binding)
682* options (ElementDefinition.binding).
683         */
684        @Child(name = "definition", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
685        @Description(shortDefinition="ElementDefinition - details for the item", formalDefinition="This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:\n\n* code (ElementDefinition.code) \n* type (ElementDefinition.type) \n* required (ElementDefinition.min) \n* repeats (ElementDefinition.max) \n* maxLength (ElementDefinition.maxLength) \n* answerValueSet (ElementDefinition.binding)\n* options (ElementDefinition.binding)." )
686        protected UriType definition;
687
688        /**
689         * A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).
690         */
691        @Child(name = "code", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
692        @Description(shortDefinition="Corresponding concept for this item in a terminology", formalDefinition="A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers)." )
693        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-questions")
694        protected List<Coding> code;
695
696        /**
697         * A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.
698         */
699        @Child(name = "prefix", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
700        @Description(shortDefinition="E.g. \"1(a)\", \"2.5.3\"", formalDefinition="A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire." )
701        protected StringType prefix;
702
703        /**
704         * The name of a section, the text of a question or text content for a display item.
705         */
706        @Child(name = "text", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
707        @Description(shortDefinition="Primary text for the item", formalDefinition="The name of a section, the text of a question or text content for a display item." )
708        protected StringType text;
709
710        /**
711         * The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).
712         */
713        @Child(name = "type", type = {CodeType.class}, order=6, min=1, max=1, modifier=false, summary=false)
714        @Description(shortDefinition="group | display | boolean | decimal | integer | date | dateTime +", formalDefinition="The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.)." )
715        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/item-type")
716        protected Enumeration<QuestionnaireItemType> type;
717
718        /**
719         * A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.
720         */
721        @Child(name = "enableWhen", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=false)
722        @Description(shortDefinition="Only allow data when", formalDefinition="A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true." )
723        protected List<QuestionnaireItemEnableWhenComponent> enableWhen;
724
725        /**
726         * Controls how multiple enableWhen values are interpreted -  whether all or any must be true.
727         */
728        @Child(name = "enableBehavior", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=false)
729        @Description(shortDefinition="all | any", formalDefinition="Controls how multiple enableWhen values are interpreted -  whether all or any must be true." )
730        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-enable-behavior")
731        protected Enumeration<EnableWhenBehavior> enableBehavior;
732
733        /**
734         * An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.
735         */
736        @Child(name = "required", type = {BooleanType.class}, order=9, min=0, max=1, modifier=false, summary=false)
737        @Description(shortDefinition="Whether the item must be included in data results", formalDefinition="An indication, if true, that the item must be present in a \"completed\" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire." )
738        protected BooleanType required;
739
740        /**
741         * An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.
742         */
743        @Child(name = "repeats", type = {BooleanType.class}, order=10, min=0, max=1, modifier=false, summary=false)
744        @Description(shortDefinition="Whether the item may repeat", formalDefinition="An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups." )
745        protected BooleanType repeats;
746
747        /**
748         * An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
749         */
750        @Child(name = "readOnly", type = {BooleanType.class}, order=11, min=0, max=1, modifier=false, summary=false)
751        @Description(shortDefinition="Don't allow human editing", formalDefinition="An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire." )
752        protected BooleanType readOnly;
753
754        /**
755         * The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
756         */
757        @Child(name = "maxLength", type = {IntegerType.class}, order=12, min=0, max=1, modifier=false, summary=false)
758        @Description(shortDefinition="No more than this many characters", formalDefinition="The maximum number of characters that are permitted in the answer to be considered a \"valid\" QuestionnaireResponse." )
759        protected IntegerType maxLength;
760
761        /**
762         * A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.
763         */
764        @Child(name = "answerValueSet", type = {CanonicalType.class}, order=13, min=0, max=1, modifier=false, summary=false)
765        @Description(shortDefinition="Valueset containing permitted answers", formalDefinition="A reference to a value set containing a list of codes representing permitted answers for a \"choice\" or \"open-choice\" question." )
766        protected CanonicalType answerValueSet;
767
768        /**
769         * One of the permitted answers for a "choice" or "open-choice" question.
770         */
771        @Child(name = "answerOption", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
772        @Description(shortDefinition="Permitted answer", formalDefinition="One of the permitted answers for a \"choice\" or \"open-choice\" question." )
773        protected List<QuestionnaireItemAnswerOptionComponent> answerOption;
774
775        /**
776         * One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.
777         */
778        @Child(name = "initial", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
779        @Description(shortDefinition="Initial value(s) when item is first rendered", formalDefinition="One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input." )
780        protected List<QuestionnaireItemInitialComponent> initial;
781
782        /**
783         * Text, questions and other groups to be nested beneath a question or group.
784         */
785        @Child(name = "item", type = {QuestionnaireItemComponent.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
786        @Description(shortDefinition="Nested questionnaire items", formalDefinition="Text, questions and other groups to be nested beneath a question or group." )
787        protected List<QuestionnaireItemComponent> item;
788
789        private static final long serialVersionUID = -1503380450L;
790
791    /**
792     * Constructor
793     */
794      public QuestionnaireItemComponent() {
795        super();
796      }
797
798    /**
799     * Constructor
800     */
801      public QuestionnaireItemComponent(StringType linkId, Enumeration<QuestionnaireItemType> type) {
802        super();
803        this.linkId = linkId;
804        this.type = type;
805      }
806
807        /**
808         * @return {@link #linkId} (An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value
809         */
810        public StringType getLinkIdElement() { 
811          if (this.linkId == null)
812            if (Configuration.errorOnAutoCreate())
813              throw new Error("Attempt to auto-create QuestionnaireItemComponent.linkId");
814            else if (Configuration.doAutoCreate())
815              this.linkId = new StringType(); // bb
816          return this.linkId;
817        }
818
819        public boolean hasLinkIdElement() { 
820          return this.linkId != null && !this.linkId.isEmpty();
821        }
822
823        public boolean hasLinkId() { 
824          return this.linkId != null && !this.linkId.isEmpty();
825        }
826
827        /**
828         * @param value {@link #linkId} (An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value
829         */
830        public QuestionnaireItemComponent setLinkIdElement(StringType value) { 
831          this.linkId = value;
832          return this;
833        }
834
835        /**
836         * @return An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
837         */
838        public String getLinkId() { 
839          return this.linkId == null ? null : this.linkId.getValue();
840        }
841
842        /**
843         * @param value An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
844         */
845        public QuestionnaireItemComponent setLinkId(String value) { 
846            if (this.linkId == null)
847              this.linkId = new StringType();
848            this.linkId.setValue(value);
849          return this;
850        }
851
852        /**
853         * @return {@link #definition} (This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:
854
855* code (ElementDefinition.code) 
856* type (ElementDefinition.type) 
857* required (ElementDefinition.min) 
858* repeats (ElementDefinition.max) 
859* maxLength (ElementDefinition.maxLength) 
860* answerValueSet (ElementDefinition.binding)
861* options (ElementDefinition.binding).). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
862         */
863        public UriType getDefinitionElement() { 
864          if (this.definition == null)
865            if (Configuration.errorOnAutoCreate())
866              throw new Error("Attempt to auto-create QuestionnaireItemComponent.definition");
867            else if (Configuration.doAutoCreate())
868              this.definition = new UriType(); // bb
869          return this.definition;
870        }
871
872        public boolean hasDefinitionElement() { 
873          return this.definition != null && !this.definition.isEmpty();
874        }
875
876        public boolean hasDefinition() { 
877          return this.definition != null && !this.definition.isEmpty();
878        }
879
880        /**
881         * @param value {@link #definition} (This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:
882
883* code (ElementDefinition.code) 
884* type (ElementDefinition.type) 
885* required (ElementDefinition.min) 
886* repeats (ElementDefinition.max) 
887* maxLength (ElementDefinition.maxLength) 
888* answerValueSet (ElementDefinition.binding)
889* options (ElementDefinition.binding).). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
890         */
891        public QuestionnaireItemComponent setDefinitionElement(UriType value) { 
892          this.definition = value;
893          return this;
894        }
895
896        /**
897         * @return This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:
898
899* code (ElementDefinition.code) 
900* type (ElementDefinition.type) 
901* required (ElementDefinition.min) 
902* repeats (ElementDefinition.max) 
903* maxLength (ElementDefinition.maxLength) 
904* answerValueSet (ElementDefinition.binding)
905* options (ElementDefinition.binding).
906         */
907        public String getDefinition() { 
908          return this.definition == null ? null : this.definition.getValue();
909        }
910
911        /**
912         * @param value This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:
913
914* code (ElementDefinition.code) 
915* type (ElementDefinition.type) 
916* required (ElementDefinition.min) 
917* repeats (ElementDefinition.max) 
918* maxLength (ElementDefinition.maxLength) 
919* answerValueSet (ElementDefinition.binding)
920* options (ElementDefinition.binding).
921         */
922        public QuestionnaireItemComponent setDefinition(String value) { 
923          if (Utilities.noString(value))
924            this.definition = null;
925          else {
926            if (this.definition == null)
927              this.definition = new UriType();
928            this.definition.setValue(value);
929          }
930          return this;
931        }
932
933        /**
934         * @return {@link #code} (A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).)
935         */
936        public List<Coding> getCode() { 
937          if (this.code == null)
938            this.code = new ArrayList<Coding>();
939          return this.code;
940        }
941
942        /**
943         * @return Returns a reference to <code>this</code> for easy method chaining
944         */
945        public QuestionnaireItemComponent setCode(List<Coding> theCode) { 
946          this.code = theCode;
947          return this;
948        }
949
950        public boolean hasCode() { 
951          if (this.code == null)
952            return false;
953          for (Coding item : this.code)
954            if (!item.isEmpty())
955              return true;
956          return false;
957        }
958
959        public Coding addCode() { //3
960          Coding t = new Coding();
961          if (this.code == null)
962            this.code = new ArrayList<Coding>();
963          this.code.add(t);
964          return t;
965        }
966
967        public QuestionnaireItemComponent addCode(Coding t) { //3
968          if (t == null)
969            return this;
970          if (this.code == null)
971            this.code = new ArrayList<Coding>();
972          this.code.add(t);
973          return this;
974        }
975
976        /**
977         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
978         */
979        public Coding getCodeFirstRep() { 
980          if (getCode().isEmpty()) {
981            addCode();
982          }
983          return getCode().get(0);
984        }
985
986        /**
987         * @return {@link #prefix} (A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
988         */
989        public StringType getPrefixElement() { 
990          if (this.prefix == null)
991            if (Configuration.errorOnAutoCreate())
992              throw new Error("Attempt to auto-create QuestionnaireItemComponent.prefix");
993            else if (Configuration.doAutoCreate())
994              this.prefix = new StringType(); // bb
995          return this.prefix;
996        }
997
998        public boolean hasPrefixElement() { 
999          return this.prefix != null && !this.prefix.isEmpty();
1000        }
1001
1002        public boolean hasPrefix() { 
1003          return this.prefix != null && !this.prefix.isEmpty();
1004        }
1005
1006        /**
1007         * @param value {@link #prefix} (A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
1008         */
1009        public QuestionnaireItemComponent setPrefixElement(StringType value) { 
1010          this.prefix = value;
1011          return this;
1012        }
1013
1014        /**
1015         * @return A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.
1016         */
1017        public String getPrefix() { 
1018          return this.prefix == null ? null : this.prefix.getValue();
1019        }
1020
1021        /**
1022         * @param value A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.
1023         */
1024        public QuestionnaireItemComponent setPrefix(String value) { 
1025          if (Utilities.noString(value))
1026            this.prefix = null;
1027          else {
1028            if (this.prefix == null)
1029              this.prefix = new StringType();
1030            this.prefix.setValue(value);
1031          }
1032          return this;
1033        }
1034
1035        /**
1036         * @return {@link #text} (The name of a section, the text of a question or text content for a display item.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
1037         */
1038        public StringType getTextElement() { 
1039          if (this.text == null)
1040            if (Configuration.errorOnAutoCreate())
1041              throw new Error("Attempt to auto-create QuestionnaireItemComponent.text");
1042            else if (Configuration.doAutoCreate())
1043              this.text = new StringType(); // bb
1044          return this.text;
1045        }
1046
1047        public boolean hasTextElement() { 
1048          return this.text != null && !this.text.isEmpty();
1049        }
1050
1051        public boolean hasText() { 
1052          return this.text != null && !this.text.isEmpty();
1053        }
1054
1055        /**
1056         * @param value {@link #text} (The name of a section, the text of a question or text content for a display item.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
1057         */
1058        public QuestionnaireItemComponent setTextElement(StringType value) { 
1059          this.text = value;
1060          return this;
1061        }
1062
1063        /**
1064         * @return The name of a section, the text of a question or text content for a display item.
1065         */
1066        public String getText() { 
1067          return this.text == null ? null : this.text.getValue();
1068        }
1069
1070        /**
1071         * @param value The name of a section, the text of a question or text content for a display item.
1072         */
1073        public QuestionnaireItemComponent setText(String value) { 
1074          if (Utilities.noString(value))
1075            this.text = null;
1076          else {
1077            if (this.text == null)
1078              this.text = new StringType();
1079            this.text.setValue(value);
1080          }
1081          return this;
1082        }
1083
1084        /**
1085         * @return {@link #type} (The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1086         */
1087        public Enumeration<QuestionnaireItemType> getTypeElement() { 
1088          if (this.type == null)
1089            if (Configuration.errorOnAutoCreate())
1090              throw new Error("Attempt to auto-create QuestionnaireItemComponent.type");
1091            else if (Configuration.doAutoCreate())
1092              this.type = new Enumeration<QuestionnaireItemType>(new QuestionnaireItemTypeEnumFactory()); // bb
1093          return this.type;
1094        }
1095
1096        public boolean hasTypeElement() { 
1097          return this.type != null && !this.type.isEmpty();
1098        }
1099
1100        public boolean hasType() { 
1101          return this.type != null && !this.type.isEmpty();
1102        }
1103
1104        /**
1105         * @param value {@link #type} (The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1106         */
1107        public QuestionnaireItemComponent setTypeElement(Enumeration<QuestionnaireItemType> value) { 
1108          this.type = value;
1109          return this;
1110        }
1111
1112        /**
1113         * @return The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).
1114         */
1115        public QuestionnaireItemType getType() { 
1116          return this.type == null ? null : this.type.getValue();
1117        }
1118
1119        /**
1120         * @param value The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).
1121         */
1122        public QuestionnaireItemComponent setType(QuestionnaireItemType value) { 
1123            if (this.type == null)
1124              this.type = new Enumeration<QuestionnaireItemType>(new QuestionnaireItemTypeEnumFactory());
1125            this.type.setValue(value);
1126          return this;
1127        }
1128
1129        /**
1130         * @return {@link #enableWhen} (A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.)
1131         */
1132        public List<QuestionnaireItemEnableWhenComponent> getEnableWhen() { 
1133          if (this.enableWhen == null)
1134            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1135          return this.enableWhen;
1136        }
1137
1138        /**
1139         * @return Returns a reference to <code>this</code> for easy method chaining
1140         */
1141        public QuestionnaireItemComponent setEnableWhen(List<QuestionnaireItemEnableWhenComponent> theEnableWhen) { 
1142          this.enableWhen = theEnableWhen;
1143          return this;
1144        }
1145
1146        public boolean hasEnableWhen() { 
1147          if (this.enableWhen == null)
1148            return false;
1149          for (QuestionnaireItemEnableWhenComponent item : this.enableWhen)
1150            if (!item.isEmpty())
1151              return true;
1152          return false;
1153        }
1154
1155        public QuestionnaireItemEnableWhenComponent addEnableWhen() { //3
1156          QuestionnaireItemEnableWhenComponent t = new QuestionnaireItemEnableWhenComponent();
1157          if (this.enableWhen == null)
1158            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1159          this.enableWhen.add(t);
1160          return t;
1161        }
1162
1163        public QuestionnaireItemComponent addEnableWhen(QuestionnaireItemEnableWhenComponent t) { //3
1164          if (t == null)
1165            return this;
1166          if (this.enableWhen == null)
1167            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1168          this.enableWhen.add(t);
1169          return this;
1170        }
1171
1172        /**
1173         * @return The first repetition of repeating field {@link #enableWhen}, creating it if it does not already exist
1174         */
1175        public QuestionnaireItemEnableWhenComponent getEnableWhenFirstRep() { 
1176          if (getEnableWhen().isEmpty()) {
1177            addEnableWhen();
1178          }
1179          return getEnableWhen().get(0);
1180        }
1181
1182        /**
1183         * @return {@link #enableBehavior} (Controls how multiple enableWhen values are interpreted -  whether all or any must be true.). This is the underlying object with id, value and extensions. The accessor "getEnableBehavior" gives direct access to the value
1184         */
1185        public Enumeration<EnableWhenBehavior> getEnableBehaviorElement() { 
1186          if (this.enableBehavior == null)
1187            if (Configuration.errorOnAutoCreate())
1188              throw new Error("Attempt to auto-create QuestionnaireItemComponent.enableBehavior");
1189            else if (Configuration.doAutoCreate())
1190              this.enableBehavior = new Enumeration<EnableWhenBehavior>(new EnableWhenBehaviorEnumFactory()); // bb
1191          return this.enableBehavior;
1192        }
1193
1194        public boolean hasEnableBehaviorElement() { 
1195          return this.enableBehavior != null && !this.enableBehavior.isEmpty();
1196        }
1197
1198        public boolean hasEnableBehavior() { 
1199          return this.enableBehavior != null && !this.enableBehavior.isEmpty();
1200        }
1201
1202        /**
1203         * @param value {@link #enableBehavior} (Controls how multiple enableWhen values are interpreted -  whether all or any must be true.). This is the underlying object with id, value and extensions. The accessor "getEnableBehavior" gives direct access to the value
1204         */
1205        public QuestionnaireItemComponent setEnableBehaviorElement(Enumeration<EnableWhenBehavior> value) { 
1206          this.enableBehavior = value;
1207          return this;
1208        }
1209
1210        /**
1211         * @return Controls how multiple enableWhen values are interpreted -  whether all or any must be true.
1212         */
1213        public EnableWhenBehavior getEnableBehavior() { 
1214          return this.enableBehavior == null ? null : this.enableBehavior.getValue();
1215        }
1216
1217        /**
1218         * @param value Controls how multiple enableWhen values are interpreted -  whether all or any must be true.
1219         */
1220        public QuestionnaireItemComponent setEnableBehavior(EnableWhenBehavior value) { 
1221          if (value == null)
1222            this.enableBehavior = null;
1223          else {
1224            if (this.enableBehavior == null)
1225              this.enableBehavior = new Enumeration<EnableWhenBehavior>(new EnableWhenBehaviorEnumFactory());
1226            this.enableBehavior.setValue(value);
1227          }
1228          return this;
1229        }
1230
1231        /**
1232         * @return {@link #required} (An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value
1233         */
1234        public BooleanType getRequiredElement() { 
1235          if (this.required == null)
1236            if (Configuration.errorOnAutoCreate())
1237              throw new Error("Attempt to auto-create QuestionnaireItemComponent.required");
1238            else if (Configuration.doAutoCreate())
1239              this.required = new BooleanType(); // bb
1240          return this.required;
1241        }
1242
1243        public boolean hasRequiredElement() { 
1244          return this.required != null && !this.required.isEmpty();
1245        }
1246
1247        public boolean hasRequired() { 
1248          return this.required != null && !this.required.isEmpty();
1249        }
1250
1251        /**
1252         * @param value {@link #required} (An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value
1253         */
1254        public QuestionnaireItemComponent setRequiredElement(BooleanType value) { 
1255          this.required = value;
1256          return this;
1257        }
1258
1259        /**
1260         * @return An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.
1261         */
1262        public boolean getRequired() { 
1263          return this.required == null || this.required.isEmpty() ? false : this.required.getValue();
1264        }
1265
1266        /**
1267         * @param value An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.
1268         */
1269        public QuestionnaireItemComponent setRequired(boolean value) { 
1270            if (this.required == null)
1271              this.required = new BooleanType();
1272            this.required.setValue(value);
1273          return this;
1274        }
1275
1276        /**
1277         * @return {@link #repeats} (An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.). This is the underlying object with id, value and extensions. The accessor "getRepeats" gives direct access to the value
1278         */
1279        public BooleanType getRepeatsElement() { 
1280          if (this.repeats == null)
1281            if (Configuration.errorOnAutoCreate())
1282              throw new Error("Attempt to auto-create QuestionnaireItemComponent.repeats");
1283            else if (Configuration.doAutoCreate())
1284              this.repeats = new BooleanType(); // bb
1285          return this.repeats;
1286        }
1287
1288        public boolean hasRepeatsElement() { 
1289          return this.repeats != null && !this.repeats.isEmpty();
1290        }
1291
1292        public boolean hasRepeats() { 
1293          return this.repeats != null && !this.repeats.isEmpty();
1294        }
1295
1296        /**
1297         * @param value {@link #repeats} (An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.). This is the underlying object with id, value and extensions. The accessor "getRepeats" gives direct access to the value
1298         */
1299        public QuestionnaireItemComponent setRepeatsElement(BooleanType value) { 
1300          this.repeats = value;
1301          return this;
1302        }
1303
1304        /**
1305         * @return An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.
1306         */
1307        public boolean getRepeats() { 
1308          return this.repeats == null || this.repeats.isEmpty() ? false : this.repeats.getValue();
1309        }
1310
1311        /**
1312         * @param value An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.
1313         */
1314        public QuestionnaireItemComponent setRepeats(boolean value) { 
1315            if (this.repeats == null)
1316              this.repeats = new BooleanType();
1317            this.repeats.setValue(value);
1318          return this;
1319        }
1320
1321        /**
1322         * @return {@link #readOnly} (An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.). This is the underlying object with id, value and extensions. The accessor "getReadOnly" gives direct access to the value
1323         */
1324        public BooleanType getReadOnlyElement() { 
1325          if (this.readOnly == null)
1326            if (Configuration.errorOnAutoCreate())
1327              throw new Error("Attempt to auto-create QuestionnaireItemComponent.readOnly");
1328            else if (Configuration.doAutoCreate())
1329              this.readOnly = new BooleanType(); // bb
1330          return this.readOnly;
1331        }
1332
1333        public boolean hasReadOnlyElement() { 
1334          return this.readOnly != null && !this.readOnly.isEmpty();
1335        }
1336
1337        public boolean hasReadOnly() { 
1338          return this.readOnly != null && !this.readOnly.isEmpty();
1339        }
1340
1341        /**
1342         * @param value {@link #readOnly} (An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.). This is the underlying object with id, value and extensions. The accessor "getReadOnly" gives direct access to the value
1343         */
1344        public QuestionnaireItemComponent setReadOnlyElement(BooleanType value) { 
1345          this.readOnly = value;
1346          return this;
1347        }
1348
1349        /**
1350         * @return An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
1351         */
1352        public boolean getReadOnly() { 
1353          return this.readOnly == null || this.readOnly.isEmpty() ? false : this.readOnly.getValue();
1354        }
1355
1356        /**
1357         * @param value An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
1358         */
1359        public QuestionnaireItemComponent setReadOnly(boolean value) { 
1360            if (this.readOnly == null)
1361              this.readOnly = new BooleanType();
1362            this.readOnly.setValue(value);
1363          return this;
1364        }
1365
1366        /**
1367         * @return {@link #maxLength} (The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
1368         */
1369        public IntegerType getMaxLengthElement() { 
1370          if (this.maxLength == null)
1371            if (Configuration.errorOnAutoCreate())
1372              throw new Error("Attempt to auto-create QuestionnaireItemComponent.maxLength");
1373            else if (Configuration.doAutoCreate())
1374              this.maxLength = new IntegerType(); // bb
1375          return this.maxLength;
1376        }
1377
1378        public boolean hasMaxLengthElement() { 
1379          return this.maxLength != null && !this.maxLength.isEmpty();
1380        }
1381
1382        public boolean hasMaxLength() { 
1383          return this.maxLength != null && !this.maxLength.isEmpty();
1384        }
1385
1386        /**
1387         * @param value {@link #maxLength} (The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
1388         */
1389        public QuestionnaireItemComponent setMaxLengthElement(IntegerType value) { 
1390          this.maxLength = value;
1391          return this;
1392        }
1393
1394        /**
1395         * @return The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
1396         */
1397        public int getMaxLength() { 
1398          return this.maxLength == null || this.maxLength.isEmpty() ? 0 : this.maxLength.getValue();
1399        }
1400
1401        /**
1402         * @param value The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
1403         */
1404        public QuestionnaireItemComponent setMaxLength(int value) { 
1405            if (this.maxLength == null)
1406              this.maxLength = new IntegerType();
1407            this.maxLength.setValue(value);
1408          return this;
1409        }
1410
1411        /**
1412         * @return {@link #answerValueSet} (A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.). This is the underlying object with id, value and extensions. The accessor "getAnswerValueSet" gives direct access to the value
1413         */
1414        public CanonicalType getAnswerValueSetElement() { 
1415          if (this.answerValueSet == null)
1416            if (Configuration.errorOnAutoCreate())
1417              throw new Error("Attempt to auto-create QuestionnaireItemComponent.answerValueSet");
1418            else if (Configuration.doAutoCreate())
1419              this.answerValueSet = new CanonicalType(); // bb
1420          return this.answerValueSet;
1421        }
1422
1423        public boolean hasAnswerValueSetElement() { 
1424          return this.answerValueSet != null && !this.answerValueSet.isEmpty();
1425        }
1426
1427        public boolean hasAnswerValueSet() { 
1428          return this.answerValueSet != null && !this.answerValueSet.isEmpty();
1429        }
1430
1431        /**
1432         * @param value {@link #answerValueSet} (A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.). This is the underlying object with id, value and extensions. The accessor "getAnswerValueSet" gives direct access to the value
1433         */
1434        public QuestionnaireItemComponent setAnswerValueSetElement(CanonicalType value) { 
1435          this.answerValueSet = value;
1436          return this;
1437        }
1438
1439        /**
1440         * @return A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.
1441         */
1442        public String getAnswerValueSet() { 
1443          return this.answerValueSet == null ? null : this.answerValueSet.getValue();
1444        }
1445
1446        /**
1447         * @param value A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.
1448         */
1449        public QuestionnaireItemComponent setAnswerValueSet(String value) { 
1450          if (Utilities.noString(value))
1451            this.answerValueSet = null;
1452          else {
1453            if (this.answerValueSet == null)
1454              this.answerValueSet = new CanonicalType();
1455            this.answerValueSet.setValue(value);
1456          }
1457          return this;
1458        }
1459
1460        /**
1461         * @return {@link #answerOption} (One of the permitted answers for a "choice" or "open-choice" question.)
1462         */
1463        public List<QuestionnaireItemAnswerOptionComponent> getAnswerOption() { 
1464          if (this.answerOption == null)
1465            this.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1466          return this.answerOption;
1467        }
1468
1469        /**
1470         * @return Returns a reference to <code>this</code> for easy method chaining
1471         */
1472        public QuestionnaireItemComponent setAnswerOption(List<QuestionnaireItemAnswerOptionComponent> theAnswerOption) { 
1473          this.answerOption = theAnswerOption;
1474          return this;
1475        }
1476
1477        public boolean hasAnswerOption() { 
1478          if (this.answerOption == null)
1479            return false;
1480          for (QuestionnaireItemAnswerOptionComponent item : this.answerOption)
1481            if (!item.isEmpty())
1482              return true;
1483          return false;
1484        }
1485
1486        public QuestionnaireItemAnswerOptionComponent addAnswerOption() { //3
1487          QuestionnaireItemAnswerOptionComponent t = new QuestionnaireItemAnswerOptionComponent();
1488          if (this.answerOption == null)
1489            this.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1490          this.answerOption.add(t);
1491          return t;
1492        }
1493
1494        public QuestionnaireItemComponent addAnswerOption(QuestionnaireItemAnswerOptionComponent t) { //3
1495          if (t == null)
1496            return this;
1497          if (this.answerOption == null)
1498            this.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1499          this.answerOption.add(t);
1500          return this;
1501        }
1502
1503        /**
1504         * @return The first repetition of repeating field {@link #answerOption}, creating it if it does not already exist
1505         */
1506        public QuestionnaireItemAnswerOptionComponent getAnswerOptionFirstRep() { 
1507          if (getAnswerOption().isEmpty()) {
1508            addAnswerOption();
1509          }
1510          return getAnswerOption().get(0);
1511        }
1512
1513        /**
1514         * @return {@link #initial} (One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.)
1515         */
1516        public List<QuestionnaireItemInitialComponent> getInitial() { 
1517          if (this.initial == null)
1518            this.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1519          return this.initial;
1520        }
1521
1522        /**
1523         * @return Returns a reference to <code>this</code> for easy method chaining
1524         */
1525        public QuestionnaireItemComponent setInitial(List<QuestionnaireItemInitialComponent> theInitial) { 
1526          this.initial = theInitial;
1527          return this;
1528        }
1529
1530        public boolean hasInitial() { 
1531          if (this.initial == null)
1532            return false;
1533          for (QuestionnaireItemInitialComponent item : this.initial)
1534            if (!item.isEmpty())
1535              return true;
1536          return false;
1537        }
1538
1539        public QuestionnaireItemInitialComponent addInitial() { //3
1540          QuestionnaireItemInitialComponent t = new QuestionnaireItemInitialComponent();
1541          if (this.initial == null)
1542            this.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1543          this.initial.add(t);
1544          return t;
1545        }
1546
1547        public QuestionnaireItemComponent addInitial(QuestionnaireItemInitialComponent t) { //3
1548          if (t == null)
1549            return this;
1550          if (this.initial == null)
1551            this.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1552          this.initial.add(t);
1553          return this;
1554        }
1555
1556        /**
1557         * @return The first repetition of repeating field {@link #initial}, creating it if it does not already exist
1558         */
1559        public QuestionnaireItemInitialComponent getInitialFirstRep() { 
1560          if (getInitial().isEmpty()) {
1561            addInitial();
1562          }
1563          return getInitial().get(0);
1564        }
1565
1566        /**
1567         * @return {@link #item} (Text, questions and other groups to be nested beneath a question or group.)
1568         */
1569        public List<QuestionnaireItemComponent> getItem() { 
1570          if (this.item == null)
1571            this.item = new ArrayList<QuestionnaireItemComponent>();
1572          return this.item;
1573        }
1574
1575        /**
1576         * @return Returns a reference to <code>this</code> for easy method chaining
1577         */
1578        public QuestionnaireItemComponent setItem(List<QuestionnaireItemComponent> theItem) { 
1579          this.item = theItem;
1580          return this;
1581        }
1582
1583        public boolean hasItem() { 
1584          if (this.item == null)
1585            return false;
1586          for (QuestionnaireItemComponent item : this.item)
1587            if (!item.isEmpty())
1588              return true;
1589          return false;
1590        }
1591
1592        public QuestionnaireItemComponent addItem() { //3
1593          QuestionnaireItemComponent t = new QuestionnaireItemComponent();
1594          if (this.item == null)
1595            this.item = new ArrayList<QuestionnaireItemComponent>();
1596          this.item.add(t);
1597          return t;
1598        }
1599
1600        public QuestionnaireItemComponent addItem(QuestionnaireItemComponent t) { //3
1601          if (t == null)
1602            return this;
1603          if (this.item == null)
1604            this.item = new ArrayList<QuestionnaireItemComponent>();
1605          this.item.add(t);
1606          return this;
1607        }
1608
1609        /**
1610         * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
1611         */
1612        public QuestionnaireItemComponent getItemFirstRep() { 
1613          if (getItem().isEmpty()) {
1614            addItem();
1615          }
1616          return getItem().get(0);
1617        }
1618
1619        protected void listChildren(List<Property> children) {
1620          super.listChildren(children);
1621          children.add(new Property("linkId", "string", "An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.", 0, 1, linkId));
1622          children.add(new Property("definition", "uri", "This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:\n\n* code (ElementDefinition.code) \n* type (ElementDefinition.type) \n* required (ElementDefinition.min) \n* repeats (ElementDefinition.max) \n* maxLength (ElementDefinition.maxLength) \n* answerValueSet (ElementDefinition.binding)\n* options (ElementDefinition.binding).", 0, 1, definition));
1623          children.add(new Property("code", "Coding", "A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).", 0, java.lang.Integer.MAX_VALUE, code));
1624          children.add(new Property("prefix", "string", "A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.", 0, 1, prefix));
1625          children.add(new Property("text", "string", "The name of a section, the text of a question or text content for a display item.", 0, 1, text));
1626          children.add(new Property("type", "code", "The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).", 0, 1, type));
1627          children.add(new Property("enableWhen", "", "A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.", 0, java.lang.Integer.MAX_VALUE, enableWhen));
1628          children.add(new Property("enableBehavior", "code", "Controls how multiple enableWhen values are interpreted -  whether all or any must be true.", 0, 1, enableBehavior));
1629          children.add(new Property("required", "boolean", "An indication, if true, that the item must be present in a \"completed\" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.", 0, 1, required));
1630          children.add(new Property("repeats", "boolean", "An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.", 0, 1, repeats));
1631          children.add(new Property("readOnly", "boolean", "An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.", 0, 1, readOnly));
1632          children.add(new Property("maxLength", "integer", "The maximum number of characters that are permitted in the answer to be considered a \"valid\" QuestionnaireResponse.", 0, 1, maxLength));
1633          children.add(new Property("answerValueSet", "canonical(ValueSet)", "A reference to a value set containing a list of codes representing permitted answers for a \"choice\" or \"open-choice\" question.", 0, 1, answerValueSet));
1634          children.add(new Property("answerOption", "", "One of the permitted answers for a \"choice\" or \"open-choice\" question.", 0, java.lang.Integer.MAX_VALUE, answerOption));
1635          children.add(new Property("initial", "", "One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.", 0, java.lang.Integer.MAX_VALUE, initial));
1636          children.add(new Property("item", "@Questionnaire.item", "Text, questions and other groups to be nested beneath a question or group.", 0, java.lang.Integer.MAX_VALUE, item));
1637        }
1638
1639        @Override
1640        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1641          switch (_hash) {
1642          case -1102667083: /*linkId*/  return new Property("linkId", "string", "An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.", 0, 1, linkId);
1643          case -1014418093: /*definition*/  return new Property("definition", "uri", "This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:\n\n* code (ElementDefinition.code) \n* type (ElementDefinition.type) \n* required (ElementDefinition.min) \n* repeats (ElementDefinition.max) \n* maxLength (ElementDefinition.maxLength) \n* answerValueSet (ElementDefinition.binding)\n* options (ElementDefinition.binding).", 0, 1, definition);
1644          case 3059181: /*code*/  return new Property("code", "Coding", "A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).", 0, java.lang.Integer.MAX_VALUE, code);
1645          case -980110702: /*prefix*/  return new Property("prefix", "string", "A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.", 0, 1, prefix);
1646          case 3556653: /*text*/  return new Property("text", "string", "The name of a section, the text of a question or text content for a display item.", 0, 1, text);
1647          case 3575610: /*type*/  return new Property("type", "code", "The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).", 0, 1, type);
1648          case 1893321565: /*enableWhen*/  return new Property("enableWhen", "", "A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.", 0, java.lang.Integer.MAX_VALUE, enableWhen);
1649          case 1854802165: /*enableBehavior*/  return new Property("enableBehavior", "code", "Controls how multiple enableWhen values are interpreted -  whether all or any must be true.", 0, 1, enableBehavior);
1650          case -393139297: /*required*/  return new Property("required", "boolean", "An indication, if true, that the item must be present in a \"completed\" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.", 0, 1, required);
1651          case 1094288952: /*repeats*/  return new Property("repeats", "boolean", "An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.", 0, 1, repeats);
1652          case -867683742: /*readOnly*/  return new Property("readOnly", "boolean", "An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.", 0, 1, readOnly);
1653          case -791400086: /*maxLength*/  return new Property("maxLength", "integer", "The maximum number of characters that are permitted in the answer to be considered a \"valid\" QuestionnaireResponse.", 0, 1, maxLength);
1654          case -743278833: /*answerValueSet*/  return new Property("answerValueSet", "canonical(ValueSet)", "A reference to a value set containing a list of codes representing permitted answers for a \"choice\" or \"open-choice\" question.", 0, 1, answerValueSet);
1655          case -1527878189: /*answerOption*/  return new Property("answerOption", "", "One of the permitted answers for a \"choice\" or \"open-choice\" question.", 0, java.lang.Integer.MAX_VALUE, answerOption);
1656          case 1948342084: /*initial*/  return new Property("initial", "", "One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.", 0, java.lang.Integer.MAX_VALUE, initial);
1657          case 3242771: /*item*/  return new Property("item", "@Questionnaire.item", "Text, questions and other groups to be nested beneath a question or group.", 0, java.lang.Integer.MAX_VALUE, item);
1658          default: return super.getNamedProperty(_hash, _name, _checkValid);
1659          }
1660
1661        }
1662
1663      @Override
1664      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1665        switch (hash) {
1666        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : new Base[] {this.linkId}; // StringType
1667        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // UriType
1668        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
1669        case -980110702: /*prefix*/ return this.prefix == null ? new Base[0] : new Base[] {this.prefix}; // StringType
1670        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
1671        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<QuestionnaireItemType>
1672        case 1893321565: /*enableWhen*/ return this.enableWhen == null ? new Base[0] : this.enableWhen.toArray(new Base[this.enableWhen.size()]); // QuestionnaireItemEnableWhenComponent
1673        case 1854802165: /*enableBehavior*/ return this.enableBehavior == null ? new Base[0] : new Base[] {this.enableBehavior}; // Enumeration<EnableWhenBehavior>
1674        case -393139297: /*required*/ return this.required == null ? new Base[0] : new Base[] {this.required}; // BooleanType
1675        case 1094288952: /*repeats*/ return this.repeats == null ? new Base[0] : new Base[] {this.repeats}; // BooleanType
1676        case -867683742: /*readOnly*/ return this.readOnly == null ? new Base[0] : new Base[] {this.readOnly}; // BooleanType
1677        case -791400086: /*maxLength*/ return this.maxLength == null ? new Base[0] : new Base[] {this.maxLength}; // IntegerType
1678        case -743278833: /*answerValueSet*/ return this.answerValueSet == null ? new Base[0] : new Base[] {this.answerValueSet}; // CanonicalType
1679        case -1527878189: /*answerOption*/ return this.answerOption == null ? new Base[0] : this.answerOption.toArray(new Base[this.answerOption.size()]); // QuestionnaireItemAnswerOptionComponent
1680        case 1948342084: /*initial*/ return this.initial == null ? new Base[0] : this.initial.toArray(new Base[this.initial.size()]); // QuestionnaireItemInitialComponent
1681        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireItemComponent
1682        default: return super.getProperty(hash, name, checkValid);
1683        }
1684
1685      }
1686
1687      @Override
1688      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1689        switch (hash) {
1690        case -1102667083: // linkId
1691          this.linkId = castToString(value); // StringType
1692          return value;
1693        case -1014418093: // definition
1694          this.definition = castToUri(value); // UriType
1695          return value;
1696        case 3059181: // code
1697          this.getCode().add(castToCoding(value)); // Coding
1698          return value;
1699        case -980110702: // prefix
1700          this.prefix = castToString(value); // StringType
1701          return value;
1702        case 3556653: // text
1703          this.text = castToString(value); // StringType
1704          return value;
1705        case 3575610: // type
1706          value = new QuestionnaireItemTypeEnumFactory().fromType(castToCode(value));
1707          this.type = (Enumeration) value; // Enumeration<QuestionnaireItemType>
1708          return value;
1709        case 1893321565: // enableWhen
1710          this.getEnableWhen().add((QuestionnaireItemEnableWhenComponent) value); // QuestionnaireItemEnableWhenComponent
1711          return value;
1712        case 1854802165: // enableBehavior
1713          value = new EnableWhenBehaviorEnumFactory().fromType(castToCode(value));
1714          this.enableBehavior = (Enumeration) value; // Enumeration<EnableWhenBehavior>
1715          return value;
1716        case -393139297: // required
1717          this.required = castToBoolean(value); // BooleanType
1718          return value;
1719        case 1094288952: // repeats
1720          this.repeats = castToBoolean(value); // BooleanType
1721          return value;
1722        case -867683742: // readOnly
1723          this.readOnly = castToBoolean(value); // BooleanType
1724          return value;
1725        case -791400086: // maxLength
1726          this.maxLength = castToInteger(value); // IntegerType
1727          return value;
1728        case -743278833: // answerValueSet
1729          this.answerValueSet = castToCanonical(value); // CanonicalType
1730          return value;
1731        case -1527878189: // answerOption
1732          this.getAnswerOption().add((QuestionnaireItemAnswerOptionComponent) value); // QuestionnaireItemAnswerOptionComponent
1733          return value;
1734        case 1948342084: // initial
1735          this.getInitial().add((QuestionnaireItemInitialComponent) value); // QuestionnaireItemInitialComponent
1736          return value;
1737        case 3242771: // item
1738          this.getItem().add((QuestionnaireItemComponent) value); // QuestionnaireItemComponent
1739          return value;
1740        default: return super.setProperty(hash, name, value);
1741        }
1742
1743      }
1744
1745      @Override
1746      public Base setProperty(String name, Base value) throws FHIRException {
1747        if (name.equals("linkId")) {
1748          this.linkId = castToString(value); // StringType
1749        } else if (name.equals("definition")) {
1750          this.definition = castToUri(value); // UriType
1751        } else if (name.equals("code")) {
1752          this.getCode().add(castToCoding(value));
1753        } else if (name.equals("prefix")) {
1754          this.prefix = castToString(value); // StringType
1755        } else if (name.equals("text")) {
1756          this.text = castToString(value); // StringType
1757        } else if (name.equals("type")) {
1758          value = new QuestionnaireItemTypeEnumFactory().fromType(castToCode(value));
1759          this.type = (Enumeration) value; // Enumeration<QuestionnaireItemType>
1760        } else if (name.equals("enableWhen")) {
1761          this.getEnableWhen().add((QuestionnaireItemEnableWhenComponent) value);
1762        } else if (name.equals("enableBehavior")) {
1763          value = new EnableWhenBehaviorEnumFactory().fromType(castToCode(value));
1764          this.enableBehavior = (Enumeration) value; // Enumeration<EnableWhenBehavior>
1765        } else if (name.equals("required")) {
1766          this.required = castToBoolean(value); // BooleanType
1767        } else if (name.equals("repeats")) {
1768          this.repeats = castToBoolean(value); // BooleanType
1769        } else if (name.equals("readOnly")) {
1770          this.readOnly = castToBoolean(value); // BooleanType
1771        } else if (name.equals("maxLength")) {
1772          this.maxLength = castToInteger(value); // IntegerType
1773        } else if (name.equals("answerValueSet")) {
1774          this.answerValueSet = castToCanonical(value); // CanonicalType
1775        } else if (name.equals("answerOption")) {
1776          this.getAnswerOption().add((QuestionnaireItemAnswerOptionComponent) value);
1777        } else if (name.equals("initial")) {
1778          this.getInitial().add((QuestionnaireItemInitialComponent) value);
1779        } else if (name.equals("item")) {
1780          this.getItem().add((QuestionnaireItemComponent) value);
1781        } else
1782          return super.setProperty(name, value);
1783        return value;
1784      }
1785
1786      @Override
1787      public Base makeProperty(int hash, String name) throws FHIRException {
1788        switch (hash) {
1789        case -1102667083:  return getLinkIdElement();
1790        case -1014418093:  return getDefinitionElement();
1791        case 3059181:  return addCode(); 
1792        case -980110702:  return getPrefixElement();
1793        case 3556653:  return getTextElement();
1794        case 3575610:  return getTypeElement();
1795        case 1893321565:  return addEnableWhen(); 
1796        case 1854802165:  return getEnableBehaviorElement();
1797        case -393139297:  return getRequiredElement();
1798        case 1094288952:  return getRepeatsElement();
1799        case -867683742:  return getReadOnlyElement();
1800        case -791400086:  return getMaxLengthElement();
1801        case -743278833:  return getAnswerValueSetElement();
1802        case -1527878189:  return addAnswerOption(); 
1803        case 1948342084:  return addInitial(); 
1804        case 3242771:  return addItem(); 
1805        default: return super.makeProperty(hash, name);
1806        }
1807
1808      }
1809
1810      @Override
1811      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1812        switch (hash) {
1813        case -1102667083: /*linkId*/ return new String[] {"string"};
1814        case -1014418093: /*definition*/ return new String[] {"uri"};
1815        case 3059181: /*code*/ return new String[] {"Coding"};
1816        case -980110702: /*prefix*/ return new String[] {"string"};
1817        case 3556653: /*text*/ return new String[] {"string"};
1818        case 3575610: /*type*/ return new String[] {"code"};
1819        case 1893321565: /*enableWhen*/ return new String[] {};
1820        case 1854802165: /*enableBehavior*/ return new String[] {"code"};
1821        case -393139297: /*required*/ return new String[] {"boolean"};
1822        case 1094288952: /*repeats*/ return new String[] {"boolean"};
1823        case -867683742: /*readOnly*/ return new String[] {"boolean"};
1824        case -791400086: /*maxLength*/ return new String[] {"integer"};
1825        case -743278833: /*answerValueSet*/ return new String[] {"canonical"};
1826        case -1527878189: /*answerOption*/ return new String[] {};
1827        case 1948342084: /*initial*/ return new String[] {};
1828        case 3242771: /*item*/ return new String[] {"@Questionnaire.item"};
1829        default: return super.getTypesForProperty(hash, name);
1830        }
1831
1832      }
1833
1834      @Override
1835      public Base addChild(String name) throws FHIRException {
1836        if (name.equals("linkId")) {
1837          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.linkId");
1838        }
1839        else if (name.equals("definition")) {
1840          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.definition");
1841        }
1842        else if (name.equals("code")) {
1843          return addCode();
1844        }
1845        else if (name.equals("prefix")) {
1846          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.prefix");
1847        }
1848        else if (name.equals("text")) {
1849          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.text");
1850        }
1851        else if (name.equals("type")) {
1852          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.type");
1853        }
1854        else if (name.equals("enableWhen")) {
1855          return addEnableWhen();
1856        }
1857        else if (name.equals("enableBehavior")) {
1858          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.enableBehavior");
1859        }
1860        else if (name.equals("required")) {
1861          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.required");
1862        }
1863        else if (name.equals("repeats")) {
1864          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.repeats");
1865        }
1866        else if (name.equals("readOnly")) {
1867          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.readOnly");
1868        }
1869        else if (name.equals("maxLength")) {
1870          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.maxLength");
1871        }
1872        else if (name.equals("answerValueSet")) {
1873          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.answerValueSet");
1874        }
1875        else if (name.equals("answerOption")) {
1876          return addAnswerOption();
1877        }
1878        else if (name.equals("initial")) {
1879          return addInitial();
1880        }
1881        else if (name.equals("item")) {
1882          return addItem();
1883        }
1884        else
1885          return super.addChild(name);
1886      }
1887
1888      public QuestionnaireItemComponent copy() {
1889        QuestionnaireItemComponent dst = new QuestionnaireItemComponent();
1890        copyValues(dst);
1891        return dst;
1892      }
1893
1894      public void copyValues(QuestionnaireItemComponent dst) {
1895        super.copyValues(dst);
1896        dst.linkId = linkId == null ? null : linkId.copy();
1897        dst.definition = definition == null ? null : definition.copy();
1898        if (code != null) {
1899          dst.code = new ArrayList<Coding>();
1900          for (Coding i : code)
1901            dst.code.add(i.copy());
1902        };
1903        dst.prefix = prefix == null ? null : prefix.copy();
1904        dst.text = text == null ? null : text.copy();
1905        dst.type = type == null ? null : type.copy();
1906        if (enableWhen != null) {
1907          dst.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1908          for (QuestionnaireItemEnableWhenComponent i : enableWhen)
1909            dst.enableWhen.add(i.copy());
1910        };
1911        dst.enableBehavior = enableBehavior == null ? null : enableBehavior.copy();
1912        dst.required = required == null ? null : required.copy();
1913        dst.repeats = repeats == null ? null : repeats.copy();
1914        dst.readOnly = readOnly == null ? null : readOnly.copy();
1915        dst.maxLength = maxLength == null ? null : maxLength.copy();
1916        dst.answerValueSet = answerValueSet == null ? null : answerValueSet.copy();
1917        if (answerOption != null) {
1918          dst.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1919          for (QuestionnaireItemAnswerOptionComponent i : answerOption)
1920            dst.answerOption.add(i.copy());
1921        };
1922        if (initial != null) {
1923          dst.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1924          for (QuestionnaireItemInitialComponent i : initial)
1925            dst.initial.add(i.copy());
1926        };
1927        if (item != null) {
1928          dst.item = new ArrayList<QuestionnaireItemComponent>();
1929          for (QuestionnaireItemComponent i : item)
1930            dst.item.add(i.copy());
1931        };
1932      }
1933
1934      @Override
1935      public boolean equalsDeep(Base other_) {
1936        if (!super.equalsDeep(other_))
1937          return false;
1938        if (!(other_ instanceof QuestionnaireItemComponent))
1939          return false;
1940        QuestionnaireItemComponent o = (QuestionnaireItemComponent) other_;
1941        return compareDeep(linkId, o.linkId, true) && compareDeep(definition, o.definition, true) && compareDeep(code, o.code, true)
1942           && compareDeep(prefix, o.prefix, true) && compareDeep(text, o.text, true) && compareDeep(type, o.type, true)
1943           && compareDeep(enableWhen, o.enableWhen, true) && compareDeep(enableBehavior, o.enableBehavior, true)
1944           && compareDeep(required, o.required, true) && compareDeep(repeats, o.repeats, true) && compareDeep(readOnly, o.readOnly, true)
1945           && compareDeep(maxLength, o.maxLength, true) && compareDeep(answerValueSet, o.answerValueSet, true)
1946           && compareDeep(answerOption, o.answerOption, true) && compareDeep(initial, o.initial, true) && compareDeep(item, o.item, true)
1947          ;
1948      }
1949
1950      @Override
1951      public boolean equalsShallow(Base other_) {
1952        if (!super.equalsShallow(other_))
1953          return false;
1954        if (!(other_ instanceof QuestionnaireItemComponent))
1955          return false;
1956        QuestionnaireItemComponent o = (QuestionnaireItemComponent) other_;
1957        return compareValues(linkId, o.linkId, true) && compareValues(definition, o.definition, true) && compareValues(prefix, o.prefix, true)
1958           && compareValues(text, o.text, true) && compareValues(type, o.type, true) && compareValues(enableBehavior, o.enableBehavior, true)
1959           && compareValues(required, o.required, true) && compareValues(repeats, o.repeats, true) && compareValues(readOnly, o.readOnly, true)
1960           && compareValues(maxLength, o.maxLength, true);
1961      }
1962
1963      public boolean isEmpty() {
1964        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(linkId, definition, code
1965          , prefix, text, type, enableWhen, enableBehavior, required, repeats, readOnly
1966          , maxLength, answerValueSet, answerOption, initial, item);
1967      }
1968
1969  public String fhirType() {
1970    return "Questionnaire.item";
1971
1972  }
1973
1974  }
1975
1976    @Block()
1977    public static class QuestionnaireItemEnableWhenComponent extends BackboneElement implements IBaseBackboneElement {
1978        /**
1979         * The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
1980         */
1981        @Child(name = "question", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1982        @Description(shortDefinition="Question that determines whether item is enabled", formalDefinition="The linkId for the question whose answer (or lack of answer) governs whether this item is enabled." )
1983        protected StringType question;
1984
1985        /**
1986         * Specifies the criteria by which the question is enabled.
1987         */
1988        @Child(name = "operator", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1989        @Description(shortDefinition="exists | = | != | > | < | >= | <=", formalDefinition="Specifies the criteria by which the question is enabled." )
1990        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-enable-operator")
1991        protected Enumeration<QuestionnaireItemOperator> operator;
1992
1993        /**
1994         * A value that the referenced question is tested using the specified operator in order for the item to be enabled.
1995         */
1996        @Child(name = "answer", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, TimeType.class, StringType.class, Coding.class, Quantity.class, Reference.class}, order=3, min=1, max=1, modifier=false, summary=false)
1997        @Description(shortDefinition="Value for question comparison based on operator", formalDefinition="A value that the referenced question is tested using the specified operator in order for the item to be enabled." )
1998        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
1999        protected Type answer;
2000
2001        private static final long serialVersionUID = -1815133868L;
2002
2003    /**
2004     * Constructor
2005     */
2006      public QuestionnaireItemEnableWhenComponent() {
2007        super();
2008      }
2009
2010    /**
2011     * Constructor
2012     */
2013      public QuestionnaireItemEnableWhenComponent(StringType question, Enumeration<QuestionnaireItemOperator> operator, Type answer) {
2014        super();
2015        this.question = question;
2016        this.operator = operator;
2017        this.answer = answer;
2018      }
2019
2020        /**
2021         * @return {@link #question} (The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.). This is the underlying object with id, value and extensions. The accessor "getQuestion" gives direct access to the value
2022         */
2023        public StringType getQuestionElement() { 
2024          if (this.question == null)
2025            if (Configuration.errorOnAutoCreate())
2026              throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.question");
2027            else if (Configuration.doAutoCreate())
2028              this.question = new StringType(); // bb
2029          return this.question;
2030        }
2031
2032        public boolean hasQuestionElement() { 
2033          return this.question != null && !this.question.isEmpty();
2034        }
2035
2036        public boolean hasQuestion() { 
2037          return this.question != null && !this.question.isEmpty();
2038        }
2039
2040        /**
2041         * @param value {@link #question} (The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.). This is the underlying object with id, value and extensions. The accessor "getQuestion" gives direct access to the value
2042         */
2043        public QuestionnaireItemEnableWhenComponent setQuestionElement(StringType value) { 
2044          this.question = value;
2045          return this;
2046        }
2047
2048        /**
2049         * @return The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2050         */
2051        public String getQuestion() { 
2052          return this.question == null ? null : this.question.getValue();
2053        }
2054
2055        /**
2056         * @param value The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2057         */
2058        public QuestionnaireItemEnableWhenComponent setQuestion(String value) { 
2059            if (this.question == null)
2060              this.question = new StringType();
2061            this.question.setValue(value);
2062          return this;
2063        }
2064
2065        /**
2066         * @return {@link #operator} (Specifies the criteria by which the question is enabled.). This is the underlying object with id, value and extensions. The accessor "getOperator" gives direct access to the value
2067         */
2068        public Enumeration<QuestionnaireItemOperator> getOperatorElement() { 
2069          if (this.operator == null)
2070            if (Configuration.errorOnAutoCreate())
2071              throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.operator");
2072            else if (Configuration.doAutoCreate())
2073              this.operator = new Enumeration<QuestionnaireItemOperator>(new QuestionnaireItemOperatorEnumFactory()); // bb
2074          return this.operator;
2075        }
2076
2077        public boolean hasOperatorElement() { 
2078          return this.operator != null && !this.operator.isEmpty();
2079        }
2080
2081        public boolean hasOperator() { 
2082          return this.operator != null && !this.operator.isEmpty();
2083        }
2084
2085        /**
2086         * @param value {@link #operator} (Specifies the criteria by which the question is enabled.). This is the underlying object with id, value and extensions. The accessor "getOperator" gives direct access to the value
2087         */
2088        public QuestionnaireItemEnableWhenComponent setOperatorElement(Enumeration<QuestionnaireItemOperator> value) { 
2089          this.operator = value;
2090          return this;
2091        }
2092
2093        /**
2094         * @return Specifies the criteria by which the question is enabled.
2095         */
2096        public QuestionnaireItemOperator getOperator() { 
2097          return this.operator == null ? null : this.operator.getValue();
2098        }
2099
2100        /**
2101         * @param value Specifies the criteria by which the question is enabled.
2102         */
2103        public QuestionnaireItemEnableWhenComponent setOperator(QuestionnaireItemOperator value) { 
2104            if (this.operator == null)
2105              this.operator = new Enumeration<QuestionnaireItemOperator>(new QuestionnaireItemOperatorEnumFactory());
2106            this.operator.setValue(value);
2107          return this;
2108        }
2109
2110        /**
2111         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2112         */
2113        public Type getAnswer() { 
2114          return this.answer;
2115        }
2116
2117        /**
2118         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2119         */
2120        public BooleanType getAnswerBooleanType() throws FHIRException { 
2121          if (this.answer == null)
2122            this.answer = new BooleanType();
2123          if (!(this.answer instanceof BooleanType))
2124            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.answer.getClass().getName()+" was encountered");
2125          return (BooleanType) this.answer;
2126        }
2127
2128        public boolean hasAnswerBooleanType() { 
2129          return this != null && this.answer instanceof BooleanType;
2130        }
2131
2132        /**
2133         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2134         */
2135        public DecimalType getAnswerDecimalType() throws FHIRException { 
2136          if (this.answer == null)
2137            this.answer = new DecimalType();
2138          if (!(this.answer instanceof DecimalType))
2139            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.answer.getClass().getName()+" was encountered");
2140          return (DecimalType) this.answer;
2141        }
2142
2143        public boolean hasAnswerDecimalType() { 
2144          return this != null && this.answer instanceof DecimalType;
2145        }
2146
2147        /**
2148         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2149         */
2150        public IntegerType getAnswerIntegerType() throws FHIRException { 
2151          if (this.answer == null)
2152            this.answer = new IntegerType();
2153          if (!(this.answer instanceof IntegerType))
2154            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.answer.getClass().getName()+" was encountered");
2155          return (IntegerType) this.answer;
2156        }
2157
2158        public boolean hasAnswerIntegerType() { 
2159          return this != null && this.answer instanceof IntegerType;
2160        }
2161
2162        /**
2163         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2164         */
2165        public DateType getAnswerDateType() throws FHIRException { 
2166          if (this.answer == null)
2167            this.answer = new DateType();
2168          if (!(this.answer instanceof DateType))
2169            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.answer.getClass().getName()+" was encountered");
2170          return (DateType) this.answer;
2171        }
2172
2173        public boolean hasAnswerDateType() { 
2174          return this != null && this.answer instanceof DateType;
2175        }
2176
2177        /**
2178         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2179         */
2180        public DateTimeType getAnswerDateTimeType() throws FHIRException { 
2181          if (this.answer == null)
2182            this.answer = new DateTimeType();
2183          if (!(this.answer instanceof DateTimeType))
2184            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.answer.getClass().getName()+" was encountered");
2185          return (DateTimeType) this.answer;
2186        }
2187
2188        public boolean hasAnswerDateTimeType() { 
2189          return this != null && this.answer instanceof DateTimeType;
2190        }
2191
2192        /**
2193         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2194         */
2195        public TimeType getAnswerTimeType() throws FHIRException { 
2196          if (this.answer == null)
2197            this.answer = new TimeType();
2198          if (!(this.answer instanceof TimeType))
2199            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.answer.getClass().getName()+" was encountered");
2200          return (TimeType) this.answer;
2201        }
2202
2203        public boolean hasAnswerTimeType() { 
2204          return this != null && this.answer instanceof TimeType;
2205        }
2206
2207        /**
2208         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2209         */
2210        public StringType getAnswerStringType() throws FHIRException { 
2211          if (this.answer == null)
2212            this.answer = new StringType();
2213          if (!(this.answer instanceof StringType))
2214            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.answer.getClass().getName()+" was encountered");
2215          return (StringType) this.answer;
2216        }
2217
2218        public boolean hasAnswerStringType() { 
2219          return this != null && this.answer instanceof StringType;
2220        }
2221
2222        /**
2223         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2224         */
2225        public Coding getAnswerCoding() throws FHIRException { 
2226          if (this.answer == null)
2227            this.answer = new Coding();
2228          if (!(this.answer instanceof Coding))
2229            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.answer.getClass().getName()+" was encountered");
2230          return (Coding) this.answer;
2231        }
2232
2233        public boolean hasAnswerCoding() { 
2234          return this != null && this.answer instanceof Coding;
2235        }
2236
2237        /**
2238         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2239         */
2240        public Quantity getAnswerQuantity() throws FHIRException { 
2241          if (this.answer == null)
2242            this.answer = new Quantity();
2243          if (!(this.answer instanceof Quantity))
2244            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.answer.getClass().getName()+" was encountered");
2245          return (Quantity) this.answer;
2246        }
2247
2248        public boolean hasAnswerQuantity() { 
2249          return this != null && this.answer instanceof Quantity;
2250        }
2251
2252        /**
2253         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2254         */
2255        public Reference getAnswerReference() throws FHIRException { 
2256          if (this.answer == null)
2257            this.answer = new Reference();
2258          if (!(this.answer instanceof Reference))
2259            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.answer.getClass().getName()+" was encountered");
2260          return (Reference) this.answer;
2261        }
2262
2263        public boolean hasAnswerReference() { 
2264          return this != null && this.answer instanceof Reference;
2265        }
2266
2267        public boolean hasAnswer() { 
2268          return this.answer != null && !this.answer.isEmpty();
2269        }
2270
2271        /**
2272         * @param value {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2273         */
2274        public QuestionnaireItemEnableWhenComponent setAnswer(Type value) { 
2275          if (value != null && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType || value instanceof StringType || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
2276            throw new Error("Not the right type for Questionnaire.item.enableWhen.answer[x]: "+value.fhirType());
2277          this.answer = value;
2278          return this;
2279        }
2280
2281        protected void listChildren(List<Property> children) {
2282          super.listChildren(children);
2283          children.add(new Property("question", "string", "The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.", 0, 1, question));
2284          children.add(new Property("operator", "code", "Specifies the criteria by which the question is enabled.", 0, 1, operator));
2285          children.add(new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer));
2286        }
2287
2288        @Override
2289        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2290          switch (_hash) {
2291          case -1165870106: /*question*/  return new Property("question", "string", "The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.", 0, 1, question);
2292          case -500553564: /*operator*/  return new Property("operator", "code", "Specifies the criteria by which the question is enabled.", 0, 1, operator);
2293          case 1693524994: /*answer[x]*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2294          case -1412808770: /*answer*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2295          case 1194603146: /*answerBoolean*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2296          case -1622812237: /*answerDecimal*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2297          case -1207023712: /*answerInteger*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2298          case 958960780: /*answerDate*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2299          case -1835321991: /*answerDateTime*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2300          case 959444907: /*answerTime*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2301          case -1409727121: /*answerString*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2302          case -1872828216: /*answerCoding*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2303          case -618108311: /*answerQuantity*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2304          case -1726221011: /*answerReference*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2305          default: return super.getNamedProperty(_hash, _name, _checkValid);
2306          }
2307
2308        }
2309
2310      @Override
2311      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2312        switch (hash) {
2313        case -1165870106: /*question*/ return this.question == null ? new Base[0] : new Base[] {this.question}; // StringType
2314        case -500553564: /*operator*/ return this.operator == null ? new Base[0] : new Base[] {this.operator}; // Enumeration<QuestionnaireItemOperator>
2315        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : new Base[] {this.answer}; // Type
2316        default: return super.getProperty(hash, name, checkValid);
2317        }
2318
2319      }
2320
2321      @Override
2322      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2323        switch (hash) {
2324        case -1165870106: // question
2325          this.question = castToString(value); // StringType
2326          return value;
2327        case -500553564: // operator
2328          value = new QuestionnaireItemOperatorEnumFactory().fromType(castToCode(value));
2329          this.operator = (Enumeration) value; // Enumeration<QuestionnaireItemOperator>
2330          return value;
2331        case -1412808770: // answer
2332          this.answer = castToType(value); // Type
2333          return value;
2334        default: return super.setProperty(hash, name, value);
2335        }
2336
2337      }
2338
2339      @Override
2340      public Base setProperty(String name, Base value) throws FHIRException {
2341        if (name.equals("question")) {
2342          this.question = castToString(value); // StringType
2343        } else if (name.equals("operator")) {
2344          value = new QuestionnaireItemOperatorEnumFactory().fromType(castToCode(value));
2345          this.operator = (Enumeration) value; // Enumeration<QuestionnaireItemOperator>
2346        } else if (name.equals("answer[x]")) {
2347          this.answer = castToType(value); // Type
2348        } else
2349          return super.setProperty(name, value);
2350        return value;
2351      }
2352
2353      @Override
2354      public Base makeProperty(int hash, String name) throws FHIRException {
2355        switch (hash) {
2356        case -1165870106:  return getQuestionElement();
2357        case -500553564:  return getOperatorElement();
2358        case 1693524994:  return getAnswer(); 
2359        case -1412808770:  return getAnswer(); 
2360        default: return super.makeProperty(hash, name);
2361        }
2362
2363      }
2364
2365      @Override
2366      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2367        switch (hash) {
2368        case -1165870106: /*question*/ return new String[] {"string"};
2369        case -500553564: /*operator*/ return new String[] {"code"};
2370        case -1412808770: /*answer*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "Coding", "Quantity", "Reference"};
2371        default: return super.getTypesForProperty(hash, name);
2372        }
2373
2374      }
2375
2376      @Override
2377      public Base addChild(String name) throws FHIRException {
2378        if (name.equals("question")) {
2379          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.question");
2380        }
2381        else if (name.equals("operator")) {
2382          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.operator");
2383        }
2384        else if (name.equals("answerBoolean")) {
2385          this.answer = new BooleanType();
2386          return this.answer;
2387        }
2388        else if (name.equals("answerDecimal")) {
2389          this.answer = new DecimalType();
2390          return this.answer;
2391        }
2392        else if (name.equals("answerInteger")) {
2393          this.answer = new IntegerType();
2394          return this.answer;
2395        }
2396        else if (name.equals("answerDate")) {
2397          this.answer = new DateType();
2398          return this.answer;
2399        }
2400        else if (name.equals("answerDateTime")) {
2401          this.answer = new DateTimeType();
2402          return this.answer;
2403        }
2404        else if (name.equals("answerTime")) {
2405          this.answer = new TimeType();
2406          return this.answer;
2407        }
2408        else if (name.equals("answerString")) {
2409          this.answer = new StringType();
2410          return this.answer;
2411        }
2412        else if (name.equals("answerCoding")) {
2413          this.answer = new Coding();
2414          return this.answer;
2415        }
2416        else if (name.equals("answerQuantity")) {
2417          this.answer = new Quantity();
2418          return this.answer;
2419        }
2420        else if (name.equals("answerReference")) {
2421          this.answer = new Reference();
2422          return this.answer;
2423        }
2424        else
2425          return super.addChild(name);
2426      }
2427
2428      public QuestionnaireItemEnableWhenComponent copy() {
2429        QuestionnaireItemEnableWhenComponent dst = new QuestionnaireItemEnableWhenComponent();
2430        copyValues(dst);
2431        return dst;
2432      }
2433
2434      public void copyValues(QuestionnaireItemEnableWhenComponent dst) {
2435        super.copyValues(dst);
2436        dst.question = question == null ? null : question.copy();
2437        dst.operator = operator == null ? null : operator.copy();
2438        dst.answer = answer == null ? null : answer.copy();
2439      }
2440
2441      @Override
2442      public boolean equalsDeep(Base other_) {
2443        if (!super.equalsDeep(other_))
2444          return false;
2445        if (!(other_ instanceof QuestionnaireItemEnableWhenComponent))
2446          return false;
2447        QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other_;
2448        return compareDeep(question, o.question, true) && compareDeep(operator, o.operator, true) && compareDeep(answer, o.answer, true)
2449          ;
2450      }
2451
2452      @Override
2453      public boolean equalsShallow(Base other_) {
2454        if (!super.equalsShallow(other_))
2455          return false;
2456        if (!(other_ instanceof QuestionnaireItemEnableWhenComponent))
2457          return false;
2458        QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other_;
2459        return compareValues(question, o.question, true) && compareValues(operator, o.operator, true);
2460      }
2461
2462      public boolean isEmpty() {
2463        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(question, operator, answer
2464          );
2465      }
2466
2467  public String fhirType() {
2468    return "Questionnaire.item.enableWhen";
2469
2470  }
2471
2472  }
2473
2474    @Block()
2475    public static class QuestionnaireItemAnswerOptionComponent extends BackboneElement implements IBaseBackboneElement {
2476        /**
2477         * A potential answer that's allowed as the answer to this question.
2478         */
2479        @Child(name = "value", type = {IntegerType.class, DateType.class, TimeType.class, StringType.class, Coding.class, Reference.class}, order=1, min=1, max=1, modifier=false, summary=false)
2480        @Description(shortDefinition="Answer value", formalDefinition="A potential answer that's allowed as the answer to this question." )
2481        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2482        protected Type value;
2483
2484        /**
2485         * Indicates whether the answer value is selected when the list of possible answers is initially shown.
2486         */
2487        @Child(name = "initialSelected", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2488        @Description(shortDefinition="Whether option is selected by default", formalDefinition="Indicates whether the answer value is selected when the list of possible answers is initially shown." )
2489        protected BooleanType initialSelected;
2490
2491        private static final long serialVersionUID = 1703686148L;
2492
2493    /**
2494     * Constructor
2495     */
2496      public QuestionnaireItemAnswerOptionComponent() {
2497        super();
2498      }
2499
2500    /**
2501     * Constructor
2502     */
2503      public QuestionnaireItemAnswerOptionComponent(Type value) {
2504        super();
2505        this.value = value;
2506      }
2507
2508        /**
2509         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2510         */
2511        public Type getValue() { 
2512          return this.value;
2513        }
2514
2515        /**
2516         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2517         */
2518        public IntegerType getValueIntegerType() throws FHIRException { 
2519          if (this.value == null)
2520            this.value = new IntegerType();
2521          if (!(this.value instanceof IntegerType))
2522            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2523          return (IntegerType) this.value;
2524        }
2525
2526        public boolean hasValueIntegerType() { 
2527          return this != null && this.value instanceof IntegerType;
2528        }
2529
2530        /**
2531         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2532         */
2533        public DateType getValueDateType() throws FHIRException { 
2534          if (this.value == null)
2535            this.value = new DateType();
2536          if (!(this.value instanceof DateType))
2537            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2538          return (DateType) this.value;
2539        }
2540
2541        public boolean hasValueDateType() { 
2542          return this != null && this.value instanceof DateType;
2543        }
2544
2545        /**
2546         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2547         */
2548        public TimeType getValueTimeType() throws FHIRException { 
2549          if (this.value == null)
2550            this.value = new TimeType();
2551          if (!(this.value instanceof TimeType))
2552            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2553          return (TimeType) this.value;
2554        }
2555
2556        public boolean hasValueTimeType() { 
2557          return this != null && this.value instanceof TimeType;
2558        }
2559
2560        /**
2561         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2562         */
2563        public StringType getValueStringType() throws FHIRException { 
2564          if (this.value == null)
2565            this.value = new StringType();
2566          if (!(this.value instanceof StringType))
2567            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2568          return (StringType) this.value;
2569        }
2570
2571        public boolean hasValueStringType() { 
2572          return this != null && this.value instanceof StringType;
2573        }
2574
2575        /**
2576         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2577         */
2578        public Coding getValueCoding() throws FHIRException { 
2579          if (this.value == null)
2580            this.value = new Coding();
2581          if (!(this.value instanceof Coding))
2582            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
2583          return (Coding) this.value;
2584        }
2585
2586        public boolean hasValueCoding() { 
2587          return this != null && this.value instanceof Coding;
2588        }
2589
2590        /**
2591         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2592         */
2593        public Reference getValueReference() throws FHIRException { 
2594          if (this.value == null)
2595            this.value = new Reference();
2596          if (!(this.value instanceof Reference))
2597            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
2598          return (Reference) this.value;
2599        }
2600
2601        public boolean hasValueReference() { 
2602          return this != null && this.value instanceof Reference;
2603        }
2604
2605        public boolean hasValue() { 
2606          return this.value != null && !this.value.isEmpty();
2607        }
2608
2609        /**
2610         * @param value {@link #value} (A potential answer that's allowed as the answer to this question.)
2611         */
2612        public QuestionnaireItemAnswerOptionComponent setValue(Type value) { 
2613          if (value != null && !(value instanceof IntegerType || value instanceof DateType || value instanceof TimeType || value instanceof StringType || value instanceof Coding || value instanceof Reference))
2614            throw new Error("Not the right type for Questionnaire.item.answerOption.value[x]: "+value.fhirType());
2615          this.value = value;
2616          return this;
2617        }
2618
2619        /**
2620         * @return {@link #initialSelected} (Indicates whether the answer value is selected when the list of possible answers is initially shown.). This is the underlying object with id, value and extensions. The accessor "getInitialSelected" gives direct access to the value
2621         */
2622        public BooleanType getInitialSelectedElement() { 
2623          if (this.initialSelected == null)
2624            if (Configuration.errorOnAutoCreate())
2625              throw new Error("Attempt to auto-create QuestionnaireItemAnswerOptionComponent.initialSelected");
2626            else if (Configuration.doAutoCreate())
2627              this.initialSelected = new BooleanType(); // bb
2628          return this.initialSelected;
2629        }
2630
2631        public boolean hasInitialSelectedElement() { 
2632          return this.initialSelected != null && !this.initialSelected.isEmpty();
2633        }
2634
2635        public boolean hasInitialSelected() { 
2636          return this.initialSelected != null && !this.initialSelected.isEmpty();
2637        }
2638
2639        /**
2640         * @param value {@link #initialSelected} (Indicates whether the answer value is selected when the list of possible answers is initially shown.). This is the underlying object with id, value and extensions. The accessor "getInitialSelected" gives direct access to the value
2641         */
2642        public QuestionnaireItemAnswerOptionComponent setInitialSelectedElement(BooleanType value) { 
2643          this.initialSelected = value;
2644          return this;
2645        }
2646
2647        /**
2648         * @return Indicates whether the answer value is selected when the list of possible answers is initially shown.
2649         */
2650        public boolean getInitialSelected() { 
2651          return this.initialSelected == null || this.initialSelected.isEmpty() ? false : this.initialSelected.getValue();
2652        }
2653
2654        /**
2655         * @param value Indicates whether the answer value is selected when the list of possible answers is initially shown.
2656         */
2657        public QuestionnaireItemAnswerOptionComponent setInitialSelected(boolean value) { 
2658            if (this.initialSelected == null)
2659              this.initialSelected = new BooleanType();
2660            this.initialSelected.setValue(value);
2661          return this;
2662        }
2663
2664        protected void listChildren(List<Property> children) {
2665          super.listChildren(children);
2666          children.add(new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value));
2667          children.add(new Property("initialSelected", "boolean", "Indicates whether the answer value is selected when the list of possible answers is initially shown.", 0, 1, initialSelected));
2668        }
2669
2670        @Override
2671        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2672          switch (_hash) {
2673          case -1410166417: /*value[x]*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2674          case 111972721: /*value*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2675          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2676          case -766192449: /*valueDate*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2677          case -765708322: /*valueTime*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2678          case -1424603934: /*valueString*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2679          case -1887705029: /*valueCoding*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2680          case 1755241690: /*valueReference*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2681          case -1310184961: /*initialSelected*/  return new Property("initialSelected", "boolean", "Indicates whether the answer value is selected when the list of possible answers is initially shown.", 0, 1, initialSelected);
2682          default: return super.getNamedProperty(_hash, _name, _checkValid);
2683          }
2684
2685        }
2686
2687      @Override
2688      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2689        switch (hash) {
2690        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
2691        case -1310184961: /*initialSelected*/ return this.initialSelected == null ? new Base[0] : new Base[] {this.initialSelected}; // BooleanType
2692        default: return super.getProperty(hash, name, checkValid);
2693        }
2694
2695      }
2696
2697      @Override
2698      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2699        switch (hash) {
2700        case 111972721: // value
2701          this.value = castToType(value); // Type
2702          return value;
2703        case -1310184961: // initialSelected
2704          this.initialSelected = castToBoolean(value); // BooleanType
2705          return value;
2706        default: return super.setProperty(hash, name, value);
2707        }
2708
2709      }
2710
2711      @Override
2712      public Base setProperty(String name, Base value) throws FHIRException {
2713        if (name.equals("value[x]")) {
2714          this.value = castToType(value); // Type
2715        } else if (name.equals("initialSelected")) {
2716          this.initialSelected = castToBoolean(value); // BooleanType
2717        } else
2718          return super.setProperty(name, value);
2719        return value;
2720      }
2721
2722      @Override
2723      public Base makeProperty(int hash, String name) throws FHIRException {
2724        switch (hash) {
2725        case -1410166417:  return getValue(); 
2726        case 111972721:  return getValue(); 
2727        case -1310184961:  return getInitialSelectedElement();
2728        default: return super.makeProperty(hash, name);
2729        }
2730
2731      }
2732
2733      @Override
2734      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2735        switch (hash) {
2736        case 111972721: /*value*/ return new String[] {"integer", "date", "time", "string", "Coding", "Reference"};
2737        case -1310184961: /*initialSelected*/ return new String[] {"boolean"};
2738        default: return super.getTypesForProperty(hash, name);
2739        }
2740
2741      }
2742
2743      @Override
2744      public Base addChild(String name) throws FHIRException {
2745        if (name.equals("valueInteger")) {
2746          this.value = new IntegerType();
2747          return this.value;
2748        }
2749        else if (name.equals("valueDate")) {
2750          this.value = new DateType();
2751          return this.value;
2752        }
2753        else if (name.equals("valueTime")) {
2754          this.value = new TimeType();
2755          return this.value;
2756        }
2757        else if (name.equals("valueString")) {
2758          this.value = new StringType();
2759          return this.value;
2760        }
2761        else if (name.equals("valueCoding")) {
2762          this.value = new Coding();
2763          return this.value;
2764        }
2765        else if (name.equals("valueReference")) {
2766          this.value = new Reference();
2767          return this.value;
2768        }
2769        else if (name.equals("initialSelected")) {
2770          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.initialSelected");
2771        }
2772        else
2773          return super.addChild(name);
2774      }
2775
2776      public QuestionnaireItemAnswerOptionComponent copy() {
2777        QuestionnaireItemAnswerOptionComponent dst = new QuestionnaireItemAnswerOptionComponent();
2778        copyValues(dst);
2779        return dst;
2780      }
2781
2782      public void copyValues(QuestionnaireItemAnswerOptionComponent dst) {
2783        super.copyValues(dst);
2784        dst.value = value == null ? null : value.copy();
2785        dst.initialSelected = initialSelected == null ? null : initialSelected.copy();
2786      }
2787
2788      @Override
2789      public boolean equalsDeep(Base other_) {
2790        if (!super.equalsDeep(other_))
2791          return false;
2792        if (!(other_ instanceof QuestionnaireItemAnswerOptionComponent))
2793          return false;
2794        QuestionnaireItemAnswerOptionComponent o = (QuestionnaireItemAnswerOptionComponent) other_;
2795        return compareDeep(value, o.value, true) && compareDeep(initialSelected, o.initialSelected, true)
2796          ;
2797      }
2798
2799      @Override
2800      public boolean equalsShallow(Base other_) {
2801        if (!super.equalsShallow(other_))
2802          return false;
2803        if (!(other_ instanceof QuestionnaireItemAnswerOptionComponent))
2804          return false;
2805        QuestionnaireItemAnswerOptionComponent o = (QuestionnaireItemAnswerOptionComponent) other_;
2806        return compareValues(initialSelected, o.initialSelected, true);
2807      }
2808
2809      public boolean isEmpty() {
2810        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, initialSelected);
2811      }
2812
2813  public String fhirType() {
2814    return "Questionnaire.item.answerOption";
2815
2816  }
2817
2818  }
2819
2820    @Block()
2821    public static class QuestionnaireItemInitialComponent extends BackboneElement implements IBaseBackboneElement {
2822        /**
2823         * The actual value to for an initial answer.
2824         */
2825        @Child(name = "value", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class, Quantity.class, Reference.class}, order=1, min=1, max=1, modifier=false, summary=false)
2826        @Description(shortDefinition="Actual value for initializing the question", formalDefinition="The actual value to for an initial answer." )
2827        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2828        protected Type value;
2829
2830        private static final long serialVersionUID = -732981989L;
2831
2832    /**
2833     * Constructor
2834     */
2835      public QuestionnaireItemInitialComponent() {
2836        super();
2837      }
2838
2839    /**
2840     * Constructor
2841     */
2842      public QuestionnaireItemInitialComponent(Type value) {
2843        super();
2844        this.value = value;
2845      }
2846
2847        /**
2848         * @return {@link #value} (The actual value to for an initial answer.)
2849         */
2850        public Type getValue() { 
2851          return this.value;
2852        }
2853
2854        /**
2855         * @return {@link #value} (The actual value to for an initial answer.)
2856         */
2857        public BooleanType getValueBooleanType() throws FHIRException { 
2858          if (this.value == null)
2859            this.value = new BooleanType();
2860          if (!(this.value instanceof BooleanType))
2861            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
2862          return (BooleanType) this.value;
2863        }
2864
2865        public boolean hasValueBooleanType() { 
2866          return this != null && this.value instanceof BooleanType;
2867        }
2868
2869        /**
2870         * @return {@link #value} (The actual value to for an initial answer.)
2871         */
2872        public DecimalType getValueDecimalType() throws FHIRException { 
2873          if (this.value == null)
2874            this.value = new DecimalType();
2875          if (!(this.value instanceof DecimalType))
2876            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
2877          return (DecimalType) this.value;
2878        }
2879
2880        public boolean hasValueDecimalType() { 
2881          return this != null && this.value instanceof DecimalType;
2882        }
2883
2884        /**
2885         * @return {@link #value} (The actual value to for an initial answer.)
2886         */
2887        public IntegerType getValueIntegerType() throws FHIRException { 
2888          if (this.value == null)
2889            this.value = new IntegerType();
2890          if (!(this.value instanceof IntegerType))
2891            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2892          return (IntegerType) this.value;
2893        }
2894
2895        public boolean hasValueIntegerType() { 
2896          return this != null && this.value instanceof IntegerType;
2897        }
2898
2899        /**
2900         * @return {@link #value} (The actual value to for an initial answer.)
2901         */
2902        public DateType getValueDateType() throws FHIRException { 
2903          if (this.value == null)
2904            this.value = new DateType();
2905          if (!(this.value instanceof DateType))
2906            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2907          return (DateType) this.value;
2908        }
2909
2910        public boolean hasValueDateType() { 
2911          return this != null && this.value instanceof DateType;
2912        }
2913
2914        /**
2915         * @return {@link #value} (The actual value to for an initial answer.)
2916         */
2917        public DateTimeType getValueDateTimeType() throws FHIRException { 
2918          if (this.value == null)
2919            this.value = new DateTimeType();
2920          if (!(this.value instanceof DateTimeType))
2921            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2922          return (DateTimeType) this.value;
2923        }
2924
2925        public boolean hasValueDateTimeType() { 
2926          return this != null && this.value instanceof DateTimeType;
2927        }
2928
2929        /**
2930         * @return {@link #value} (The actual value to for an initial answer.)
2931         */
2932        public TimeType getValueTimeType() throws FHIRException { 
2933          if (this.value == null)
2934            this.value = new TimeType();
2935          if (!(this.value instanceof TimeType))
2936            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2937          return (TimeType) this.value;
2938        }
2939
2940        public boolean hasValueTimeType() { 
2941          return this != null && this.value instanceof TimeType;
2942        }
2943
2944        /**
2945         * @return {@link #value} (The actual value to for an initial answer.)
2946         */
2947        public StringType getValueStringType() throws FHIRException { 
2948          if (this.value == null)
2949            this.value = new StringType();
2950          if (!(this.value instanceof StringType))
2951            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2952          return (StringType) this.value;
2953        }
2954
2955        public boolean hasValueStringType() { 
2956          return this != null && this.value instanceof StringType;
2957        }
2958
2959        /**
2960         * @return {@link #value} (The actual value to for an initial answer.)
2961         */
2962        public UriType getValueUriType() throws FHIRException { 
2963          if (this.value == null)
2964            this.value = new UriType();
2965          if (!(this.value instanceof UriType))
2966            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
2967          return (UriType) this.value;
2968        }
2969
2970        public boolean hasValueUriType() { 
2971          return this != null && this.value instanceof UriType;
2972        }
2973
2974        /**
2975         * @return {@link #value} (The actual value to for an initial answer.)
2976         */
2977        public Attachment getValueAttachment() throws FHIRException { 
2978          if (this.value == null)
2979            this.value = new Attachment();
2980          if (!(this.value instanceof Attachment))
2981            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
2982          return (Attachment) this.value;
2983        }
2984
2985        public boolean hasValueAttachment() { 
2986          return this != null && this.value instanceof Attachment;
2987        }
2988
2989        /**
2990         * @return {@link #value} (The actual value to for an initial answer.)
2991         */
2992        public Coding getValueCoding() throws FHIRException { 
2993          if (this.value == null)
2994            this.value = new Coding();
2995          if (!(this.value instanceof Coding))
2996            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
2997          return (Coding) this.value;
2998        }
2999
3000        public boolean hasValueCoding() { 
3001          return this != null && this.value instanceof Coding;
3002        }
3003
3004        /**
3005         * @return {@link #value} (The actual value to for an initial answer.)
3006         */
3007        public Quantity getValueQuantity() throws FHIRException { 
3008          if (this.value == null)
3009            this.value = new Quantity();
3010          if (!(this.value instanceof Quantity))
3011            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3012          return (Quantity) this.value;
3013        }
3014
3015        public boolean hasValueQuantity() { 
3016          return this != null && this.value instanceof Quantity;
3017        }
3018
3019        /**
3020         * @return {@link #value} (The actual value to for an initial answer.)
3021         */
3022        public Reference getValueReference() throws FHIRException { 
3023          if (this.value == null)
3024            this.value = new Reference();
3025          if (!(this.value instanceof Reference))
3026            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3027          return (Reference) this.value;
3028        }
3029
3030        public boolean hasValueReference() { 
3031          return this != null && this.value instanceof Reference;
3032        }
3033
3034        public boolean hasValue() { 
3035          return this.value != null && !this.value.isEmpty();
3036        }
3037
3038        /**
3039         * @param value {@link #value} (The actual value to for an initial answer.)
3040         */
3041        public QuestionnaireItemInitialComponent setValue(Type value) { 
3042          if (value != null && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType || value instanceof StringType || value instanceof UriType || value instanceof Attachment || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
3043            throw new Error("Not the right type for Questionnaire.item.initial.value[x]: "+value.fhirType());
3044          this.value = value;
3045          return this;
3046        }
3047
3048        protected void listChildren(List<Property> children) {
3049          super.listChildren(children);
3050          children.add(new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value));
3051        }
3052
3053        @Override
3054        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3055          switch (_hash) {
3056          case -1410166417: /*value[x]*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3057          case 111972721: /*value*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3058          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3059          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3060          case -1668204915: /*valueInteger*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3061          case -766192449: /*valueDate*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3062          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3063          case -765708322: /*valueTime*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3064          case -1424603934: /*valueString*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3065          case -1410172357: /*valueUri*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3066          case -475566732: /*valueAttachment*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3067          case -1887705029: /*valueCoding*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3068          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3069          case 1755241690: /*valueReference*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3070          default: return super.getNamedProperty(_hash, _name, _checkValid);
3071          }
3072
3073        }
3074
3075      @Override
3076      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3077        switch (hash) {
3078        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
3079        default: return super.getProperty(hash, name, checkValid);
3080        }
3081
3082      }
3083
3084      @Override
3085      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3086        switch (hash) {
3087        case 111972721: // value
3088          this.value = castToType(value); // Type
3089          return value;
3090        default: return super.setProperty(hash, name, value);
3091        }
3092
3093      }
3094
3095      @Override
3096      public Base setProperty(String name, Base value) throws FHIRException {
3097        if (name.equals("value[x]")) {
3098          this.value = castToType(value); // Type
3099        } else
3100          return super.setProperty(name, value);
3101        return value;
3102      }
3103
3104      @Override
3105      public Base makeProperty(int hash, String name) throws FHIRException {
3106        switch (hash) {
3107        case -1410166417:  return getValue(); 
3108        case 111972721:  return getValue(); 
3109        default: return super.makeProperty(hash, name);
3110        }
3111
3112      }
3113
3114      @Override
3115      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3116        switch (hash) {
3117        case 111972721: /*value*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
3118        default: return super.getTypesForProperty(hash, name);
3119        }
3120
3121      }
3122
3123      @Override
3124      public Base addChild(String name) throws FHIRException {
3125        if (name.equals("valueBoolean")) {
3126          this.value = new BooleanType();
3127          return this.value;
3128        }
3129        else if (name.equals("valueDecimal")) {
3130          this.value = new DecimalType();
3131          return this.value;
3132        }
3133        else if (name.equals("valueInteger")) {
3134          this.value = new IntegerType();
3135          return this.value;
3136        }
3137        else if (name.equals("valueDate")) {
3138          this.value = new DateType();
3139          return this.value;
3140        }
3141        else if (name.equals("valueDateTime")) {
3142          this.value = new DateTimeType();
3143          return this.value;
3144        }
3145        else if (name.equals("valueTime")) {
3146          this.value = new TimeType();
3147          return this.value;
3148        }
3149        else if (name.equals("valueString")) {
3150          this.value = new StringType();
3151          return this.value;
3152        }
3153        else if (name.equals("valueUri")) {
3154          this.value = new UriType();
3155          return this.value;
3156        }
3157        else if (name.equals("valueAttachment")) {
3158          this.value = new Attachment();
3159          return this.value;
3160        }
3161        else if (name.equals("valueCoding")) {
3162          this.value = new Coding();
3163          return this.value;
3164        }
3165        else if (name.equals("valueQuantity")) {
3166          this.value = new Quantity();
3167          return this.value;
3168        }
3169        else if (name.equals("valueReference")) {
3170          this.value = new Reference();
3171          return this.value;
3172        }
3173        else
3174          return super.addChild(name);
3175      }
3176
3177      public QuestionnaireItemInitialComponent copy() {
3178        QuestionnaireItemInitialComponent dst = new QuestionnaireItemInitialComponent();
3179        copyValues(dst);
3180        return dst;
3181      }
3182
3183      public void copyValues(QuestionnaireItemInitialComponent dst) {
3184        super.copyValues(dst);
3185        dst.value = value == null ? null : value.copy();
3186      }
3187
3188      @Override
3189      public boolean equalsDeep(Base other_) {
3190        if (!super.equalsDeep(other_))
3191          return false;
3192        if (!(other_ instanceof QuestionnaireItemInitialComponent))
3193          return false;
3194        QuestionnaireItemInitialComponent o = (QuestionnaireItemInitialComponent) other_;
3195        return compareDeep(value, o.value, true);
3196      }
3197
3198      @Override
3199      public boolean equalsShallow(Base other_) {
3200        if (!super.equalsShallow(other_))
3201          return false;
3202        if (!(other_ instanceof QuestionnaireItemInitialComponent))
3203          return false;
3204        QuestionnaireItemInitialComponent o = (QuestionnaireItemInitialComponent) other_;
3205        return true;
3206      }
3207
3208      public boolean isEmpty() {
3209        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
3210      }
3211
3212  public String fhirType() {
3213    return "Questionnaire.item.initial";
3214
3215  }
3216
3217  }
3218
3219    /**
3220     * A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.
3221     */
3222    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3223    @Description(shortDefinition="Additional identifier for the questionnaire", formalDefinition="A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance." )
3224    protected List<Identifier> identifier;
3225
3226    /**
3227     * The URL of a Questionnaire that this Questionnaire is based on.
3228     */
3229    @Child(name = "derivedFrom", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3230    @Description(shortDefinition="Instantiates protocol or definition", formalDefinition="The URL of a Questionnaire that this Questionnaire is based on." )
3231    protected List<CanonicalType> derivedFrom;
3232
3233    /**
3234     * The types of subjects that can be the subject of responses created for the questionnaire.
3235     */
3236    @Child(name = "subjectType", type = {CodeType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3237    @Description(shortDefinition="Resource that can be subject of QuestionnaireResponse", formalDefinition="The types of subjects that can be the subject of responses created for the questionnaire." )
3238    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
3239    protected List<CodeType> subjectType;
3240
3241    /**
3242     * Explanation of why this questionnaire is needed and why it has been designed as it has.
3243     */
3244    @Child(name = "purpose", type = {MarkdownType.class}, order=3, min=0, max=1, modifier=false, summary=false)
3245    @Description(shortDefinition="Why this questionnaire is defined", formalDefinition="Explanation of why this questionnaire is needed and why it has been designed as it has." )
3246    protected MarkdownType purpose;
3247
3248    /**
3249     * A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.
3250     */
3251    @Child(name = "copyright", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=false)
3252    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire." )
3253    protected MarkdownType copyright;
3254
3255    /**
3256     * The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
3257     */
3258    @Child(name = "approvalDate", type = {DateType.class}, order=5, min=0, max=1, modifier=false, summary=false)
3259    @Description(shortDefinition="When the questionnaire was approved by publisher", formalDefinition="The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage." )
3260    protected DateType approvalDate;
3261
3262    /**
3263     * The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
3264     */
3265    @Child(name = "lastReviewDate", type = {DateType.class}, order=6, min=0, max=1, modifier=false, summary=false)
3266    @Description(shortDefinition="When the questionnaire was last reviewed", formalDefinition="The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date." )
3267    protected DateType lastReviewDate;
3268
3269    /**
3270     * The period during which the questionnaire content was or is planned to be in active use.
3271     */
3272    @Child(name = "effectivePeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
3273    @Description(shortDefinition="When the questionnaire is expected to be used", formalDefinition="The period during which the questionnaire content was or is planned to be in active use." )
3274    protected Period effectivePeriod;
3275
3276    /**
3277     * An identifier for this question or group of questions in a particular terminology such as LOINC.
3278     */
3279    @Child(name = "code", type = {Coding.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3280    @Description(shortDefinition="Concept that represents the overall questionnaire", formalDefinition="An identifier for this question or group of questions in a particular terminology such as LOINC." )
3281    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-questions")
3282    protected List<Coding> code;
3283
3284    /**
3285     * A particular question, question grouping or display text that is part of the questionnaire.
3286     */
3287    @Child(name = "item", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3288    @Description(shortDefinition="Questions and sections within the Questionnaire", formalDefinition="A particular question, question grouping or display text that is part of the questionnaire." )
3289    protected List<QuestionnaireItemComponent> item;
3290
3291    private static final long serialVersionUID = 1036031192L;
3292
3293  /**
3294   * Constructor
3295   */
3296    public Questionnaire() {
3297      super();
3298    }
3299
3300  /**
3301   * Constructor
3302   */
3303    public Questionnaire(Enumeration<PublicationStatus> status) {
3304      super();
3305      this.status = status;
3306    }
3307
3308    /**
3309     * @return {@link #url} (An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3310     */
3311    public UriType getUrlElement() { 
3312      if (this.url == null)
3313        if (Configuration.errorOnAutoCreate())
3314          throw new Error("Attempt to auto-create Questionnaire.url");
3315        else if (Configuration.doAutoCreate())
3316          this.url = new UriType(); // bb
3317      return this.url;
3318    }
3319
3320    public boolean hasUrlElement() { 
3321      return this.url != null && !this.url.isEmpty();
3322    }
3323
3324    public boolean hasUrl() { 
3325      return this.url != null && !this.url.isEmpty();
3326    }
3327
3328    /**
3329     * @param value {@link #url} (An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3330     */
3331    public Questionnaire setUrlElement(UriType value) { 
3332      this.url = value;
3333      return this;
3334    }
3335
3336    /**
3337     * @return An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.
3338     */
3339    public String getUrl() { 
3340      return this.url == null ? null : this.url.getValue();
3341    }
3342
3343    /**
3344     * @param value An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.
3345     */
3346    public Questionnaire setUrl(String value) { 
3347      if (Utilities.noString(value))
3348        this.url = null;
3349      else {
3350        if (this.url == null)
3351          this.url = new UriType();
3352        this.url.setValue(value);
3353      }
3354      return this;
3355    }
3356
3357    /**
3358     * @return {@link #identifier} (A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.)
3359     */
3360    public List<Identifier> getIdentifier() { 
3361      if (this.identifier == null)
3362        this.identifier = new ArrayList<Identifier>();
3363      return this.identifier;
3364    }
3365
3366    /**
3367     * @return Returns a reference to <code>this</code> for easy method chaining
3368     */
3369    public Questionnaire setIdentifier(List<Identifier> theIdentifier) { 
3370      this.identifier = theIdentifier;
3371      return this;
3372    }
3373
3374    public boolean hasIdentifier() { 
3375      if (this.identifier == null)
3376        return false;
3377      for (Identifier item : this.identifier)
3378        if (!item.isEmpty())
3379          return true;
3380      return false;
3381    }
3382
3383    public Identifier addIdentifier() { //3
3384      Identifier t = new Identifier();
3385      if (this.identifier == null)
3386        this.identifier = new ArrayList<Identifier>();
3387      this.identifier.add(t);
3388      return t;
3389    }
3390
3391    public Questionnaire addIdentifier(Identifier t) { //3
3392      if (t == null)
3393        return this;
3394      if (this.identifier == null)
3395        this.identifier = new ArrayList<Identifier>();
3396      this.identifier.add(t);
3397      return this;
3398    }
3399
3400    /**
3401     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
3402     */
3403    public Identifier getIdentifierFirstRep() { 
3404      if (getIdentifier().isEmpty()) {
3405        addIdentifier();
3406      }
3407      return getIdentifier().get(0);
3408    }
3409
3410    /**
3411     * @return {@link #version} (The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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
3412     */
3413    public StringType getVersionElement() { 
3414      if (this.version == null)
3415        if (Configuration.errorOnAutoCreate())
3416          throw new Error("Attempt to auto-create Questionnaire.version");
3417        else if (Configuration.doAutoCreate())
3418          this.version = new StringType(); // bb
3419      return this.version;
3420    }
3421
3422    public boolean hasVersionElement() { 
3423      return this.version != null && !this.version.isEmpty();
3424    }
3425
3426    public boolean hasVersion() { 
3427      return this.version != null && !this.version.isEmpty();
3428    }
3429
3430    /**
3431     * @param value {@link #version} (The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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
3432     */
3433    public Questionnaire setVersionElement(StringType value) { 
3434      this.version = value;
3435      return this;
3436    }
3437
3438    /**
3439     * @return The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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.
3440     */
3441    public String getVersion() { 
3442      return this.version == null ? null : this.version.getValue();
3443    }
3444
3445    /**
3446     * @param value The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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.
3447     */
3448    public Questionnaire setVersion(String value) { 
3449      if (Utilities.noString(value))
3450        this.version = null;
3451      else {
3452        if (this.version == null)
3453          this.version = new StringType();
3454        this.version.setValue(value);
3455      }
3456      return this;
3457    }
3458
3459    /**
3460     * @return {@link #name} (A natural language name identifying the questionnaire. 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
3461     */
3462    public StringType getNameElement() { 
3463      if (this.name == null)
3464        if (Configuration.errorOnAutoCreate())
3465          throw new Error("Attempt to auto-create Questionnaire.name");
3466        else if (Configuration.doAutoCreate())
3467          this.name = new StringType(); // bb
3468      return this.name;
3469    }
3470
3471    public boolean hasNameElement() { 
3472      return this.name != null && !this.name.isEmpty();
3473    }
3474
3475    public boolean hasName() { 
3476      return this.name != null && !this.name.isEmpty();
3477    }
3478
3479    /**
3480     * @param value {@link #name} (A natural language name identifying the questionnaire. 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
3481     */
3482    public Questionnaire setNameElement(StringType value) { 
3483      this.name = value;
3484      return this;
3485    }
3486
3487    /**
3488     * @return A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.
3489     */
3490    public String getName() { 
3491      return this.name == null ? null : this.name.getValue();
3492    }
3493
3494    /**
3495     * @param value A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.
3496     */
3497    public Questionnaire setName(String value) { 
3498      if (Utilities.noString(value))
3499        this.name = null;
3500      else {
3501        if (this.name == null)
3502          this.name = new StringType();
3503        this.name.setValue(value);
3504      }
3505      return this;
3506    }
3507
3508    /**
3509     * @return {@link #title} (A short, descriptive, user-friendly title for the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3510     */
3511    public StringType getTitleElement() { 
3512      if (this.title == null)
3513        if (Configuration.errorOnAutoCreate())
3514          throw new Error("Attempt to auto-create Questionnaire.title");
3515        else if (Configuration.doAutoCreate())
3516          this.title = new StringType(); // bb
3517      return this.title;
3518    }
3519
3520    public boolean hasTitleElement() { 
3521      return this.title != null && !this.title.isEmpty();
3522    }
3523
3524    public boolean hasTitle() { 
3525      return this.title != null && !this.title.isEmpty();
3526    }
3527
3528    /**
3529     * @param value {@link #title} (A short, descriptive, user-friendly title for the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3530     */
3531    public Questionnaire setTitleElement(StringType value) { 
3532      this.title = value;
3533      return this;
3534    }
3535
3536    /**
3537     * @return A short, descriptive, user-friendly title for the questionnaire.
3538     */
3539    public String getTitle() { 
3540      return this.title == null ? null : this.title.getValue();
3541    }
3542
3543    /**
3544     * @param value A short, descriptive, user-friendly title for the questionnaire.
3545     */
3546    public Questionnaire setTitle(String value) { 
3547      if (Utilities.noString(value))
3548        this.title = null;
3549      else {
3550        if (this.title == null)
3551          this.title = new StringType();
3552        this.title.setValue(value);
3553      }
3554      return this;
3555    }
3556
3557    /**
3558     * @return {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3559     */
3560    public List<CanonicalType> getDerivedFrom() { 
3561      if (this.derivedFrom == null)
3562        this.derivedFrom = new ArrayList<CanonicalType>();
3563      return this.derivedFrom;
3564    }
3565
3566    /**
3567     * @return Returns a reference to <code>this</code> for easy method chaining
3568     */
3569    public Questionnaire setDerivedFrom(List<CanonicalType> theDerivedFrom) { 
3570      this.derivedFrom = theDerivedFrom;
3571      return this;
3572    }
3573
3574    public boolean hasDerivedFrom() { 
3575      if (this.derivedFrom == null)
3576        return false;
3577      for (CanonicalType item : this.derivedFrom)
3578        if (!item.isEmpty())
3579          return true;
3580      return false;
3581    }
3582
3583    /**
3584     * @return {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3585     */
3586    public CanonicalType addDerivedFromElement() {//2 
3587      CanonicalType t = new CanonicalType();
3588      if (this.derivedFrom == null)
3589        this.derivedFrom = new ArrayList<CanonicalType>();
3590      this.derivedFrom.add(t);
3591      return t;
3592    }
3593
3594    /**
3595     * @param value {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3596     */
3597    public Questionnaire addDerivedFrom(String value) { //1
3598      CanonicalType t = new CanonicalType();
3599      t.setValue(value);
3600      if (this.derivedFrom == null)
3601        this.derivedFrom = new ArrayList<CanonicalType>();
3602      this.derivedFrom.add(t);
3603      return this;
3604    }
3605
3606    /**
3607     * @param value {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3608     */
3609    public boolean hasDerivedFrom(String value) { 
3610      if (this.derivedFrom == null)
3611        return false;
3612      for (CanonicalType v : this.derivedFrom)
3613        if (v.getValue().equals(value)) // canonical(Questionnaire)
3614          return true;
3615      return false;
3616    }
3617
3618    /**
3619     * @return {@link #status} (The status of this questionnaire. 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
3620     */
3621    public Enumeration<PublicationStatus> getStatusElement() { 
3622      if (this.status == null)
3623        if (Configuration.errorOnAutoCreate())
3624          throw new Error("Attempt to auto-create Questionnaire.status");
3625        else if (Configuration.doAutoCreate())
3626          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
3627      return this.status;
3628    }
3629
3630    public boolean hasStatusElement() { 
3631      return this.status != null && !this.status.isEmpty();
3632    }
3633
3634    public boolean hasStatus() { 
3635      return this.status != null && !this.status.isEmpty();
3636    }
3637
3638    /**
3639     * @param value {@link #status} (The status of this questionnaire. 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
3640     */
3641    public Questionnaire setStatusElement(Enumeration<PublicationStatus> value) { 
3642      this.status = value;
3643      return this;
3644    }
3645
3646    /**
3647     * @return The status of this questionnaire. Enables tracking the life-cycle of the content.
3648     */
3649    public PublicationStatus getStatus() { 
3650      return this.status == null ? null : this.status.getValue();
3651    }
3652
3653    /**
3654     * @param value The status of this questionnaire. Enables tracking the life-cycle of the content.
3655     */
3656    public Questionnaire setStatus(PublicationStatus value) { 
3657        if (this.status == null)
3658          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
3659        this.status.setValue(value);
3660      return this;
3661    }
3662
3663    /**
3664     * @return {@link #experimental} (A Boolean value to indicate that this questionnaire 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
3665     */
3666    public BooleanType getExperimentalElement() { 
3667      if (this.experimental == null)
3668        if (Configuration.errorOnAutoCreate())
3669          throw new Error("Attempt to auto-create Questionnaire.experimental");
3670        else if (Configuration.doAutoCreate())
3671          this.experimental = new BooleanType(); // bb
3672      return this.experimental;
3673    }
3674
3675    public boolean hasExperimentalElement() { 
3676      return this.experimental != null && !this.experimental.isEmpty();
3677    }
3678
3679    public boolean hasExperimental() { 
3680      return this.experimental != null && !this.experimental.isEmpty();
3681    }
3682
3683    /**
3684     * @param value {@link #experimental} (A Boolean value to indicate that this questionnaire 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
3685     */
3686    public Questionnaire setExperimentalElement(BooleanType value) { 
3687      this.experimental = value;
3688      return this;
3689    }
3690
3691    /**
3692     * @return A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
3693     */
3694    public boolean getExperimental() { 
3695      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
3696    }
3697
3698    /**
3699     * @param value A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
3700     */
3701    public Questionnaire setExperimental(boolean value) { 
3702        if (this.experimental == null)
3703          this.experimental = new BooleanType();
3704        this.experimental.setValue(value);
3705      return this;
3706    }
3707
3708    /**
3709     * @return {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3710     */
3711    public List<CodeType> getSubjectType() { 
3712      if (this.subjectType == null)
3713        this.subjectType = new ArrayList<CodeType>();
3714      return this.subjectType;
3715    }
3716
3717    /**
3718     * @return Returns a reference to <code>this</code> for easy method chaining
3719     */
3720    public Questionnaire setSubjectType(List<CodeType> theSubjectType) { 
3721      this.subjectType = theSubjectType;
3722      return this;
3723    }
3724
3725    public boolean hasSubjectType() { 
3726      if (this.subjectType == null)
3727        return false;
3728      for (CodeType item : this.subjectType)
3729        if (!item.isEmpty())
3730          return true;
3731      return false;
3732    }
3733
3734    /**
3735     * @return {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3736     */
3737    public CodeType addSubjectTypeElement() {//2 
3738      CodeType t = new CodeType();
3739      if (this.subjectType == null)
3740        this.subjectType = new ArrayList<CodeType>();
3741      this.subjectType.add(t);
3742      return t;
3743    }
3744
3745    /**
3746     * @param value {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3747     */
3748    public Questionnaire addSubjectType(String value) { //1
3749      CodeType t = new CodeType();
3750      t.setValue(value);
3751      if (this.subjectType == null)
3752        this.subjectType = new ArrayList<CodeType>();
3753      this.subjectType.add(t);
3754      return this;
3755    }
3756
3757    /**
3758     * @param value {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3759     */
3760    public boolean hasSubjectType(String value) { 
3761      if (this.subjectType == null)
3762        return false;
3763      for (CodeType v : this.subjectType)
3764        if (v.getValue().equals(value)) // code
3765          return true;
3766      return false;
3767    }
3768
3769    /**
3770     * @return {@link #date} (The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3771     */
3772    public DateTimeType getDateElement() { 
3773      if (this.date == null)
3774        if (Configuration.errorOnAutoCreate())
3775          throw new Error("Attempt to auto-create Questionnaire.date");
3776        else if (Configuration.doAutoCreate())
3777          this.date = new DateTimeType(); // bb
3778      return this.date;
3779    }
3780
3781    public boolean hasDateElement() { 
3782      return this.date != null && !this.date.isEmpty();
3783    }
3784
3785    public boolean hasDate() { 
3786      return this.date != null && !this.date.isEmpty();
3787    }
3788
3789    /**
3790     * @param value {@link #date} (The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3791     */
3792    public Questionnaire setDateElement(DateTimeType value) { 
3793      this.date = value;
3794      return this;
3795    }
3796
3797    /**
3798     * @return The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.
3799     */
3800    public Date getDate() { 
3801      return this.date == null ? null : this.date.getValue();
3802    }
3803
3804    /**
3805     * @param value The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.
3806     */
3807    public Questionnaire setDate(Date value) { 
3808      if (value == null)
3809        this.date = null;
3810      else {
3811        if (this.date == null)
3812          this.date = new DateTimeType();
3813        this.date.setValue(value);
3814      }
3815      return this;
3816    }
3817
3818    /**
3819     * @return {@link #publisher} (The name of the organization or individual that published the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
3820     */
3821    public StringType getPublisherElement() { 
3822      if (this.publisher == null)
3823        if (Configuration.errorOnAutoCreate())
3824          throw new Error("Attempt to auto-create Questionnaire.publisher");
3825        else if (Configuration.doAutoCreate())
3826          this.publisher = new StringType(); // bb
3827      return this.publisher;
3828    }
3829
3830    public boolean hasPublisherElement() { 
3831      return this.publisher != null && !this.publisher.isEmpty();
3832    }
3833
3834    public boolean hasPublisher() { 
3835      return this.publisher != null && !this.publisher.isEmpty();
3836    }
3837
3838    /**
3839     * @param value {@link #publisher} (The name of the organization or individual that published the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
3840     */
3841    public Questionnaire setPublisherElement(StringType value) { 
3842      this.publisher = value;
3843      return this;
3844    }
3845
3846    /**
3847     * @return The name of the organization or individual that published the questionnaire.
3848     */
3849    public String getPublisher() { 
3850      return this.publisher == null ? null : this.publisher.getValue();
3851    }
3852
3853    /**
3854     * @param value The name of the organization or individual that published the questionnaire.
3855     */
3856    public Questionnaire setPublisher(String value) { 
3857      if (Utilities.noString(value))
3858        this.publisher = null;
3859      else {
3860        if (this.publisher == null)
3861          this.publisher = new StringType();
3862        this.publisher.setValue(value);
3863      }
3864      return this;
3865    }
3866
3867    /**
3868     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
3869     */
3870    public List<ContactDetail> getContact() { 
3871      if (this.contact == null)
3872        this.contact = new ArrayList<ContactDetail>();
3873      return this.contact;
3874    }
3875
3876    /**
3877     * @return Returns a reference to <code>this</code> for easy method chaining
3878     */
3879    public Questionnaire setContact(List<ContactDetail> theContact) { 
3880      this.contact = theContact;
3881      return this;
3882    }
3883
3884    public boolean hasContact() { 
3885      if (this.contact == null)
3886        return false;
3887      for (ContactDetail item : this.contact)
3888        if (!item.isEmpty())
3889          return true;
3890      return false;
3891    }
3892
3893    public ContactDetail addContact() { //3
3894      ContactDetail t = new ContactDetail();
3895      if (this.contact == null)
3896        this.contact = new ArrayList<ContactDetail>();
3897      this.contact.add(t);
3898      return t;
3899    }
3900
3901    public Questionnaire addContact(ContactDetail t) { //3
3902      if (t == null)
3903        return this;
3904      if (this.contact == null)
3905        this.contact = new ArrayList<ContactDetail>();
3906      this.contact.add(t);
3907      return this;
3908    }
3909
3910    /**
3911     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
3912     */
3913    public ContactDetail getContactFirstRep() { 
3914      if (getContact().isEmpty()) {
3915        addContact();
3916      }
3917      return getContact().get(0);
3918    }
3919
3920    /**
3921     * @return {@link #description} (A free text natural language description of the questionnaire from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
3922     */
3923    public MarkdownType getDescriptionElement() { 
3924      if (this.description == null)
3925        if (Configuration.errorOnAutoCreate())
3926          throw new Error("Attempt to auto-create Questionnaire.description");
3927        else if (Configuration.doAutoCreate())
3928          this.description = new MarkdownType(); // bb
3929      return this.description;
3930    }
3931
3932    public boolean hasDescriptionElement() { 
3933      return this.description != null && !this.description.isEmpty();
3934    }
3935
3936    public boolean hasDescription() { 
3937      return this.description != null && !this.description.isEmpty();
3938    }
3939
3940    /**
3941     * @param value {@link #description} (A free text natural language description of the questionnaire from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
3942     */
3943    public Questionnaire setDescriptionElement(MarkdownType value) { 
3944      this.description = value;
3945      return this;
3946    }
3947
3948    /**
3949     * @return A free text natural language description of the questionnaire from a consumer's perspective.
3950     */
3951    public String getDescription() { 
3952      return this.description == null ? null : this.description.getValue();
3953    }
3954
3955    /**
3956     * @param value A free text natural language description of the questionnaire from a consumer's perspective.
3957     */
3958    public Questionnaire setDescription(String value) { 
3959      if (value == null)
3960        this.description = null;
3961      else {
3962        if (this.description == null)
3963          this.description = new MarkdownType();
3964        this.description.setValue(value);
3965      }
3966      return this;
3967    }
3968
3969    /**
3970     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate questionnaire instances.)
3971     */
3972    public List<UsageContext> getUseContext() { 
3973      if (this.useContext == null)
3974        this.useContext = new ArrayList<UsageContext>();
3975      return this.useContext;
3976    }
3977
3978    /**
3979     * @return Returns a reference to <code>this</code> for easy method chaining
3980     */
3981    public Questionnaire setUseContext(List<UsageContext> theUseContext) { 
3982      this.useContext = theUseContext;
3983      return this;
3984    }
3985
3986    public boolean hasUseContext() { 
3987      if (this.useContext == null)
3988        return false;
3989      for (UsageContext item : this.useContext)
3990        if (!item.isEmpty())
3991          return true;
3992      return false;
3993    }
3994
3995    public UsageContext addUseContext() { //3
3996      UsageContext t = new UsageContext();
3997      if (this.useContext == null)
3998        this.useContext = new ArrayList<UsageContext>();
3999      this.useContext.add(t);
4000      return t;
4001    }
4002
4003    public Questionnaire addUseContext(UsageContext t) { //3
4004      if (t == null)
4005        return this;
4006      if (this.useContext == null)
4007        this.useContext = new ArrayList<UsageContext>();
4008      this.useContext.add(t);
4009      return this;
4010    }
4011
4012    /**
4013     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
4014     */
4015    public UsageContext getUseContextFirstRep() { 
4016      if (getUseContext().isEmpty()) {
4017        addUseContext();
4018      }
4019      return getUseContext().get(0);
4020    }
4021
4022    /**
4023     * @return {@link #jurisdiction} (A legal or geographic region in which the questionnaire is intended to be used.)
4024     */
4025    public List<CodeableConcept> getJurisdiction() { 
4026      if (this.jurisdiction == null)
4027        this.jurisdiction = new ArrayList<CodeableConcept>();
4028      return this.jurisdiction;
4029    }
4030
4031    /**
4032     * @return Returns a reference to <code>this</code> for easy method chaining
4033     */
4034    public Questionnaire setJurisdiction(List<CodeableConcept> theJurisdiction) { 
4035      this.jurisdiction = theJurisdiction;
4036      return this;
4037    }
4038
4039    public boolean hasJurisdiction() { 
4040      if (this.jurisdiction == null)
4041        return false;
4042      for (CodeableConcept item : this.jurisdiction)
4043        if (!item.isEmpty())
4044          return true;
4045      return false;
4046    }
4047
4048    public CodeableConcept addJurisdiction() { //3
4049      CodeableConcept t = new CodeableConcept();
4050      if (this.jurisdiction == null)
4051        this.jurisdiction = new ArrayList<CodeableConcept>();
4052      this.jurisdiction.add(t);
4053      return t;
4054    }
4055
4056    public Questionnaire addJurisdiction(CodeableConcept t) { //3
4057      if (t == null)
4058        return this;
4059      if (this.jurisdiction == null)
4060        this.jurisdiction = new ArrayList<CodeableConcept>();
4061      this.jurisdiction.add(t);
4062      return this;
4063    }
4064
4065    /**
4066     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
4067     */
4068    public CodeableConcept getJurisdictionFirstRep() { 
4069      if (getJurisdiction().isEmpty()) {
4070        addJurisdiction();
4071      }
4072      return getJurisdiction().get(0);
4073    }
4074
4075    /**
4076     * @return {@link #purpose} (Explanation of why this questionnaire 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
4077     */
4078    public MarkdownType getPurposeElement() { 
4079      if (this.purpose == null)
4080        if (Configuration.errorOnAutoCreate())
4081          throw new Error("Attempt to auto-create Questionnaire.purpose");
4082        else if (Configuration.doAutoCreate())
4083          this.purpose = new MarkdownType(); // bb
4084      return this.purpose;
4085    }
4086
4087    public boolean hasPurposeElement() { 
4088      return this.purpose != null && !this.purpose.isEmpty();
4089    }
4090
4091    public boolean hasPurpose() { 
4092      return this.purpose != null && !this.purpose.isEmpty();
4093    }
4094
4095    /**
4096     * @param value {@link #purpose} (Explanation of why this questionnaire 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
4097     */
4098    public Questionnaire setPurposeElement(MarkdownType value) { 
4099      this.purpose = value;
4100      return this;
4101    }
4102
4103    /**
4104     * @return Explanation of why this questionnaire is needed and why it has been designed as it has.
4105     */
4106    public String getPurpose() { 
4107      return this.purpose == null ? null : this.purpose.getValue();
4108    }
4109
4110    /**
4111     * @param value Explanation of why this questionnaire is needed and why it has been designed as it has.
4112     */
4113    public Questionnaire setPurpose(String value) { 
4114      if (value == null)
4115        this.purpose = null;
4116      else {
4117        if (this.purpose == null)
4118          this.purpose = new MarkdownType();
4119        this.purpose.setValue(value);
4120      }
4121      return this;
4122    }
4123
4124    /**
4125     * @return {@link #copyright} (A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
4126     */
4127    public MarkdownType getCopyrightElement() { 
4128      if (this.copyright == null)
4129        if (Configuration.errorOnAutoCreate())
4130          throw new Error("Attempt to auto-create Questionnaire.copyright");
4131        else if (Configuration.doAutoCreate())
4132          this.copyright = new MarkdownType(); // bb
4133      return this.copyright;
4134    }
4135
4136    public boolean hasCopyrightElement() { 
4137      return this.copyright != null && !this.copyright.isEmpty();
4138    }
4139
4140    public boolean hasCopyright() { 
4141      return this.copyright != null && !this.copyright.isEmpty();
4142    }
4143
4144    /**
4145     * @param value {@link #copyright} (A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
4146     */
4147    public Questionnaire setCopyrightElement(MarkdownType value) { 
4148      this.copyright = value;
4149      return this;
4150    }
4151
4152    /**
4153     * @return A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.
4154     */
4155    public String getCopyright() { 
4156      return this.copyright == null ? null : this.copyright.getValue();
4157    }
4158
4159    /**
4160     * @param value A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.
4161     */
4162    public Questionnaire setCopyright(String value) { 
4163      if (value == null)
4164        this.copyright = null;
4165      else {
4166        if (this.copyright == null)
4167          this.copyright = new MarkdownType();
4168        this.copyright.setValue(value);
4169      }
4170      return this;
4171    }
4172
4173    /**
4174     * @return {@link #approvalDate} (The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
4175     */
4176    public DateType getApprovalDateElement() { 
4177      if (this.approvalDate == null)
4178        if (Configuration.errorOnAutoCreate())
4179          throw new Error("Attempt to auto-create Questionnaire.approvalDate");
4180        else if (Configuration.doAutoCreate())
4181          this.approvalDate = new DateType(); // bb
4182      return this.approvalDate;
4183    }
4184
4185    public boolean hasApprovalDateElement() { 
4186      return this.approvalDate != null && !this.approvalDate.isEmpty();
4187    }
4188
4189    public boolean hasApprovalDate() { 
4190      return this.approvalDate != null && !this.approvalDate.isEmpty();
4191    }
4192
4193    /**
4194     * @param value {@link #approvalDate} (The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
4195     */
4196    public Questionnaire setApprovalDateElement(DateType value) { 
4197      this.approvalDate = value;
4198      return this;
4199    }
4200
4201    /**
4202     * @return The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
4203     */
4204    public Date getApprovalDate() { 
4205      return this.approvalDate == null ? null : this.approvalDate.getValue();
4206    }
4207
4208    /**
4209     * @param value The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
4210     */
4211    public Questionnaire setApprovalDate(Date value) { 
4212      if (value == null)
4213        this.approvalDate = null;
4214      else {
4215        if (this.approvalDate == null)
4216          this.approvalDate = new DateType();
4217        this.approvalDate.setValue(value);
4218      }
4219      return this;
4220    }
4221
4222    /**
4223     * @return {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
4224     */
4225    public DateType getLastReviewDateElement() { 
4226      if (this.lastReviewDate == null)
4227        if (Configuration.errorOnAutoCreate())
4228          throw new Error("Attempt to auto-create Questionnaire.lastReviewDate");
4229        else if (Configuration.doAutoCreate())
4230          this.lastReviewDate = new DateType(); // bb
4231      return this.lastReviewDate;
4232    }
4233
4234    public boolean hasLastReviewDateElement() { 
4235      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
4236    }
4237
4238    public boolean hasLastReviewDate() { 
4239      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
4240    }
4241
4242    /**
4243     * @param value {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
4244     */
4245    public Questionnaire setLastReviewDateElement(DateType value) { 
4246      this.lastReviewDate = value;
4247      return this;
4248    }
4249
4250    /**
4251     * @return The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
4252     */
4253    public Date getLastReviewDate() { 
4254      return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
4255    }
4256
4257    /**
4258     * @param value The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
4259     */
4260    public Questionnaire setLastReviewDate(Date value) { 
4261      if (value == null)
4262        this.lastReviewDate = null;
4263      else {
4264        if (this.lastReviewDate == null)
4265          this.lastReviewDate = new DateType();
4266        this.lastReviewDate.setValue(value);
4267      }
4268      return this;
4269    }
4270
4271    /**
4272     * @return {@link #effectivePeriod} (The period during which the questionnaire content was or is planned to be in active use.)
4273     */
4274    public Period getEffectivePeriod() { 
4275      if (this.effectivePeriod == null)
4276        if (Configuration.errorOnAutoCreate())
4277          throw new Error("Attempt to auto-create Questionnaire.effectivePeriod");
4278        else if (Configuration.doAutoCreate())
4279          this.effectivePeriod = new Period(); // cc
4280      return this.effectivePeriod;
4281    }
4282
4283    public boolean hasEffectivePeriod() { 
4284      return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
4285    }
4286
4287    /**
4288     * @param value {@link #effectivePeriod} (The period during which the questionnaire content was or is planned to be in active use.)
4289     */
4290    public Questionnaire setEffectivePeriod(Period value) { 
4291      this.effectivePeriod = value;
4292      return this;
4293    }
4294
4295    /**
4296     * @return {@link #code} (An identifier for this question or group of questions in a particular terminology such as LOINC.)
4297     */
4298    public List<Coding> getCode() { 
4299      if (this.code == null)
4300        this.code = new ArrayList<Coding>();
4301      return this.code;
4302    }
4303
4304    /**
4305     * @return Returns a reference to <code>this</code> for easy method chaining
4306     */
4307    public Questionnaire setCode(List<Coding> theCode) { 
4308      this.code = theCode;
4309      return this;
4310    }
4311
4312    public boolean hasCode() { 
4313      if (this.code == null)
4314        return false;
4315      for (Coding item : this.code)
4316        if (!item.isEmpty())
4317          return true;
4318      return false;
4319    }
4320
4321    public Coding addCode() { //3
4322      Coding t = new Coding();
4323      if (this.code == null)
4324        this.code = new ArrayList<Coding>();
4325      this.code.add(t);
4326      return t;
4327    }
4328
4329    public Questionnaire addCode(Coding t) { //3
4330      if (t == null)
4331        return this;
4332      if (this.code == null)
4333        this.code = new ArrayList<Coding>();
4334      this.code.add(t);
4335      return this;
4336    }
4337
4338    /**
4339     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
4340     */
4341    public Coding getCodeFirstRep() { 
4342      if (getCode().isEmpty()) {
4343        addCode();
4344      }
4345      return getCode().get(0);
4346    }
4347
4348    /**
4349     * @return {@link #item} (A particular question, question grouping or display text that is part of the questionnaire.)
4350     */
4351    public List<QuestionnaireItemComponent> getItem() { 
4352      if (this.item == null)
4353        this.item = new ArrayList<QuestionnaireItemComponent>();
4354      return this.item;
4355    }
4356
4357    /**
4358     * @return Returns a reference to <code>this</code> for easy method chaining
4359     */
4360    public Questionnaire setItem(List<QuestionnaireItemComponent> theItem) { 
4361      this.item = theItem;
4362      return this;
4363    }
4364
4365    public boolean hasItem() { 
4366      if (this.item == null)
4367        return false;
4368      for (QuestionnaireItemComponent item : this.item)
4369        if (!item.isEmpty())
4370          return true;
4371      return false;
4372    }
4373
4374    public QuestionnaireItemComponent addItem() { //3
4375      QuestionnaireItemComponent t = new QuestionnaireItemComponent();
4376      if (this.item == null)
4377        this.item = new ArrayList<QuestionnaireItemComponent>();
4378      this.item.add(t);
4379      return t;
4380    }
4381
4382    public Questionnaire addItem(QuestionnaireItemComponent t) { //3
4383      if (t == null)
4384        return this;
4385      if (this.item == null)
4386        this.item = new ArrayList<QuestionnaireItemComponent>();
4387      this.item.add(t);
4388      return this;
4389    }
4390
4391    /**
4392     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
4393     */
4394    public QuestionnaireItemComponent getItemFirstRep() { 
4395      if (getItem().isEmpty()) {
4396        addItem();
4397      }
4398      return getItem().get(0);
4399    }
4400
4401      protected void listChildren(List<Property> children) {
4402        super.listChildren(children);
4403        children.add(new Property("url", "uri", "An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.", 0, 1, url));
4404        children.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
4405        children.add(new Property("version", "string", "The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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));
4406        children.add(new Property("name", "string", "A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name));
4407        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the questionnaire.", 0, 1, title));
4408        children.add(new Property("derivedFrom", "canonical(Questionnaire)", "The URL of a Questionnaire that this Questionnaire is based on.", 0, java.lang.Integer.MAX_VALUE, derivedFrom));
4409        children.add(new Property("status", "code", "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, 1, status));
4410        children.add(new Property("experimental", "boolean", "A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental));
4411        children.add(new Property("subjectType", "code", "The types of subjects that can be the subject of responses created for the questionnaire.", 0, java.lang.Integer.MAX_VALUE, subjectType));
4412        children.add(new Property("date", "dateTime", "The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.", 0, 1, date));
4413        children.add(new Property("publisher", "string", "The name of the organization or individual that published the questionnaire.", 0, 1, publisher));
4414        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));
4415        children.add(new Property("description", "markdown", "A free text natural language description of the questionnaire from a consumer's perspective.", 0, 1, description));
4416        children.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate questionnaire instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
4417        children.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the questionnaire is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
4418        children.add(new Property("purpose", "markdown", "Explanation of why this questionnaire is needed and why it has been designed as it has.", 0, 1, purpose));
4419        children.add(new Property("copyright", "markdown", "A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.", 0, 1, copyright));
4420        children.add(new Property("approvalDate", "date", "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate));
4421        children.add(new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.", 0, 1, lastReviewDate));
4422        children.add(new Property("effectivePeriod", "Period", "The period during which the questionnaire content was or is planned to be in active use.", 0, 1, effectivePeriod));
4423        children.add(new Property("code", "Coding", "An identifier for this question or group of questions in a particular terminology such as LOINC.", 0, java.lang.Integer.MAX_VALUE, code));
4424        children.add(new Property("item", "", "A particular question, question grouping or display text that is part of the questionnaire.", 0, java.lang.Integer.MAX_VALUE, item));
4425      }
4426
4427      @Override
4428      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4429        switch (_hash) {
4430        case 116079: /*url*/  return new Property("url", "uri", "An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.", 0, 1, url);
4431        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier);
4432        case 351608024: /*version*/  return new Property("version", "string", "The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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);
4433        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name);
4434        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the questionnaire.", 0, 1, title);
4435        case 1077922663: /*derivedFrom*/  return new Property("derivedFrom", "canonical(Questionnaire)", "The URL of a Questionnaire that this Questionnaire is based on.", 0, java.lang.Integer.MAX_VALUE, derivedFrom);
4436        case -892481550: /*status*/  return new Property("status", "code", "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, 1, status);
4437        case -404562712: /*experimental*/  return new Property("experimental", "boolean", "A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental);
4438        case -603200890: /*subjectType*/  return new Property("subjectType", "code", "The types of subjects that can be the subject of responses created for the questionnaire.", 0, java.lang.Integer.MAX_VALUE, subjectType);
4439        case 3076014: /*date*/  return new Property("date", "dateTime", "The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.", 0, 1, date);
4440        case 1447404028: /*publisher*/  return new Property("publisher", "string", "The name of the organization or individual that published the questionnaire.", 0, 1, publisher);
4441        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);
4442        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the questionnaire from a consumer's perspective.", 0, 1, description);
4443        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 contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate questionnaire instances.", 0, java.lang.Integer.MAX_VALUE, useContext);
4444        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the questionnaire is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
4445        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explanation of why this questionnaire is needed and why it has been designed as it has.", 0, 1, purpose);
4446        case 1522889671: /*copyright*/  return new Property("copyright", "markdown", "A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.", 0, 1, copyright);
4447        case 223539345: /*approvalDate*/  return new Property("approvalDate", "date", "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate);
4448        case -1687512484: /*lastReviewDate*/  return new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.", 0, 1, lastReviewDate);
4449        case -403934648: /*effectivePeriod*/  return new Property("effectivePeriod", "Period", "The period during which the questionnaire content was or is planned to be in active use.", 0, 1, effectivePeriod);
4450        case 3059181: /*code*/  return new Property("code", "Coding", "An identifier for this question or group of questions in a particular terminology such as LOINC.", 0, java.lang.Integer.MAX_VALUE, code);
4451        case 3242771: /*item*/  return new Property("item", "", "A particular question, question grouping or display text that is part of the questionnaire.", 0, java.lang.Integer.MAX_VALUE, item);
4452        default: return super.getNamedProperty(_hash, _name, _checkValid);
4453        }
4454
4455      }
4456
4457      @Override
4458      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4459        switch (hash) {
4460        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
4461        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4462        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
4463        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
4464        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
4465        case 1077922663: /*derivedFrom*/ return this.derivedFrom == null ? new Base[0] : this.derivedFrom.toArray(new Base[this.derivedFrom.size()]); // CanonicalType
4466        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
4467        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
4468        case -603200890: /*subjectType*/ return this.subjectType == null ? new Base[0] : this.subjectType.toArray(new Base[this.subjectType.size()]); // CodeType
4469        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
4470        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
4471        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
4472        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
4473        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
4474        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
4475        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
4476        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
4477        case 223539345: /*approvalDate*/ return this.approvalDate == null ? new Base[0] : new Base[] {this.approvalDate}; // DateType
4478        case -1687512484: /*lastReviewDate*/ return this.lastReviewDate == null ? new Base[0] : new Base[] {this.lastReviewDate}; // DateType
4479        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
4480        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
4481        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireItemComponent
4482        default: return super.getProperty(hash, name, checkValid);
4483        }
4484
4485      }
4486
4487      @Override
4488      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4489        switch (hash) {
4490        case 116079: // url
4491          this.url = castToUri(value); // UriType
4492          return value;
4493        case -1618432855: // identifier
4494          this.getIdentifier().add(castToIdentifier(value)); // Identifier
4495          return value;
4496        case 351608024: // version
4497          this.version = castToString(value); // StringType
4498          return value;
4499        case 3373707: // name
4500          this.name = castToString(value); // StringType
4501          return value;
4502        case 110371416: // title
4503          this.title = castToString(value); // StringType
4504          return value;
4505        case 1077922663: // derivedFrom
4506          this.getDerivedFrom().add(castToCanonical(value)); // CanonicalType
4507          return value;
4508        case -892481550: // status
4509          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
4510          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4511          return value;
4512        case -404562712: // experimental
4513          this.experimental = castToBoolean(value); // BooleanType
4514          return value;
4515        case -603200890: // subjectType
4516          this.getSubjectType().add(castToCode(value)); // CodeType
4517          return value;
4518        case 3076014: // date
4519          this.date = castToDateTime(value); // DateTimeType
4520          return value;
4521        case 1447404028: // publisher
4522          this.publisher = castToString(value); // StringType
4523          return value;
4524        case 951526432: // contact
4525          this.getContact().add(castToContactDetail(value)); // ContactDetail
4526          return value;
4527        case -1724546052: // description
4528          this.description = castToMarkdown(value); // MarkdownType
4529          return value;
4530        case -669707736: // useContext
4531          this.getUseContext().add(castToUsageContext(value)); // UsageContext
4532          return value;
4533        case -507075711: // jurisdiction
4534          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
4535          return value;
4536        case -220463842: // purpose
4537          this.purpose = castToMarkdown(value); // MarkdownType
4538          return value;
4539        case 1522889671: // copyright
4540          this.copyright = castToMarkdown(value); // MarkdownType
4541          return value;
4542        case 223539345: // approvalDate
4543          this.approvalDate = castToDate(value); // DateType
4544          return value;
4545        case -1687512484: // lastReviewDate
4546          this.lastReviewDate = castToDate(value); // DateType
4547          return value;
4548        case -403934648: // effectivePeriod
4549          this.effectivePeriod = castToPeriod(value); // Period
4550          return value;
4551        case 3059181: // code
4552          this.getCode().add(castToCoding(value)); // Coding
4553          return value;
4554        case 3242771: // item
4555          this.getItem().add((QuestionnaireItemComponent) value); // QuestionnaireItemComponent
4556          return value;
4557        default: return super.setProperty(hash, name, value);
4558        }
4559
4560      }
4561
4562      @Override
4563      public Base setProperty(String name, Base value) throws FHIRException {
4564        if (name.equals("url")) {
4565          this.url = castToUri(value); // UriType
4566        } else if (name.equals("identifier")) {
4567          this.getIdentifier().add(castToIdentifier(value));
4568        } else if (name.equals("version")) {
4569          this.version = castToString(value); // StringType
4570        } else if (name.equals("name")) {
4571          this.name = castToString(value); // StringType
4572        } else if (name.equals("title")) {
4573          this.title = castToString(value); // StringType
4574        } else if (name.equals("derivedFrom")) {
4575          this.getDerivedFrom().add(castToCanonical(value));
4576        } else if (name.equals("status")) {
4577          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
4578          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4579        } else if (name.equals("experimental")) {
4580          this.experimental = castToBoolean(value); // BooleanType
4581        } else if (name.equals("subjectType")) {
4582          this.getSubjectType().add(castToCode(value));
4583        } else if (name.equals("date")) {
4584          this.date = castToDateTime(value); // DateTimeType
4585        } else if (name.equals("publisher")) {
4586          this.publisher = castToString(value); // StringType
4587        } else if (name.equals("contact")) {
4588          this.getContact().add(castToContactDetail(value));
4589        } else if (name.equals("description")) {
4590          this.description = castToMarkdown(value); // MarkdownType
4591        } else if (name.equals("useContext")) {
4592          this.getUseContext().add(castToUsageContext(value));
4593        } else if (name.equals("jurisdiction")) {
4594          this.getJurisdiction().add(castToCodeableConcept(value));
4595        } else if (name.equals("purpose")) {
4596          this.purpose = castToMarkdown(value); // MarkdownType
4597        } else if (name.equals("copyright")) {
4598          this.copyright = castToMarkdown(value); // MarkdownType
4599        } else if (name.equals("approvalDate")) {
4600          this.approvalDate = castToDate(value); // DateType
4601        } else if (name.equals("lastReviewDate")) {
4602          this.lastReviewDate = castToDate(value); // DateType
4603        } else if (name.equals("effectivePeriod")) {
4604          this.effectivePeriod = castToPeriod(value); // Period
4605        } else if (name.equals("code")) {
4606          this.getCode().add(castToCoding(value));
4607        } else if (name.equals("item")) {
4608          this.getItem().add((QuestionnaireItemComponent) value);
4609        } else
4610          return super.setProperty(name, value);
4611        return value;
4612      }
4613
4614      @Override
4615      public Base makeProperty(int hash, String name) throws FHIRException {
4616        switch (hash) {
4617        case 116079:  return getUrlElement();
4618        case -1618432855:  return addIdentifier(); 
4619        case 351608024:  return getVersionElement();
4620        case 3373707:  return getNameElement();
4621        case 110371416:  return getTitleElement();
4622        case 1077922663:  return addDerivedFromElement();
4623        case -892481550:  return getStatusElement();
4624        case -404562712:  return getExperimentalElement();
4625        case -603200890:  return addSubjectTypeElement();
4626        case 3076014:  return getDateElement();
4627        case 1447404028:  return getPublisherElement();
4628        case 951526432:  return addContact(); 
4629        case -1724546052:  return getDescriptionElement();
4630        case -669707736:  return addUseContext(); 
4631        case -507075711:  return addJurisdiction(); 
4632        case -220463842:  return getPurposeElement();
4633        case 1522889671:  return getCopyrightElement();
4634        case 223539345:  return getApprovalDateElement();
4635        case -1687512484:  return getLastReviewDateElement();
4636        case -403934648:  return getEffectivePeriod(); 
4637        case 3059181:  return addCode(); 
4638        case 3242771:  return addItem(); 
4639        default: return super.makeProperty(hash, name);
4640        }
4641
4642      }
4643
4644      @Override
4645      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4646        switch (hash) {
4647        case 116079: /*url*/ return new String[] {"uri"};
4648        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
4649        case 351608024: /*version*/ return new String[] {"string"};
4650        case 3373707: /*name*/ return new String[] {"string"};
4651        case 110371416: /*title*/ return new String[] {"string"};
4652        case 1077922663: /*derivedFrom*/ return new String[] {"canonical"};
4653        case -892481550: /*status*/ return new String[] {"code"};
4654        case -404562712: /*experimental*/ return new String[] {"boolean"};
4655        case -603200890: /*subjectType*/ return new String[] {"code"};
4656        case 3076014: /*date*/ return new String[] {"dateTime"};
4657        case 1447404028: /*publisher*/ return new String[] {"string"};
4658        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
4659        case -1724546052: /*description*/ return new String[] {"markdown"};
4660        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
4661        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
4662        case -220463842: /*purpose*/ return new String[] {"markdown"};
4663        case 1522889671: /*copyright*/ return new String[] {"markdown"};
4664        case 223539345: /*approvalDate*/ return new String[] {"date"};
4665        case -1687512484: /*lastReviewDate*/ return new String[] {"date"};
4666        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
4667        case 3059181: /*code*/ return new String[] {"Coding"};
4668        case 3242771: /*item*/ return new String[] {};
4669        default: return super.getTypesForProperty(hash, name);
4670        }
4671
4672      }
4673
4674      @Override
4675      public Base addChild(String name) throws FHIRException {
4676        if (name.equals("url")) {
4677          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.url");
4678        }
4679        else if (name.equals("identifier")) {
4680          return addIdentifier();
4681        }
4682        else if (name.equals("version")) {
4683          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.version");
4684        }
4685        else if (name.equals("name")) {
4686          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.name");
4687        }
4688        else if (name.equals("title")) {
4689          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.title");
4690        }
4691        else if (name.equals("derivedFrom")) {
4692          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.derivedFrom");
4693        }
4694        else if (name.equals("status")) {
4695          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.status");
4696        }
4697        else if (name.equals("experimental")) {
4698          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.experimental");
4699        }
4700        else if (name.equals("subjectType")) {
4701          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.subjectType");
4702        }
4703        else if (name.equals("date")) {
4704          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.date");
4705        }
4706        else if (name.equals("publisher")) {
4707          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.publisher");
4708        }
4709        else if (name.equals("contact")) {
4710          return addContact();
4711        }
4712        else if (name.equals("description")) {
4713          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.description");
4714        }
4715        else if (name.equals("useContext")) {
4716          return addUseContext();
4717        }
4718        else if (name.equals("jurisdiction")) {
4719          return addJurisdiction();
4720        }
4721        else if (name.equals("purpose")) {
4722          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.purpose");
4723        }
4724        else if (name.equals("copyright")) {
4725          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.copyright");
4726        }
4727        else if (name.equals("approvalDate")) {
4728          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.approvalDate");
4729        }
4730        else if (name.equals("lastReviewDate")) {
4731          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.lastReviewDate");
4732        }
4733        else if (name.equals("effectivePeriod")) {
4734          this.effectivePeriod = new Period();
4735          return this.effectivePeriod;
4736        }
4737        else if (name.equals("code")) {
4738          return addCode();
4739        }
4740        else if (name.equals("item")) {
4741          return addItem();
4742        }
4743        else
4744          return super.addChild(name);
4745      }
4746
4747  public String fhirType() {
4748    return "Questionnaire";
4749
4750  }
4751
4752      public Questionnaire copy() {
4753        Questionnaire dst = new Questionnaire();
4754        copyValues(dst);
4755        return dst;
4756      }
4757
4758      public void copyValues(Questionnaire dst) {
4759        super.copyValues(dst);
4760        dst.url = url == null ? null : url.copy();
4761        if (identifier != null) {
4762          dst.identifier = new ArrayList<Identifier>();
4763          for (Identifier i : identifier)
4764            dst.identifier.add(i.copy());
4765        };
4766        dst.version = version == null ? null : version.copy();
4767        dst.name = name == null ? null : name.copy();
4768        dst.title = title == null ? null : title.copy();
4769        if (derivedFrom != null) {
4770          dst.derivedFrom = new ArrayList<CanonicalType>();
4771          for (CanonicalType i : derivedFrom)
4772            dst.derivedFrom.add(i.copy());
4773        };
4774        dst.status = status == null ? null : status.copy();
4775        dst.experimental = experimental == null ? null : experimental.copy();
4776        if (subjectType != null) {
4777          dst.subjectType = new ArrayList<CodeType>();
4778          for (CodeType i : subjectType)
4779            dst.subjectType.add(i.copy());
4780        };
4781        dst.date = date == null ? null : date.copy();
4782        dst.publisher = publisher == null ? null : publisher.copy();
4783        if (contact != null) {
4784          dst.contact = new ArrayList<ContactDetail>();
4785          for (ContactDetail i : contact)
4786            dst.contact.add(i.copy());
4787        };
4788        dst.description = description == null ? null : description.copy();
4789        if (useContext != null) {
4790          dst.useContext = new ArrayList<UsageContext>();
4791          for (UsageContext i : useContext)
4792            dst.useContext.add(i.copy());
4793        };
4794        if (jurisdiction != null) {
4795          dst.jurisdiction = new ArrayList<CodeableConcept>();
4796          for (CodeableConcept i : jurisdiction)
4797            dst.jurisdiction.add(i.copy());
4798        };
4799        dst.purpose = purpose == null ? null : purpose.copy();
4800        dst.copyright = copyright == null ? null : copyright.copy();
4801        dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
4802        dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
4803        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
4804        if (code != null) {
4805          dst.code = new ArrayList<Coding>();
4806          for (Coding i : code)
4807            dst.code.add(i.copy());
4808        };
4809        if (item != null) {
4810          dst.item = new ArrayList<QuestionnaireItemComponent>();
4811          for (QuestionnaireItemComponent i : item)
4812            dst.item.add(i.copy());
4813        };
4814      }
4815
4816      protected Questionnaire typedCopy() {
4817        return copy();
4818      }
4819
4820      @Override
4821      public boolean equalsDeep(Base other_) {
4822        if (!super.equalsDeep(other_))
4823          return false;
4824        if (!(other_ instanceof Questionnaire))
4825          return false;
4826        Questionnaire o = (Questionnaire) other_;
4827        return compareDeep(identifier, o.identifier, true) && compareDeep(derivedFrom, o.derivedFrom, true)
4828           && compareDeep(subjectType, o.subjectType, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
4829           && compareDeep(approvalDate, o.approvalDate, true) && compareDeep(lastReviewDate, o.lastReviewDate, true)
4830           && compareDeep(effectivePeriod, o.effectivePeriod, true) && compareDeep(code, o.code, true) && compareDeep(item, o.item, true)
4831          ;
4832      }
4833
4834      @Override
4835      public boolean equalsShallow(Base other_) {
4836        if (!super.equalsShallow(other_))
4837          return false;
4838        if (!(other_ instanceof Questionnaire))
4839          return false;
4840        Questionnaire o = (Questionnaire) other_;
4841        return compareValues(subjectType, o.subjectType, true) && compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true)
4842           && compareValues(approvalDate, o.approvalDate, true) && compareValues(lastReviewDate, o.lastReviewDate, true)
4843          ;
4844      }
4845
4846      public boolean isEmpty() {
4847        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, derivedFrom, subjectType
4848          , purpose, copyright, approvalDate, lastReviewDate, effectivePeriod, code, item
4849          );
4850      }
4851
4852  @Override
4853  public ResourceType getResourceType() {
4854    return ResourceType.Questionnaire;
4855   }
4856
4857 /**
4858   * Search parameter: <b>date</b>
4859   * <p>
4860   * Description: <b>The questionnaire publication date</b><br>
4861   * Type: <b>date</b><br>
4862   * Path: <b>Questionnaire.date</b><br>
4863   * </p>
4864   */
4865  @SearchParamDefinition(name="date", path="Questionnaire.date", description="The questionnaire publication date", type="date" )
4866  public static final String SP_DATE = "date";
4867 /**
4868   * <b>Fluent Client</b> search parameter constant for <b>date</b>
4869   * <p>
4870   * Description: <b>The questionnaire publication date</b><br>
4871   * Type: <b>date</b><br>
4872   * Path: <b>Questionnaire.date</b><br>
4873   * </p>
4874   */
4875  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
4876
4877 /**
4878   * Search parameter: <b>identifier</b>
4879   * <p>
4880   * Description: <b>External identifier for the questionnaire</b><br>
4881   * Type: <b>token</b><br>
4882   * Path: <b>Questionnaire.identifier</b><br>
4883   * </p>
4884   */
4885  @SearchParamDefinition(name="identifier", path="Questionnaire.identifier", description="External identifier for the questionnaire", type="token" )
4886  public static final String SP_IDENTIFIER = "identifier";
4887 /**
4888   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4889   * <p>
4890   * Description: <b>External identifier for the questionnaire</b><br>
4891   * Type: <b>token</b><br>
4892   * Path: <b>Questionnaire.identifier</b><br>
4893   * </p>
4894   */
4895  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4896
4897 /**
4898   * Search parameter: <b>code</b>
4899   * <p>
4900   * Description: <b>A code that corresponds to one of its items in the questionnaire</b><br>
4901   * Type: <b>token</b><br>
4902   * Path: <b>Questionnaire.item.code</b><br>
4903   * </p>
4904   */
4905  @SearchParamDefinition(name="code", path="Questionnaire.item.code", description="A code that corresponds to one of its items in the questionnaire", type="token" )
4906  public static final String SP_CODE = "code";
4907 /**
4908   * <b>Fluent Client</b> search parameter constant for <b>code</b>
4909   * <p>
4910   * Description: <b>A code that corresponds to one of its items in the questionnaire</b><br>
4911   * Type: <b>token</b><br>
4912   * Path: <b>Questionnaire.item.code</b><br>
4913   * </p>
4914   */
4915  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
4916
4917 /**
4918   * Search parameter: <b>context-type-value</b>
4919   * <p>
4920   * Description: <b>A use context type and value assigned to the questionnaire</b><br>
4921   * Type: <b>composite</b><br>
4922   * Path: <b></b><br>
4923   * </p>
4924   */
4925  @SearchParamDefinition(name="context-type-value", path="Questionnaire.useContext", description="A use context type and value assigned to the questionnaire", type="composite", compositeOf={"context-type", "context"} )
4926  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
4927 /**
4928   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
4929   * <p>
4930   * Description: <b>A use context type and value assigned to the questionnaire</b><br>
4931   * Type: <b>composite</b><br>
4932   * Path: <b></b><br>
4933   * </p>
4934   */
4935  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> CONTEXT_TYPE_VALUE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(SP_CONTEXT_TYPE_VALUE);
4936
4937 /**
4938   * Search parameter: <b>jurisdiction</b>
4939   * <p>
4940   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
4941   * Type: <b>token</b><br>
4942   * Path: <b>Questionnaire.jurisdiction</b><br>
4943   * </p>
4944   */
4945  @SearchParamDefinition(name="jurisdiction", path="Questionnaire.jurisdiction", description="Intended jurisdiction for the questionnaire", type="token" )
4946  public static final String SP_JURISDICTION = "jurisdiction";
4947 /**
4948   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
4949   * <p>
4950   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
4951   * Type: <b>token</b><br>
4952   * Path: <b>Questionnaire.jurisdiction</b><br>
4953   * </p>
4954   */
4955  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
4956
4957 /**
4958   * Search parameter: <b>description</b>
4959   * <p>
4960   * Description: <b>The description of the questionnaire</b><br>
4961   * Type: <b>string</b><br>
4962   * Path: <b>Questionnaire.description</b><br>
4963   * </p>
4964   */
4965  @SearchParamDefinition(name="description", path="Questionnaire.description", description="The description of the questionnaire", type="string" )
4966  public static final String SP_DESCRIPTION = "description";
4967 /**
4968   * <b>Fluent Client</b> search parameter constant for <b>description</b>
4969   * <p>
4970   * Description: <b>The description of the questionnaire</b><br>
4971   * Type: <b>string</b><br>
4972   * Path: <b>Questionnaire.description</b><br>
4973   * </p>
4974   */
4975  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
4976
4977 /**
4978   * Search parameter: <b>context-type</b>
4979   * <p>
4980   * Description: <b>A type of use context assigned to the questionnaire</b><br>
4981   * Type: <b>token</b><br>
4982   * Path: <b>Questionnaire.useContext.code</b><br>
4983   * </p>
4984   */
4985  @SearchParamDefinition(name="context-type", path="Questionnaire.useContext.code", description="A type of use context assigned to the questionnaire", type="token" )
4986  public static final String SP_CONTEXT_TYPE = "context-type";
4987 /**
4988   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
4989   * <p>
4990   * Description: <b>A type of use context assigned to the questionnaire</b><br>
4991   * Type: <b>token</b><br>
4992   * Path: <b>Questionnaire.useContext.code</b><br>
4993   * </p>
4994   */
4995  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT_TYPE);
4996
4997 /**
4998   * Search parameter: <b>title</b>
4999   * <p>
5000   * Description: <b>The human-friendly name of the questionnaire</b><br>
5001   * Type: <b>string</b><br>
5002   * Path: <b>Questionnaire.title</b><br>
5003   * </p>
5004   */
5005  @SearchParamDefinition(name="title", path="Questionnaire.title", description="The human-friendly name of the questionnaire", type="string" )
5006  public static final String SP_TITLE = "title";
5007 /**
5008   * <b>Fluent Client</b> search parameter constant for <b>title</b>
5009   * <p>
5010   * Description: <b>The human-friendly name of the questionnaire</b><br>
5011   * Type: <b>string</b><br>
5012   * Path: <b>Questionnaire.title</b><br>
5013   * </p>
5014   */
5015  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
5016
5017 /**
5018   * Search parameter: <b>version</b>
5019   * <p>
5020   * Description: <b>The business version of the questionnaire</b><br>
5021   * Type: <b>token</b><br>
5022   * Path: <b>Questionnaire.version</b><br>
5023   * </p>
5024   */
5025  @SearchParamDefinition(name="version", path="Questionnaire.version", description="The business version of the questionnaire", type="token" )
5026  public static final String SP_VERSION = "version";
5027 /**
5028   * <b>Fluent Client</b> search parameter constant for <b>version</b>
5029   * <p>
5030   * Description: <b>The business version of the questionnaire</b><br>
5031   * Type: <b>token</b><br>
5032   * Path: <b>Questionnaire.version</b><br>
5033   * </p>
5034   */
5035  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
5036
5037 /**
5038   * Search parameter: <b>url</b>
5039   * <p>
5040   * Description: <b>The uri that identifies the questionnaire</b><br>
5041   * Type: <b>uri</b><br>
5042   * Path: <b>Questionnaire.url</b><br>
5043   * </p>
5044   */
5045  @SearchParamDefinition(name="url", path="Questionnaire.url", description="The uri that identifies the questionnaire", type="uri" )
5046  public static final String SP_URL = "url";
5047 /**
5048   * <b>Fluent Client</b> search parameter constant for <b>url</b>
5049   * <p>
5050   * Description: <b>The uri that identifies the questionnaire</b><br>
5051   * Type: <b>uri</b><br>
5052   * Path: <b>Questionnaire.url</b><br>
5053   * </p>
5054   */
5055  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
5056
5057 /**
5058   * Search parameter: <b>context-quantity</b>
5059   * <p>
5060   * Description: <b>A quantity- or range-valued use context assigned to the questionnaire</b><br>
5061   * Type: <b>quantity</b><br>
5062   * Path: <b>Questionnaire.useContext.valueQuantity, Questionnaire.useContext.valueRange</b><br>
5063   * </p>
5064   */
5065  @SearchParamDefinition(name="context-quantity", path="(Questionnaire.useContext.value as Quantity) | (Questionnaire.useContext.value as Range)", description="A quantity- or range-valued use context assigned to the questionnaire", type="quantity" )
5066  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
5067 /**
5068   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
5069   * <p>
5070   * Description: <b>A quantity- or range-valued use context assigned to the questionnaire</b><br>
5071   * Type: <b>quantity</b><br>
5072   * Path: <b>Questionnaire.useContext.valueQuantity, Questionnaire.useContext.valueRange</b><br>
5073   * </p>
5074   */
5075  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_CONTEXT_QUANTITY);
5076
5077 /**
5078   * Search parameter: <b>effective</b>
5079   * <p>
5080   * Description: <b>The time during which the questionnaire is intended to be in use</b><br>
5081   * Type: <b>date</b><br>
5082   * Path: <b>Questionnaire.effectivePeriod</b><br>
5083   * </p>
5084   */
5085  @SearchParamDefinition(name="effective", path="Questionnaire.effectivePeriod", description="The time during which the questionnaire is intended to be in use", type="date" )
5086  public static final String SP_EFFECTIVE = "effective";
5087 /**
5088   * <b>Fluent Client</b> search parameter constant for <b>effective</b>
5089   * <p>
5090   * Description: <b>The time during which the questionnaire is intended to be in use</b><br>
5091   * Type: <b>date</b><br>
5092   * Path: <b>Questionnaire.effectivePeriod</b><br>
5093   * </p>
5094   */
5095  public static final ca.uhn.fhir.rest.gclient.DateClientParam EFFECTIVE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EFFECTIVE);
5096
5097 /**
5098   * Search parameter: <b>subject-type</b>
5099   * <p>
5100   * Description: <b>Resource that can be subject of QuestionnaireResponse</b><br>
5101   * Type: <b>token</b><br>
5102   * Path: <b>Questionnaire.subjectType</b><br>
5103   * </p>
5104   */
5105  @SearchParamDefinition(name="subject-type", path="Questionnaire.subjectType", description="Resource that can be subject of QuestionnaireResponse", type="token" )
5106  public static final String SP_SUBJECT_TYPE = "subject-type";
5107 /**
5108   * <b>Fluent Client</b> search parameter constant for <b>subject-type</b>
5109   * <p>
5110   * Description: <b>Resource that can be subject of QuestionnaireResponse</b><br>
5111   * Type: <b>token</b><br>
5112   * Path: <b>Questionnaire.subjectType</b><br>
5113   * </p>
5114   */
5115  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUBJECT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUBJECT_TYPE);
5116
5117 /**
5118   * Search parameter: <b>name</b>
5119   * <p>
5120   * Description: <b>Computationally friendly name of the questionnaire</b><br>
5121   * Type: <b>string</b><br>
5122   * Path: <b>Questionnaire.name</b><br>
5123   * </p>
5124   */
5125  @SearchParamDefinition(name="name", path="Questionnaire.name", description="Computationally friendly name of the questionnaire", type="string" )
5126  public static final String SP_NAME = "name";
5127 /**
5128   * <b>Fluent Client</b> search parameter constant for <b>name</b>
5129   * <p>
5130   * Description: <b>Computationally friendly name of the questionnaire</b><br>
5131   * Type: <b>string</b><br>
5132   * Path: <b>Questionnaire.name</b><br>
5133   * </p>
5134   */
5135  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
5136
5137 /**
5138   * Search parameter: <b>context</b>
5139   * <p>
5140   * Description: <b>A use context assigned to the questionnaire</b><br>
5141   * Type: <b>token</b><br>
5142   * Path: <b>Questionnaire.useContext.valueCodeableConcept</b><br>
5143   * </p>
5144   */
5145  @SearchParamDefinition(name="context", path="(Questionnaire.useContext.value as CodeableConcept)", description="A use context assigned to the questionnaire", type="token" )
5146  public static final String SP_CONTEXT = "context";
5147 /**
5148   * <b>Fluent Client</b> search parameter constant for <b>context</b>
5149   * <p>
5150   * Description: <b>A use context assigned to the questionnaire</b><br>
5151   * Type: <b>token</b><br>
5152   * Path: <b>Questionnaire.useContext.valueCodeableConcept</b><br>
5153   * </p>
5154   */
5155  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
5156
5157 /**
5158   * Search parameter: <b>publisher</b>
5159   * <p>
5160   * Description: <b>Name of the publisher of the questionnaire</b><br>
5161   * Type: <b>string</b><br>
5162   * Path: <b>Questionnaire.publisher</b><br>
5163   * </p>
5164   */
5165  @SearchParamDefinition(name="publisher", path="Questionnaire.publisher", description="Name of the publisher of the questionnaire", type="string" )
5166  public static final String SP_PUBLISHER = "publisher";
5167 /**
5168   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
5169   * <p>
5170   * Description: <b>Name of the publisher of the questionnaire</b><br>
5171   * Type: <b>string</b><br>
5172   * Path: <b>Questionnaire.publisher</b><br>
5173   * </p>
5174   */
5175  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
5176
5177 /**
5178   * Search parameter: <b>definition</b>
5179   * <p>
5180   * Description: <b>ElementDefinition - details for the item</b><br>
5181   * Type: <b>uri</b><br>
5182   * Path: <b>Questionnaire.item.definition</b><br>
5183   * </p>
5184   */
5185  @SearchParamDefinition(name="definition", path="Questionnaire.item.definition", description="ElementDefinition - details for the item", type="uri" )
5186  public static final String SP_DEFINITION = "definition";
5187 /**
5188   * <b>Fluent Client</b> search parameter constant for <b>definition</b>
5189   * <p>
5190   * Description: <b>ElementDefinition - details for the item</b><br>
5191   * Type: <b>uri</b><br>
5192   * Path: <b>Questionnaire.item.definition</b><br>
5193   * </p>
5194   */
5195  public static final ca.uhn.fhir.rest.gclient.UriClientParam DEFINITION = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_DEFINITION);
5196
5197 /**
5198   * Search parameter: <b>context-type-quantity</b>
5199   * <p>
5200   * Description: <b>A use context type and quantity- or range-based value assigned to the questionnaire</b><br>
5201   * Type: <b>composite</b><br>
5202   * Path: <b></b><br>
5203   * </p>
5204   */
5205  @SearchParamDefinition(name="context-type-quantity", path="Questionnaire.useContext", description="A use context type and quantity- or range-based value assigned to the questionnaire", type="composite", compositeOf={"context-type", "context-quantity"} )
5206  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
5207 /**
5208   * <b>Fluent Client</b> search parameter constant for <b>context-type-quantity</b>
5209   * <p>
5210   * Description: <b>A use context type and quantity- or range-based value assigned to the questionnaire</b><br>
5211   * Type: <b>composite</b><br>
5212   * Path: <b></b><br>
5213   * </p>
5214   */
5215  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam> CONTEXT_TYPE_QUANTITY = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam>(SP_CONTEXT_TYPE_QUANTITY);
5216
5217 /**
5218   * Search parameter: <b>status</b>
5219   * <p>
5220   * Description: <b>The current status of the questionnaire</b><br>
5221   * Type: <b>token</b><br>
5222   * Path: <b>Questionnaire.status</b><br>
5223   * </p>
5224   */
5225  @SearchParamDefinition(name="status", path="Questionnaire.status", description="The current status of the questionnaire", type="token" )
5226  public static final String SP_STATUS = "status";
5227 /**
5228   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5229   * <p>
5230   * Description: <b>The current status of the questionnaire</b><br>
5231   * Type: <b>token</b><br>
5232   * Path: <b>Questionnaire.status</b><br>
5233   * </p>
5234   */
5235  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
5236
5237
5238}