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 ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.
050 */
051@ResourceDef(name="NutritionOrder", profile="http://hl7.org/fhir/StructureDefinition/NutritionOrder")
052public class NutritionOrder extends DomainResource {
053
054    public enum NutritionOrderStatus {
055        /**
056         * The request has been created but is not yet complete or ready for action.
057         */
058        DRAFT, 
059        /**
060         * The request is in force and ready to be acted upon.
061         */
062        ACTIVE, 
063        /**
064         * The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.
065         */
066        ONHOLD, 
067        /**
068         * The request (and any implicit authorization to act) has been terminated prior to the known full completion of the intended actions.  No further activity should occur.
069         */
070        REVOKED, 
071        /**
072         * The activity described by the request has been fully performed.  No further activity will occur.
073         */
074        COMPLETED, 
075        /**
076         * This request should never have existed and should be considered 'void'.  (It is possible that real-world decisions were based on it.  If real-world activity has occurred, the status should be "revoked" rather than "entered-in-error".).
077         */
078        ENTEREDINERROR, 
079        /**
080         * The authoring/source system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply,  but the authoring/source system does not know which.
081         */
082        UNKNOWN, 
083        /**
084         * added to help the parsers with the generic types
085         */
086        NULL;
087        public static NutritionOrderStatus fromCode(String codeString) throws FHIRException {
088            if (codeString == null || "".equals(codeString))
089                return null;
090        if ("draft".equals(codeString))
091          return DRAFT;
092        if ("active".equals(codeString))
093          return ACTIVE;
094        if ("on-hold".equals(codeString))
095          return ONHOLD;
096        if ("revoked".equals(codeString))
097          return REVOKED;
098        if ("completed".equals(codeString))
099          return COMPLETED;
100        if ("entered-in-error".equals(codeString))
101          return ENTEREDINERROR;
102        if ("unknown".equals(codeString))
103          return UNKNOWN;
104        if (Configuration.isAcceptInvalidEnums())
105          return null;
106        else
107          throw new FHIRException("Unknown NutritionOrderStatus code '"+codeString+"'");
108        }
109        public String toCode() {
110          switch (this) {
111            case DRAFT: return "draft";
112            case ACTIVE: return "active";
113            case ONHOLD: return "on-hold";
114            case REVOKED: return "revoked";
115            case COMPLETED: return "completed";
116            case ENTEREDINERROR: return "entered-in-error";
117            case UNKNOWN: return "unknown";
118            default: return "?";
119          }
120        }
121        public String getSystem() {
122          switch (this) {
123            case DRAFT: return "http://hl7.org/fhir/request-status";
124            case ACTIVE: return "http://hl7.org/fhir/request-status";
125            case ONHOLD: return "http://hl7.org/fhir/request-status";
126            case REVOKED: return "http://hl7.org/fhir/request-status";
127            case COMPLETED: return "http://hl7.org/fhir/request-status";
128            case ENTEREDINERROR: return "http://hl7.org/fhir/request-status";
129            case UNKNOWN: return "http://hl7.org/fhir/request-status";
130            default: return "?";
131          }
132        }
133        public String getDefinition() {
134          switch (this) {
135            case DRAFT: return "The request has been created but is not yet complete or ready for action.";
136            case ACTIVE: return "The request is in force and ready to be acted upon.";
137            case ONHOLD: return "The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.";
138            case REVOKED: return "The request (and any implicit authorization to act) has been terminated prior to the known full completion of the intended actions.  No further activity should occur.";
139            case COMPLETED: return "The activity described by the request has been fully performed.  No further activity will occur.";
140            case ENTEREDINERROR: return "This request should never have existed and should be considered 'void'.  (It is possible that real-world decisions were based on it.  If real-world activity has occurred, the status should be \"revoked\" rather than \"entered-in-error\".).";
141            case UNKNOWN: return "The authoring/source system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply,  but the authoring/source system does not know which.";
142            default: return "?";
143          }
144        }
145        public String getDisplay() {
146          switch (this) {
147            case DRAFT: return "Draft";
148            case ACTIVE: return "Active";
149            case ONHOLD: return "On Hold";
150            case REVOKED: return "Revoked";
151            case COMPLETED: return "Completed";
152            case ENTEREDINERROR: return "Entered in Error";
153            case UNKNOWN: return "Unknown";
154            default: return "?";
155          }
156        }
157    }
158
159  public static class NutritionOrderStatusEnumFactory implements EnumFactory<NutritionOrderStatus> {
160    public NutritionOrderStatus fromCode(String codeString) throws IllegalArgumentException {
161      if (codeString == null || "".equals(codeString))
162            if (codeString == null || "".equals(codeString))
163                return null;
164        if ("draft".equals(codeString))
165          return NutritionOrderStatus.DRAFT;
166        if ("active".equals(codeString))
167          return NutritionOrderStatus.ACTIVE;
168        if ("on-hold".equals(codeString))
169          return NutritionOrderStatus.ONHOLD;
170        if ("revoked".equals(codeString))
171          return NutritionOrderStatus.REVOKED;
172        if ("completed".equals(codeString))
173          return NutritionOrderStatus.COMPLETED;
174        if ("entered-in-error".equals(codeString))
175          return NutritionOrderStatus.ENTEREDINERROR;
176        if ("unknown".equals(codeString))
177          return NutritionOrderStatus.UNKNOWN;
178        throw new IllegalArgumentException("Unknown NutritionOrderStatus code '"+codeString+"'");
179        }
180        public Enumeration<NutritionOrderStatus> fromType(Base code) throws FHIRException {
181          if (code == null)
182            return null;
183          if (code.isEmpty())
184            return new Enumeration<NutritionOrderStatus>(this);
185          String codeString = ((PrimitiveType) code).asStringValue();
186          if (codeString == null || "".equals(codeString))
187            return null;
188        if ("draft".equals(codeString))
189          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.DRAFT);
190        if ("active".equals(codeString))
191          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ACTIVE);
192        if ("on-hold".equals(codeString))
193          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ONHOLD);
194        if ("revoked".equals(codeString))
195          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.REVOKED);
196        if ("completed".equals(codeString))
197          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.COMPLETED);
198        if ("entered-in-error".equals(codeString))
199          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ENTEREDINERROR);
200        if ("unknown".equals(codeString))
201          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.UNKNOWN);
202        throw new FHIRException("Unknown NutritionOrderStatus code '"+codeString+"'");
203        }
204    public String toCode(NutritionOrderStatus code) {
205      if (code == NutritionOrderStatus.DRAFT)
206        return "draft";
207      if (code == NutritionOrderStatus.ACTIVE)
208        return "active";
209      if (code == NutritionOrderStatus.ONHOLD)
210        return "on-hold";
211      if (code == NutritionOrderStatus.REVOKED)
212        return "revoked";
213      if (code == NutritionOrderStatus.COMPLETED)
214        return "completed";
215      if (code == NutritionOrderStatus.ENTEREDINERROR)
216        return "entered-in-error";
217      if (code == NutritionOrderStatus.UNKNOWN)
218        return "unknown";
219      return "?";
220      }
221    public String toSystem(NutritionOrderStatus code) {
222      return code.getSystem();
223      }
224    }
225
226    public enum NutritiionOrderIntent {
227        /**
228         * The request is a suggestion made by someone/something that does not have an intention to ensure it occurs and without providing an authorization to act.
229         */
230        PROPOSAL, 
231        /**
232         * The request represents an intention to ensure something occurs without providing an authorization for others to act.
233         */
234        PLAN, 
235        /**
236         * The request represents a legally binding instruction authored by a Patient or RelatedPerson.
237         */
238        DIRECTIVE, 
239        /**
240         * The request represents a request/demand and authorization for action by a Practitioner.
241         */
242        ORDER, 
243        /**
244         * The request represents an original authorization for action.
245         */
246        ORIGINALORDER, 
247        /**
248         * The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization.
249         */
250        REFLEXORDER, 
251        /**
252         * The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order.
253         */
254        FILLERORDER, 
255        /**
256         * An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.
257         */
258        INSTANCEORDER, 
259        /**
260         * The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.  Refer to [[[RequestGroup]]] for additional information on how this status is used.
261         */
262        OPTION, 
263        /**
264         * added to help the parsers with the generic types
265         */
266        NULL;
267        public static NutritiionOrderIntent fromCode(String codeString) throws FHIRException {
268            if (codeString == null || "".equals(codeString))
269                return null;
270        if ("proposal".equals(codeString))
271          return PROPOSAL;
272        if ("plan".equals(codeString))
273          return PLAN;
274        if ("directive".equals(codeString))
275          return DIRECTIVE;
276        if ("order".equals(codeString))
277          return ORDER;
278        if ("original-order".equals(codeString))
279          return ORIGINALORDER;
280        if ("reflex-order".equals(codeString))
281          return REFLEXORDER;
282        if ("filler-order".equals(codeString))
283          return FILLERORDER;
284        if ("instance-order".equals(codeString))
285          return INSTANCEORDER;
286        if ("option".equals(codeString))
287          return OPTION;
288        if (Configuration.isAcceptInvalidEnums())
289          return null;
290        else
291          throw new FHIRException("Unknown NutritiionOrderIntent code '"+codeString+"'");
292        }
293        public String toCode() {
294          switch (this) {
295            case PROPOSAL: return "proposal";
296            case PLAN: return "plan";
297            case DIRECTIVE: return "directive";
298            case ORDER: return "order";
299            case ORIGINALORDER: return "original-order";
300            case REFLEXORDER: return "reflex-order";
301            case FILLERORDER: return "filler-order";
302            case INSTANCEORDER: return "instance-order";
303            case OPTION: return "option";
304            default: return "?";
305          }
306        }
307        public String getSystem() {
308          switch (this) {
309            case PROPOSAL: return "http://hl7.org/fhir/request-intent";
310            case PLAN: return "http://hl7.org/fhir/request-intent";
311            case DIRECTIVE: return "http://hl7.org/fhir/request-intent";
312            case ORDER: return "http://hl7.org/fhir/request-intent";
313            case ORIGINALORDER: return "http://hl7.org/fhir/request-intent";
314            case REFLEXORDER: return "http://hl7.org/fhir/request-intent";
315            case FILLERORDER: return "http://hl7.org/fhir/request-intent";
316            case INSTANCEORDER: return "http://hl7.org/fhir/request-intent";
317            case OPTION: return "http://hl7.org/fhir/request-intent";
318            default: return "?";
319          }
320        }
321        public String getDefinition() {
322          switch (this) {
323            case PROPOSAL: return "The request is a suggestion made by someone/something that does not have an intention to ensure it occurs and without providing an authorization to act.";
324            case PLAN: return "The request represents an intention to ensure something occurs without providing an authorization for others to act.";
325            case DIRECTIVE: return "The request represents a legally binding instruction authored by a Patient or RelatedPerson.";
326            case ORDER: return "The request represents a request/demand and authorization for action by a Practitioner.";
327            case ORIGINALORDER: return "The request represents an original authorization for action.";
328            case REFLEXORDER: return "The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization.";
329            case FILLERORDER: return "The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order.";
330            case INSTANCEORDER: return "An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.";
331            case OPTION: return "The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.  Refer to [[[RequestGroup]]] for additional information on how this status is used.";
332            default: return "?";
333          }
334        }
335        public String getDisplay() {
336          switch (this) {
337            case PROPOSAL: return "Proposal";
338            case PLAN: return "Plan";
339            case DIRECTIVE: return "Directive";
340            case ORDER: return "Order";
341            case ORIGINALORDER: return "Original Order";
342            case REFLEXORDER: return "Reflex Order";
343            case FILLERORDER: return "Filler Order";
344            case INSTANCEORDER: return "Instance Order";
345            case OPTION: return "Option";
346            default: return "?";
347          }
348        }
349    }
350
351  public static class NutritiionOrderIntentEnumFactory implements EnumFactory<NutritiionOrderIntent> {
352    public NutritiionOrderIntent fromCode(String codeString) throws IllegalArgumentException {
353      if (codeString == null || "".equals(codeString))
354            if (codeString == null || "".equals(codeString))
355                return null;
356        if ("proposal".equals(codeString))
357          return NutritiionOrderIntent.PROPOSAL;
358        if ("plan".equals(codeString))
359          return NutritiionOrderIntent.PLAN;
360        if ("directive".equals(codeString))
361          return NutritiionOrderIntent.DIRECTIVE;
362        if ("order".equals(codeString))
363          return NutritiionOrderIntent.ORDER;
364        if ("original-order".equals(codeString))
365          return NutritiionOrderIntent.ORIGINALORDER;
366        if ("reflex-order".equals(codeString))
367          return NutritiionOrderIntent.REFLEXORDER;
368        if ("filler-order".equals(codeString))
369          return NutritiionOrderIntent.FILLERORDER;
370        if ("instance-order".equals(codeString))
371          return NutritiionOrderIntent.INSTANCEORDER;
372        if ("option".equals(codeString))
373          return NutritiionOrderIntent.OPTION;
374        throw new IllegalArgumentException("Unknown NutritiionOrderIntent code '"+codeString+"'");
375        }
376        public Enumeration<NutritiionOrderIntent> fromType(Base code) throws FHIRException {
377          if (code == null)
378            return null;
379          if (code.isEmpty())
380            return new Enumeration<NutritiionOrderIntent>(this);
381          String codeString = ((PrimitiveType) code).asStringValue();
382          if (codeString == null || "".equals(codeString))
383            return null;
384        if ("proposal".equals(codeString))
385          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.PROPOSAL);
386        if ("plan".equals(codeString))
387          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.PLAN);
388        if ("directive".equals(codeString))
389          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.DIRECTIVE);
390        if ("order".equals(codeString))
391          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.ORDER);
392        if ("original-order".equals(codeString))
393          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.ORIGINALORDER);
394        if ("reflex-order".equals(codeString))
395          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.REFLEXORDER);
396        if ("filler-order".equals(codeString))
397          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.FILLERORDER);
398        if ("instance-order".equals(codeString))
399          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.INSTANCEORDER);
400        if ("option".equals(codeString))
401          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.OPTION);
402        throw new FHIRException("Unknown NutritiionOrderIntent code '"+codeString+"'");
403        }
404    public String toCode(NutritiionOrderIntent code) {
405      if (code == NutritiionOrderIntent.PROPOSAL)
406        return "proposal";
407      if (code == NutritiionOrderIntent.PLAN)
408        return "plan";
409      if (code == NutritiionOrderIntent.DIRECTIVE)
410        return "directive";
411      if (code == NutritiionOrderIntent.ORDER)
412        return "order";
413      if (code == NutritiionOrderIntent.ORIGINALORDER)
414        return "original-order";
415      if (code == NutritiionOrderIntent.REFLEXORDER)
416        return "reflex-order";
417      if (code == NutritiionOrderIntent.FILLERORDER)
418        return "filler-order";
419      if (code == NutritiionOrderIntent.INSTANCEORDER)
420        return "instance-order";
421      if (code == NutritiionOrderIntent.OPTION)
422        return "option";
423      return "?";
424      }
425    public String toSystem(NutritiionOrderIntent code) {
426      return code.getSystem();
427      }
428    }
429
430    @Block()
431    public static class NutritionOrderOralDietComponent extends BackboneElement implements IBaseBackboneElement {
432        /**
433         * The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.
434         */
435        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
436        @Description(shortDefinition="Type of oral diet or diet restrictions that describe what can be consumed orally", formalDefinition="The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet." )
437        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/diet-type")
438        protected List<CodeableConcept> type;
439
440        /**
441         * The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.
442         */
443        @Child(name = "schedule", type = {Timing.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
444        @Description(shortDefinition="Scheduled frequency of diet", formalDefinition="The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present." )
445        protected List<Timing> schedule;
446
447        /**
448         * Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.
449         */
450        @Child(name = "nutrient", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
451        @Description(shortDefinition="Required  nutrient modifications", formalDefinition="Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet." )
452        protected List<NutritionOrderOralDietNutrientComponent> nutrient;
453
454        /**
455         * Class that describes any texture modifications required for the patient to safely consume various types of solid foods.
456         */
457        @Child(name = "texture", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
458        @Description(shortDefinition="Required  texture modifications", formalDefinition="Class that describes any texture modifications required for the patient to safely consume various types of solid foods." )
459        protected List<NutritionOrderOralDietTextureComponent> texture;
460
461        /**
462         * The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.
463         */
464        @Child(name = "fluidConsistencyType", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
465        @Description(shortDefinition="The required consistency of fluids and liquids provided to the patient", formalDefinition="The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient." )
466        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consistency-type")
467        protected List<CodeableConcept> fluidConsistencyType;
468
469        /**
470         * Free text or additional instructions or information pertaining to the oral diet.
471         */
472        @Child(name = "instruction", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
473        @Description(shortDefinition="Instructions or additional information about the oral diet", formalDefinition="Free text or additional instructions or information pertaining to the oral diet." )
474        protected StringType instruction;
475
476        private static final long serialVersionUID = 973058412L;
477
478    /**
479     * Constructor
480     */
481      public NutritionOrderOralDietComponent() {
482        super();
483      }
484
485        /**
486         * @return {@link #type} (The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.)
487         */
488        public List<CodeableConcept> getType() { 
489          if (this.type == null)
490            this.type = new ArrayList<CodeableConcept>();
491          return this.type;
492        }
493
494        /**
495         * @return Returns a reference to <code>this</code> for easy method chaining
496         */
497        public NutritionOrderOralDietComponent setType(List<CodeableConcept> theType) { 
498          this.type = theType;
499          return this;
500        }
501
502        public boolean hasType() { 
503          if (this.type == null)
504            return false;
505          for (CodeableConcept item : this.type)
506            if (!item.isEmpty())
507              return true;
508          return false;
509        }
510
511        public CodeableConcept addType() { //3
512          CodeableConcept t = new CodeableConcept();
513          if (this.type == null)
514            this.type = new ArrayList<CodeableConcept>();
515          this.type.add(t);
516          return t;
517        }
518
519        public NutritionOrderOralDietComponent addType(CodeableConcept t) { //3
520          if (t == null)
521            return this;
522          if (this.type == null)
523            this.type = new ArrayList<CodeableConcept>();
524          this.type.add(t);
525          return this;
526        }
527
528        /**
529         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
530         */
531        public CodeableConcept getTypeFirstRep() { 
532          if (getType().isEmpty()) {
533            addType();
534          }
535          return getType().get(0);
536        }
537
538        /**
539         * @return {@link #schedule} (The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.)
540         */
541        public List<Timing> getSchedule() { 
542          if (this.schedule == null)
543            this.schedule = new ArrayList<Timing>();
544          return this.schedule;
545        }
546
547        /**
548         * @return Returns a reference to <code>this</code> for easy method chaining
549         */
550        public NutritionOrderOralDietComponent setSchedule(List<Timing> theSchedule) { 
551          this.schedule = theSchedule;
552          return this;
553        }
554
555        public boolean hasSchedule() { 
556          if (this.schedule == null)
557            return false;
558          for (Timing item : this.schedule)
559            if (!item.isEmpty())
560              return true;
561          return false;
562        }
563
564        public Timing addSchedule() { //3
565          Timing t = new Timing();
566          if (this.schedule == null)
567            this.schedule = new ArrayList<Timing>();
568          this.schedule.add(t);
569          return t;
570        }
571
572        public NutritionOrderOralDietComponent addSchedule(Timing t) { //3
573          if (t == null)
574            return this;
575          if (this.schedule == null)
576            this.schedule = new ArrayList<Timing>();
577          this.schedule.add(t);
578          return this;
579        }
580
581        /**
582         * @return The first repetition of repeating field {@link #schedule}, creating it if it does not already exist
583         */
584        public Timing getScheduleFirstRep() { 
585          if (getSchedule().isEmpty()) {
586            addSchedule();
587          }
588          return getSchedule().get(0);
589        }
590
591        /**
592         * @return {@link #nutrient} (Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.)
593         */
594        public List<NutritionOrderOralDietNutrientComponent> getNutrient() { 
595          if (this.nutrient == null)
596            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
597          return this.nutrient;
598        }
599
600        /**
601         * @return Returns a reference to <code>this</code> for easy method chaining
602         */
603        public NutritionOrderOralDietComponent setNutrient(List<NutritionOrderOralDietNutrientComponent> theNutrient) { 
604          this.nutrient = theNutrient;
605          return this;
606        }
607
608        public boolean hasNutrient() { 
609          if (this.nutrient == null)
610            return false;
611          for (NutritionOrderOralDietNutrientComponent item : this.nutrient)
612            if (!item.isEmpty())
613              return true;
614          return false;
615        }
616
617        public NutritionOrderOralDietNutrientComponent addNutrient() { //3
618          NutritionOrderOralDietNutrientComponent t = new NutritionOrderOralDietNutrientComponent();
619          if (this.nutrient == null)
620            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
621          this.nutrient.add(t);
622          return t;
623        }
624
625        public NutritionOrderOralDietComponent addNutrient(NutritionOrderOralDietNutrientComponent t) { //3
626          if (t == null)
627            return this;
628          if (this.nutrient == null)
629            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
630          this.nutrient.add(t);
631          return this;
632        }
633
634        /**
635         * @return The first repetition of repeating field {@link #nutrient}, creating it if it does not already exist
636         */
637        public NutritionOrderOralDietNutrientComponent getNutrientFirstRep() { 
638          if (getNutrient().isEmpty()) {
639            addNutrient();
640          }
641          return getNutrient().get(0);
642        }
643
644        /**
645         * @return {@link #texture} (Class that describes any texture modifications required for the patient to safely consume various types of solid foods.)
646         */
647        public List<NutritionOrderOralDietTextureComponent> getTexture() { 
648          if (this.texture == null)
649            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
650          return this.texture;
651        }
652
653        /**
654         * @return Returns a reference to <code>this</code> for easy method chaining
655         */
656        public NutritionOrderOralDietComponent setTexture(List<NutritionOrderOralDietTextureComponent> theTexture) { 
657          this.texture = theTexture;
658          return this;
659        }
660
661        public boolean hasTexture() { 
662          if (this.texture == null)
663            return false;
664          for (NutritionOrderOralDietTextureComponent item : this.texture)
665            if (!item.isEmpty())
666              return true;
667          return false;
668        }
669
670        public NutritionOrderOralDietTextureComponent addTexture() { //3
671          NutritionOrderOralDietTextureComponent t = new NutritionOrderOralDietTextureComponent();
672          if (this.texture == null)
673            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
674          this.texture.add(t);
675          return t;
676        }
677
678        public NutritionOrderOralDietComponent addTexture(NutritionOrderOralDietTextureComponent t) { //3
679          if (t == null)
680            return this;
681          if (this.texture == null)
682            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
683          this.texture.add(t);
684          return this;
685        }
686
687        /**
688         * @return The first repetition of repeating field {@link #texture}, creating it if it does not already exist
689         */
690        public NutritionOrderOralDietTextureComponent getTextureFirstRep() { 
691          if (getTexture().isEmpty()) {
692            addTexture();
693          }
694          return getTexture().get(0);
695        }
696
697        /**
698         * @return {@link #fluidConsistencyType} (The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.)
699         */
700        public List<CodeableConcept> getFluidConsistencyType() { 
701          if (this.fluidConsistencyType == null)
702            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
703          return this.fluidConsistencyType;
704        }
705
706        /**
707         * @return Returns a reference to <code>this</code> for easy method chaining
708         */
709        public NutritionOrderOralDietComponent setFluidConsistencyType(List<CodeableConcept> theFluidConsistencyType) { 
710          this.fluidConsistencyType = theFluidConsistencyType;
711          return this;
712        }
713
714        public boolean hasFluidConsistencyType() { 
715          if (this.fluidConsistencyType == null)
716            return false;
717          for (CodeableConcept item : this.fluidConsistencyType)
718            if (!item.isEmpty())
719              return true;
720          return false;
721        }
722
723        public CodeableConcept addFluidConsistencyType() { //3
724          CodeableConcept t = new CodeableConcept();
725          if (this.fluidConsistencyType == null)
726            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
727          this.fluidConsistencyType.add(t);
728          return t;
729        }
730
731        public NutritionOrderOralDietComponent addFluidConsistencyType(CodeableConcept t) { //3
732          if (t == null)
733            return this;
734          if (this.fluidConsistencyType == null)
735            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
736          this.fluidConsistencyType.add(t);
737          return this;
738        }
739
740        /**
741         * @return The first repetition of repeating field {@link #fluidConsistencyType}, creating it if it does not already exist
742         */
743        public CodeableConcept getFluidConsistencyTypeFirstRep() { 
744          if (getFluidConsistencyType().isEmpty()) {
745            addFluidConsistencyType();
746          }
747          return getFluidConsistencyType().get(0);
748        }
749
750        /**
751         * @return {@link #instruction} (Free text or additional instructions or information pertaining to the oral diet.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
752         */
753        public StringType getInstructionElement() { 
754          if (this.instruction == null)
755            if (Configuration.errorOnAutoCreate())
756              throw new Error("Attempt to auto-create NutritionOrderOralDietComponent.instruction");
757            else if (Configuration.doAutoCreate())
758              this.instruction = new StringType(); // bb
759          return this.instruction;
760        }
761
762        public boolean hasInstructionElement() { 
763          return this.instruction != null && !this.instruction.isEmpty();
764        }
765
766        public boolean hasInstruction() { 
767          return this.instruction != null && !this.instruction.isEmpty();
768        }
769
770        /**
771         * @param value {@link #instruction} (Free text or additional instructions or information pertaining to the oral diet.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
772         */
773        public NutritionOrderOralDietComponent setInstructionElement(StringType value) { 
774          this.instruction = value;
775          return this;
776        }
777
778        /**
779         * @return Free text or additional instructions or information pertaining to the oral diet.
780         */
781        public String getInstruction() { 
782          return this.instruction == null ? null : this.instruction.getValue();
783        }
784
785        /**
786         * @param value Free text or additional instructions or information pertaining to the oral diet.
787         */
788        public NutritionOrderOralDietComponent setInstruction(String value) { 
789          if (Utilities.noString(value))
790            this.instruction = null;
791          else {
792            if (this.instruction == null)
793              this.instruction = new StringType();
794            this.instruction.setValue(value);
795          }
796          return this;
797        }
798
799        protected void listChildren(List<Property> children) {
800          super.listChildren(children);
801          children.add(new Property("type", "CodeableConcept", "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.", 0, java.lang.Integer.MAX_VALUE, type));
802          children.add(new Property("schedule", "Timing", "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule));
803          children.add(new Property("nutrient", "", "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.", 0, java.lang.Integer.MAX_VALUE, nutrient));
804          children.add(new Property("texture", "", "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.", 0, java.lang.Integer.MAX_VALUE, texture));
805          children.add(new Property("fluidConsistencyType", "CodeableConcept", "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.", 0, java.lang.Integer.MAX_VALUE, fluidConsistencyType));
806          children.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral diet.", 0, 1, instruction));
807        }
808
809        @Override
810        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
811          switch (_hash) {
812          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.", 0, java.lang.Integer.MAX_VALUE, type);
813          case -697920873: /*schedule*/  return new Property("schedule", "Timing", "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule);
814          case -1671151641: /*nutrient*/  return new Property("nutrient", "", "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.", 0, java.lang.Integer.MAX_VALUE, nutrient);
815          case -1417816805: /*texture*/  return new Property("texture", "", "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.", 0, java.lang.Integer.MAX_VALUE, texture);
816          case -525105592: /*fluidConsistencyType*/  return new Property("fluidConsistencyType", "CodeableConcept", "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.", 0, java.lang.Integer.MAX_VALUE, fluidConsistencyType);
817          case 301526158: /*instruction*/  return new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral diet.", 0, 1, instruction);
818          default: return super.getNamedProperty(_hash, _name, _checkValid);
819          }
820
821        }
822
823      @Override
824      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
825        switch (hash) {
826        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
827        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
828        case -1671151641: /*nutrient*/ return this.nutrient == null ? new Base[0] : this.nutrient.toArray(new Base[this.nutrient.size()]); // NutritionOrderOralDietNutrientComponent
829        case -1417816805: /*texture*/ return this.texture == null ? new Base[0] : this.texture.toArray(new Base[this.texture.size()]); // NutritionOrderOralDietTextureComponent
830        case -525105592: /*fluidConsistencyType*/ return this.fluidConsistencyType == null ? new Base[0] : this.fluidConsistencyType.toArray(new Base[this.fluidConsistencyType.size()]); // CodeableConcept
831        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
832        default: return super.getProperty(hash, name, checkValid);
833        }
834
835      }
836
837      @Override
838      public Base setProperty(int hash, String name, Base value) throws FHIRException {
839        switch (hash) {
840        case 3575610: // type
841          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
842          return value;
843        case -697920873: // schedule
844          this.getSchedule().add(castToTiming(value)); // Timing
845          return value;
846        case -1671151641: // nutrient
847          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value); // NutritionOrderOralDietNutrientComponent
848          return value;
849        case -1417816805: // texture
850          this.getTexture().add((NutritionOrderOralDietTextureComponent) value); // NutritionOrderOralDietTextureComponent
851          return value;
852        case -525105592: // fluidConsistencyType
853          this.getFluidConsistencyType().add(castToCodeableConcept(value)); // CodeableConcept
854          return value;
855        case 301526158: // instruction
856          this.instruction = castToString(value); // StringType
857          return value;
858        default: return super.setProperty(hash, name, value);
859        }
860
861      }
862
863      @Override
864      public Base setProperty(String name, Base value) throws FHIRException {
865        if (name.equals("type")) {
866          this.getType().add(castToCodeableConcept(value));
867        } else if (name.equals("schedule")) {
868          this.getSchedule().add(castToTiming(value));
869        } else if (name.equals("nutrient")) {
870          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value);
871        } else if (name.equals("texture")) {
872          this.getTexture().add((NutritionOrderOralDietTextureComponent) value);
873        } else if (name.equals("fluidConsistencyType")) {
874          this.getFluidConsistencyType().add(castToCodeableConcept(value));
875        } else if (name.equals("instruction")) {
876          this.instruction = castToString(value); // StringType
877        } else
878          return super.setProperty(name, value);
879        return value;
880      }
881
882      @Override
883      public Base makeProperty(int hash, String name) throws FHIRException {
884        switch (hash) {
885        case 3575610:  return addType(); 
886        case -697920873:  return addSchedule(); 
887        case -1671151641:  return addNutrient(); 
888        case -1417816805:  return addTexture(); 
889        case -525105592:  return addFluidConsistencyType(); 
890        case 301526158:  return getInstructionElement();
891        default: return super.makeProperty(hash, name);
892        }
893
894      }
895
896      @Override
897      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
898        switch (hash) {
899        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
900        case -697920873: /*schedule*/ return new String[] {"Timing"};
901        case -1671151641: /*nutrient*/ return new String[] {};
902        case -1417816805: /*texture*/ return new String[] {};
903        case -525105592: /*fluidConsistencyType*/ return new String[] {"CodeableConcept"};
904        case 301526158: /*instruction*/ return new String[] {"string"};
905        default: return super.getTypesForProperty(hash, name);
906        }
907
908      }
909
910      @Override
911      public Base addChild(String name) throws FHIRException {
912        if (name.equals("type")) {
913          return addType();
914        }
915        else if (name.equals("schedule")) {
916          return addSchedule();
917        }
918        else if (name.equals("nutrient")) {
919          return addNutrient();
920        }
921        else if (name.equals("texture")) {
922          return addTexture();
923        }
924        else if (name.equals("fluidConsistencyType")) {
925          return addFluidConsistencyType();
926        }
927        else if (name.equals("instruction")) {
928          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instruction");
929        }
930        else
931          return super.addChild(name);
932      }
933
934      public NutritionOrderOralDietComponent copy() {
935        NutritionOrderOralDietComponent dst = new NutritionOrderOralDietComponent();
936        copyValues(dst);
937        return dst;
938      }
939
940      public void copyValues(NutritionOrderOralDietComponent dst) {
941        super.copyValues(dst);
942        if (type != null) {
943          dst.type = new ArrayList<CodeableConcept>();
944          for (CodeableConcept i : type)
945            dst.type.add(i.copy());
946        };
947        if (schedule != null) {
948          dst.schedule = new ArrayList<Timing>();
949          for (Timing i : schedule)
950            dst.schedule.add(i.copy());
951        };
952        if (nutrient != null) {
953          dst.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
954          for (NutritionOrderOralDietNutrientComponent i : nutrient)
955            dst.nutrient.add(i.copy());
956        };
957        if (texture != null) {
958          dst.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
959          for (NutritionOrderOralDietTextureComponent i : texture)
960            dst.texture.add(i.copy());
961        };
962        if (fluidConsistencyType != null) {
963          dst.fluidConsistencyType = new ArrayList<CodeableConcept>();
964          for (CodeableConcept i : fluidConsistencyType)
965            dst.fluidConsistencyType.add(i.copy());
966        };
967        dst.instruction = instruction == null ? null : instruction.copy();
968      }
969
970      @Override
971      public boolean equalsDeep(Base other_) {
972        if (!super.equalsDeep(other_))
973          return false;
974        if (!(other_ instanceof NutritionOrderOralDietComponent))
975          return false;
976        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other_;
977        return compareDeep(type, o.type, true) && compareDeep(schedule, o.schedule, true) && compareDeep(nutrient, o.nutrient, true)
978           && compareDeep(texture, o.texture, true) && compareDeep(fluidConsistencyType, o.fluidConsistencyType, true)
979           && compareDeep(instruction, o.instruction, true);
980      }
981
982      @Override
983      public boolean equalsShallow(Base other_) {
984        if (!super.equalsShallow(other_))
985          return false;
986        if (!(other_ instanceof NutritionOrderOralDietComponent))
987          return false;
988        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other_;
989        return compareValues(instruction, o.instruction, true);
990      }
991
992      public boolean isEmpty() {
993        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, schedule, nutrient
994          , texture, fluidConsistencyType, instruction);
995      }
996
997  public String fhirType() {
998    return "NutritionOrder.oralDiet";
999
1000  }
1001
1002  }
1003
1004    @Block()
1005    public static class NutritionOrderOralDietNutrientComponent extends BackboneElement implements IBaseBackboneElement {
1006        /**
1007         * The nutrient that is being modified such as carbohydrate or sodium.
1008         */
1009        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1010        @Description(shortDefinition="Type of nutrient that is being modified", formalDefinition="The nutrient that is being modified such as carbohydrate or sodium." )
1011        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/nutrient-code")
1012        protected CodeableConcept modifier;
1013
1014        /**
1015         * The quantity of the specified nutrient to include in diet.
1016         */
1017        @Child(name = "amount", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
1018        @Description(shortDefinition="Quantity of the specified nutrient", formalDefinition="The quantity of the specified nutrient to include in diet." )
1019        protected Quantity amount;
1020
1021        private static final long serialVersionUID = 1042462093L;
1022
1023    /**
1024     * Constructor
1025     */
1026      public NutritionOrderOralDietNutrientComponent() {
1027        super();
1028      }
1029
1030        /**
1031         * @return {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
1032         */
1033        public CodeableConcept getModifier() { 
1034          if (this.modifier == null)
1035            if (Configuration.errorOnAutoCreate())
1036              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.modifier");
1037            else if (Configuration.doAutoCreate())
1038              this.modifier = new CodeableConcept(); // cc
1039          return this.modifier;
1040        }
1041
1042        public boolean hasModifier() { 
1043          return this.modifier != null && !this.modifier.isEmpty();
1044        }
1045
1046        /**
1047         * @param value {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
1048         */
1049        public NutritionOrderOralDietNutrientComponent setModifier(CodeableConcept value) { 
1050          this.modifier = value;
1051          return this;
1052        }
1053
1054        /**
1055         * @return {@link #amount} (The quantity of the specified nutrient to include in diet.)
1056         */
1057        public Quantity getAmount() { 
1058          if (this.amount == null)
1059            if (Configuration.errorOnAutoCreate())
1060              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.amount");
1061            else if (Configuration.doAutoCreate())
1062              this.amount = new Quantity(); // cc
1063          return this.amount;
1064        }
1065
1066        public boolean hasAmount() { 
1067          return this.amount != null && !this.amount.isEmpty();
1068        }
1069
1070        /**
1071         * @param value {@link #amount} (The quantity of the specified nutrient to include in diet.)
1072         */
1073        public NutritionOrderOralDietNutrientComponent setAmount(Quantity value) { 
1074          this.amount = value;
1075          return this;
1076        }
1077
1078        protected void listChildren(List<Property> children) {
1079          super.listChildren(children);
1080          children.add(new Property("modifier", "CodeableConcept", "The nutrient that is being modified such as carbohydrate or sodium.", 0, 1, modifier));
1081          children.add(new Property("amount", "SimpleQuantity", "The quantity of the specified nutrient to include in diet.", 0, 1, amount));
1082        }
1083
1084        @Override
1085        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1086          switch (_hash) {
1087          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "The nutrient that is being modified such as carbohydrate or sodium.", 0, 1, modifier);
1088          case -1413853096: /*amount*/  return new Property("amount", "SimpleQuantity", "The quantity of the specified nutrient to include in diet.", 0, 1, amount);
1089          default: return super.getNamedProperty(_hash, _name, _checkValid);
1090          }
1091
1092        }
1093
1094      @Override
1095      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1096        switch (hash) {
1097        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
1098        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Quantity
1099        default: return super.getProperty(hash, name, checkValid);
1100        }
1101
1102      }
1103
1104      @Override
1105      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1106        switch (hash) {
1107        case -615513385: // modifier
1108          this.modifier = castToCodeableConcept(value); // CodeableConcept
1109          return value;
1110        case -1413853096: // amount
1111          this.amount = castToQuantity(value); // Quantity
1112          return value;
1113        default: return super.setProperty(hash, name, value);
1114        }
1115
1116      }
1117
1118      @Override
1119      public Base setProperty(String name, Base value) throws FHIRException {
1120        if (name.equals("modifier")) {
1121          this.modifier = castToCodeableConcept(value); // CodeableConcept
1122        } else if (name.equals("amount")) {
1123          this.amount = castToQuantity(value); // Quantity
1124        } else
1125          return super.setProperty(name, value);
1126        return value;
1127      }
1128
1129      @Override
1130      public Base makeProperty(int hash, String name) throws FHIRException {
1131        switch (hash) {
1132        case -615513385:  return getModifier(); 
1133        case -1413853096:  return getAmount(); 
1134        default: return super.makeProperty(hash, name);
1135        }
1136
1137      }
1138
1139      @Override
1140      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1141        switch (hash) {
1142        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
1143        case -1413853096: /*amount*/ return new String[] {"SimpleQuantity"};
1144        default: return super.getTypesForProperty(hash, name);
1145        }
1146
1147      }
1148
1149      @Override
1150      public Base addChild(String name) throws FHIRException {
1151        if (name.equals("modifier")) {
1152          this.modifier = new CodeableConcept();
1153          return this.modifier;
1154        }
1155        else if (name.equals("amount")) {
1156          this.amount = new Quantity();
1157          return this.amount;
1158        }
1159        else
1160          return super.addChild(name);
1161      }
1162
1163      public NutritionOrderOralDietNutrientComponent copy() {
1164        NutritionOrderOralDietNutrientComponent dst = new NutritionOrderOralDietNutrientComponent();
1165        copyValues(dst);
1166        return dst;
1167      }
1168
1169      public void copyValues(NutritionOrderOralDietNutrientComponent dst) {
1170        super.copyValues(dst);
1171        dst.modifier = modifier == null ? null : modifier.copy();
1172        dst.amount = amount == null ? null : amount.copy();
1173      }
1174
1175      @Override
1176      public boolean equalsDeep(Base other_) {
1177        if (!super.equalsDeep(other_))
1178          return false;
1179        if (!(other_ instanceof NutritionOrderOralDietNutrientComponent))
1180          return false;
1181        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other_;
1182        return compareDeep(modifier, o.modifier, true) && compareDeep(amount, o.amount, true);
1183      }
1184
1185      @Override
1186      public boolean equalsShallow(Base other_) {
1187        if (!super.equalsShallow(other_))
1188          return false;
1189        if (!(other_ instanceof NutritionOrderOralDietNutrientComponent))
1190          return false;
1191        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other_;
1192        return true;
1193      }
1194
1195      public boolean isEmpty() {
1196        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifier, amount);
1197      }
1198
1199  public String fhirType() {
1200    return "NutritionOrder.oralDiet.nutrient";
1201
1202  }
1203
1204  }
1205
1206    @Block()
1207    public static class NutritionOrderOralDietTextureComponent extends BackboneElement implements IBaseBackboneElement {
1208        /**
1209         * Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.
1210         */
1211        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1212        @Description(shortDefinition="Code to indicate how to alter the texture of the foods, e.g. pureed", formalDefinition="Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed." )
1213        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/texture-code")
1214        protected CodeableConcept modifier;
1215
1216        /**
1217         * The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.
1218         */
1219        @Child(name = "foodType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1220        @Description(shortDefinition="Concepts that are used to identify an entity that is ingested for nutritional purposes", formalDefinition="The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types." )
1221        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/modified-foodtype")
1222        protected CodeableConcept foodType;
1223
1224        private static final long serialVersionUID = -56402817L;
1225
1226    /**
1227     * Constructor
1228     */
1229      public NutritionOrderOralDietTextureComponent() {
1230        super();
1231      }
1232
1233        /**
1234         * @return {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
1235         */
1236        public CodeableConcept getModifier() { 
1237          if (this.modifier == null)
1238            if (Configuration.errorOnAutoCreate())
1239              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.modifier");
1240            else if (Configuration.doAutoCreate())
1241              this.modifier = new CodeableConcept(); // cc
1242          return this.modifier;
1243        }
1244
1245        public boolean hasModifier() { 
1246          return this.modifier != null && !this.modifier.isEmpty();
1247        }
1248
1249        /**
1250         * @param value {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
1251         */
1252        public NutritionOrderOralDietTextureComponent setModifier(CodeableConcept value) { 
1253          this.modifier = value;
1254          return this;
1255        }
1256
1257        /**
1258         * @return {@link #foodType} (The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.)
1259         */
1260        public CodeableConcept getFoodType() { 
1261          if (this.foodType == null)
1262            if (Configuration.errorOnAutoCreate())
1263              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.foodType");
1264            else if (Configuration.doAutoCreate())
1265              this.foodType = new CodeableConcept(); // cc
1266          return this.foodType;
1267        }
1268
1269        public boolean hasFoodType() { 
1270          return this.foodType != null && !this.foodType.isEmpty();
1271        }
1272
1273        /**
1274         * @param value {@link #foodType} (The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.)
1275         */
1276        public NutritionOrderOralDietTextureComponent setFoodType(CodeableConcept value) { 
1277          this.foodType = value;
1278          return this;
1279        }
1280
1281        protected void listChildren(List<Property> children) {
1282          super.listChildren(children);
1283          children.add(new Property("modifier", "CodeableConcept", "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.", 0, 1, modifier));
1284          children.add(new Property("foodType", "CodeableConcept", "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.", 0, 1, foodType));
1285        }
1286
1287        @Override
1288        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1289          switch (_hash) {
1290          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.", 0, 1, modifier);
1291          case 379498680: /*foodType*/  return new Property("foodType", "CodeableConcept", "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.", 0, 1, foodType);
1292          default: return super.getNamedProperty(_hash, _name, _checkValid);
1293          }
1294
1295        }
1296
1297      @Override
1298      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1299        switch (hash) {
1300        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
1301        case 379498680: /*foodType*/ return this.foodType == null ? new Base[0] : new Base[] {this.foodType}; // CodeableConcept
1302        default: return super.getProperty(hash, name, checkValid);
1303        }
1304
1305      }
1306
1307      @Override
1308      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1309        switch (hash) {
1310        case -615513385: // modifier
1311          this.modifier = castToCodeableConcept(value); // CodeableConcept
1312          return value;
1313        case 379498680: // foodType
1314          this.foodType = castToCodeableConcept(value); // CodeableConcept
1315          return value;
1316        default: return super.setProperty(hash, name, value);
1317        }
1318
1319      }
1320
1321      @Override
1322      public Base setProperty(String name, Base value) throws FHIRException {
1323        if (name.equals("modifier")) {
1324          this.modifier = castToCodeableConcept(value); // CodeableConcept
1325        } else if (name.equals("foodType")) {
1326          this.foodType = castToCodeableConcept(value); // CodeableConcept
1327        } else
1328          return super.setProperty(name, value);
1329        return value;
1330      }
1331
1332      @Override
1333      public Base makeProperty(int hash, String name) throws FHIRException {
1334        switch (hash) {
1335        case -615513385:  return getModifier(); 
1336        case 379498680:  return getFoodType(); 
1337        default: return super.makeProperty(hash, name);
1338        }
1339
1340      }
1341
1342      @Override
1343      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1344        switch (hash) {
1345        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
1346        case 379498680: /*foodType*/ return new String[] {"CodeableConcept"};
1347        default: return super.getTypesForProperty(hash, name);
1348        }
1349
1350      }
1351
1352      @Override
1353      public Base addChild(String name) throws FHIRException {
1354        if (name.equals("modifier")) {
1355          this.modifier = new CodeableConcept();
1356          return this.modifier;
1357        }
1358        else if (name.equals("foodType")) {
1359          this.foodType = new CodeableConcept();
1360          return this.foodType;
1361        }
1362        else
1363          return super.addChild(name);
1364      }
1365
1366      public NutritionOrderOralDietTextureComponent copy() {
1367        NutritionOrderOralDietTextureComponent dst = new NutritionOrderOralDietTextureComponent();
1368        copyValues(dst);
1369        return dst;
1370      }
1371
1372      public void copyValues(NutritionOrderOralDietTextureComponent dst) {
1373        super.copyValues(dst);
1374        dst.modifier = modifier == null ? null : modifier.copy();
1375        dst.foodType = foodType == null ? null : foodType.copy();
1376      }
1377
1378      @Override
1379      public boolean equalsDeep(Base other_) {
1380        if (!super.equalsDeep(other_))
1381          return false;
1382        if (!(other_ instanceof NutritionOrderOralDietTextureComponent))
1383          return false;
1384        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other_;
1385        return compareDeep(modifier, o.modifier, true) && compareDeep(foodType, o.foodType, true);
1386      }
1387
1388      @Override
1389      public boolean equalsShallow(Base other_) {
1390        if (!super.equalsShallow(other_))
1391          return false;
1392        if (!(other_ instanceof NutritionOrderOralDietTextureComponent))
1393          return false;
1394        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other_;
1395        return true;
1396      }
1397
1398      public boolean isEmpty() {
1399        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifier, foodType);
1400      }
1401
1402  public String fhirType() {
1403    return "NutritionOrder.oralDiet.texture";
1404
1405  }
1406
1407  }
1408
1409    @Block()
1410    public static class NutritionOrderSupplementComponent extends BackboneElement implements IBaseBackboneElement {
1411        /**
1412         * The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.
1413         */
1414        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1415        @Description(shortDefinition="Type of supplement product requested", formalDefinition="The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement." )
1416        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supplement-type")
1417        protected CodeableConcept type;
1418
1419        /**
1420         * The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1421         */
1422        @Child(name = "productName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1423        @Description(shortDefinition="Product or brand name of the nutritional supplement", formalDefinition="The product or brand name of the nutritional supplement such as \"Acme Protein Shake\"." )
1424        protected StringType productName;
1425
1426        /**
1427         * The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.
1428         */
1429        @Child(name = "schedule", type = {Timing.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1430        @Description(shortDefinition="Scheduled frequency of supplement", formalDefinition="The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present." )
1431        protected List<Timing> schedule;
1432
1433        /**
1434         * The amount of the nutritional supplement to be given.
1435         */
1436        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
1437        @Description(shortDefinition="Amount of the nutritional supplement", formalDefinition="The amount of the nutritional supplement to be given." )
1438        protected Quantity quantity;
1439
1440        /**
1441         * Free text or additional instructions or information pertaining to the oral supplement.
1442         */
1443        @Child(name = "instruction", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1444        @Description(shortDefinition="Instructions or additional information about the oral supplement", formalDefinition="Free text or additional instructions or information pertaining to the oral supplement." )
1445        protected StringType instruction;
1446
1447        private static final long serialVersionUID = -37646618L;
1448
1449    /**
1450     * Constructor
1451     */
1452      public NutritionOrderSupplementComponent() {
1453        super();
1454      }
1455
1456        /**
1457         * @return {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1458         */
1459        public CodeableConcept getType() { 
1460          if (this.type == null)
1461            if (Configuration.errorOnAutoCreate())
1462              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.type");
1463            else if (Configuration.doAutoCreate())
1464              this.type = new CodeableConcept(); // cc
1465          return this.type;
1466        }
1467
1468        public boolean hasType() { 
1469          return this.type != null && !this.type.isEmpty();
1470        }
1471
1472        /**
1473         * @param value {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1474         */
1475        public NutritionOrderSupplementComponent setType(CodeableConcept value) { 
1476          this.type = value;
1477          return this;
1478        }
1479
1480        /**
1481         * @return {@link #productName} (The product or brand name of the nutritional supplement such as "Acme Protein Shake".). This is the underlying object with id, value and extensions. The accessor "getProductName" gives direct access to the value
1482         */
1483        public StringType getProductNameElement() { 
1484          if (this.productName == null)
1485            if (Configuration.errorOnAutoCreate())
1486              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.productName");
1487            else if (Configuration.doAutoCreate())
1488              this.productName = new StringType(); // bb
1489          return this.productName;
1490        }
1491
1492        public boolean hasProductNameElement() { 
1493          return this.productName != null && !this.productName.isEmpty();
1494        }
1495
1496        public boolean hasProductName() { 
1497          return this.productName != null && !this.productName.isEmpty();
1498        }
1499
1500        /**
1501         * @param value {@link #productName} (The product or brand name of the nutritional supplement such as "Acme Protein Shake".). This is the underlying object with id, value and extensions. The accessor "getProductName" gives direct access to the value
1502         */
1503        public NutritionOrderSupplementComponent setProductNameElement(StringType value) { 
1504          this.productName = value;
1505          return this;
1506        }
1507
1508        /**
1509         * @return The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1510         */
1511        public String getProductName() { 
1512          return this.productName == null ? null : this.productName.getValue();
1513        }
1514
1515        /**
1516         * @param value The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1517         */
1518        public NutritionOrderSupplementComponent setProductName(String value) { 
1519          if (Utilities.noString(value))
1520            this.productName = null;
1521          else {
1522            if (this.productName == null)
1523              this.productName = new StringType();
1524            this.productName.setValue(value);
1525          }
1526          return this;
1527        }
1528
1529        /**
1530         * @return {@link #schedule} (The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.)
1531         */
1532        public List<Timing> getSchedule() { 
1533          if (this.schedule == null)
1534            this.schedule = new ArrayList<Timing>();
1535          return this.schedule;
1536        }
1537
1538        /**
1539         * @return Returns a reference to <code>this</code> for easy method chaining
1540         */
1541        public NutritionOrderSupplementComponent setSchedule(List<Timing> theSchedule) { 
1542          this.schedule = theSchedule;
1543          return this;
1544        }
1545
1546        public boolean hasSchedule() { 
1547          if (this.schedule == null)
1548            return false;
1549          for (Timing item : this.schedule)
1550            if (!item.isEmpty())
1551              return true;
1552          return false;
1553        }
1554
1555        public Timing addSchedule() { //3
1556          Timing t = new Timing();
1557          if (this.schedule == null)
1558            this.schedule = new ArrayList<Timing>();
1559          this.schedule.add(t);
1560          return t;
1561        }
1562
1563        public NutritionOrderSupplementComponent addSchedule(Timing t) { //3
1564          if (t == null)
1565            return this;
1566          if (this.schedule == null)
1567            this.schedule = new ArrayList<Timing>();
1568          this.schedule.add(t);
1569          return this;
1570        }
1571
1572        /**
1573         * @return The first repetition of repeating field {@link #schedule}, creating it if it does not already exist
1574         */
1575        public Timing getScheduleFirstRep() { 
1576          if (getSchedule().isEmpty()) {
1577            addSchedule();
1578          }
1579          return getSchedule().get(0);
1580        }
1581
1582        /**
1583         * @return {@link #quantity} (The amount of the nutritional supplement to be given.)
1584         */
1585        public Quantity getQuantity() { 
1586          if (this.quantity == null)
1587            if (Configuration.errorOnAutoCreate())
1588              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.quantity");
1589            else if (Configuration.doAutoCreate())
1590              this.quantity = new Quantity(); // cc
1591          return this.quantity;
1592        }
1593
1594        public boolean hasQuantity() { 
1595          return this.quantity != null && !this.quantity.isEmpty();
1596        }
1597
1598        /**
1599         * @param value {@link #quantity} (The amount of the nutritional supplement to be given.)
1600         */
1601        public NutritionOrderSupplementComponent setQuantity(Quantity value) { 
1602          this.quantity = value;
1603          return this;
1604        }
1605
1606        /**
1607         * @return {@link #instruction} (Free text or additional instructions or information pertaining to the oral supplement.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
1608         */
1609        public StringType getInstructionElement() { 
1610          if (this.instruction == null)
1611            if (Configuration.errorOnAutoCreate())
1612              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.instruction");
1613            else if (Configuration.doAutoCreate())
1614              this.instruction = new StringType(); // bb
1615          return this.instruction;
1616        }
1617
1618        public boolean hasInstructionElement() { 
1619          return this.instruction != null && !this.instruction.isEmpty();
1620        }
1621
1622        public boolean hasInstruction() { 
1623          return this.instruction != null && !this.instruction.isEmpty();
1624        }
1625
1626        /**
1627         * @param value {@link #instruction} (Free text or additional instructions or information pertaining to the oral supplement.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
1628         */
1629        public NutritionOrderSupplementComponent setInstructionElement(StringType value) { 
1630          this.instruction = value;
1631          return this;
1632        }
1633
1634        /**
1635         * @return Free text or additional instructions or information pertaining to the oral supplement.
1636         */
1637        public String getInstruction() { 
1638          return this.instruction == null ? null : this.instruction.getValue();
1639        }
1640
1641        /**
1642         * @param value Free text or additional instructions or information pertaining to the oral supplement.
1643         */
1644        public NutritionOrderSupplementComponent setInstruction(String value) { 
1645          if (Utilities.noString(value))
1646            this.instruction = null;
1647          else {
1648            if (this.instruction == null)
1649              this.instruction = new StringType();
1650            this.instruction.setValue(value);
1651          }
1652          return this;
1653        }
1654
1655        protected void listChildren(List<Property> children) {
1656          super.listChildren(children);
1657          children.add(new Property("type", "CodeableConcept", "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.", 0, 1, type));
1658          children.add(new Property("productName", "string", "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, 1, productName));
1659          children.add(new Property("schedule", "Timing", "The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule));
1660          children.add(new Property("quantity", "SimpleQuantity", "The amount of the nutritional supplement to be given.", 0, 1, quantity));
1661          children.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral supplement.", 0, 1, instruction));
1662        }
1663
1664        @Override
1665        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1666          switch (_hash) {
1667          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.", 0, 1, type);
1668          case -1491817446: /*productName*/  return new Property("productName", "string", "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, 1, productName);
1669          case -697920873: /*schedule*/  return new Property("schedule", "Timing", "The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule);
1670          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The amount of the nutritional supplement to be given.", 0, 1, quantity);
1671          case 301526158: /*instruction*/  return new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral supplement.", 0, 1, instruction);
1672          default: return super.getNamedProperty(_hash, _name, _checkValid);
1673          }
1674
1675        }
1676
1677      @Override
1678      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1679        switch (hash) {
1680        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1681        case -1491817446: /*productName*/ return this.productName == null ? new Base[0] : new Base[] {this.productName}; // StringType
1682        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
1683        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
1684        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
1685        default: return super.getProperty(hash, name, checkValid);
1686        }
1687
1688      }
1689
1690      @Override
1691      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1692        switch (hash) {
1693        case 3575610: // type
1694          this.type = castToCodeableConcept(value); // CodeableConcept
1695          return value;
1696        case -1491817446: // productName
1697          this.productName = castToString(value); // StringType
1698          return value;
1699        case -697920873: // schedule
1700          this.getSchedule().add(castToTiming(value)); // Timing
1701          return value;
1702        case -1285004149: // quantity
1703          this.quantity = castToQuantity(value); // Quantity
1704          return value;
1705        case 301526158: // instruction
1706          this.instruction = castToString(value); // StringType
1707          return value;
1708        default: return super.setProperty(hash, name, value);
1709        }
1710
1711      }
1712
1713      @Override
1714      public Base setProperty(String name, Base value) throws FHIRException {
1715        if (name.equals("type")) {
1716          this.type = castToCodeableConcept(value); // CodeableConcept
1717        } else if (name.equals("productName")) {
1718          this.productName = castToString(value); // StringType
1719        } else if (name.equals("schedule")) {
1720          this.getSchedule().add(castToTiming(value));
1721        } else if (name.equals("quantity")) {
1722          this.quantity = castToQuantity(value); // Quantity
1723        } else if (name.equals("instruction")) {
1724          this.instruction = castToString(value); // StringType
1725        } else
1726          return super.setProperty(name, value);
1727        return value;
1728      }
1729
1730      @Override
1731      public Base makeProperty(int hash, String name) throws FHIRException {
1732        switch (hash) {
1733        case 3575610:  return getType(); 
1734        case -1491817446:  return getProductNameElement();
1735        case -697920873:  return addSchedule(); 
1736        case -1285004149:  return getQuantity(); 
1737        case 301526158:  return getInstructionElement();
1738        default: return super.makeProperty(hash, name);
1739        }
1740
1741      }
1742
1743      @Override
1744      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1745        switch (hash) {
1746        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1747        case -1491817446: /*productName*/ return new String[] {"string"};
1748        case -697920873: /*schedule*/ return new String[] {"Timing"};
1749        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
1750        case 301526158: /*instruction*/ return new String[] {"string"};
1751        default: return super.getTypesForProperty(hash, name);
1752        }
1753
1754      }
1755
1756      @Override
1757      public Base addChild(String name) throws FHIRException {
1758        if (name.equals("type")) {
1759          this.type = new CodeableConcept();
1760          return this.type;
1761        }
1762        else if (name.equals("productName")) {
1763          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.productName");
1764        }
1765        else if (name.equals("schedule")) {
1766          return addSchedule();
1767        }
1768        else if (name.equals("quantity")) {
1769          this.quantity = new Quantity();
1770          return this.quantity;
1771        }
1772        else if (name.equals("instruction")) {
1773          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instruction");
1774        }
1775        else
1776          return super.addChild(name);
1777      }
1778
1779      public NutritionOrderSupplementComponent copy() {
1780        NutritionOrderSupplementComponent dst = new NutritionOrderSupplementComponent();
1781        copyValues(dst);
1782        return dst;
1783      }
1784
1785      public void copyValues(NutritionOrderSupplementComponent dst) {
1786        super.copyValues(dst);
1787        dst.type = type == null ? null : type.copy();
1788        dst.productName = productName == null ? null : productName.copy();
1789        if (schedule != null) {
1790          dst.schedule = new ArrayList<Timing>();
1791          for (Timing i : schedule)
1792            dst.schedule.add(i.copy());
1793        };
1794        dst.quantity = quantity == null ? null : quantity.copy();
1795        dst.instruction = instruction == null ? null : instruction.copy();
1796      }
1797
1798      @Override
1799      public boolean equalsDeep(Base other_) {
1800        if (!super.equalsDeep(other_))
1801          return false;
1802        if (!(other_ instanceof NutritionOrderSupplementComponent))
1803          return false;
1804        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other_;
1805        return compareDeep(type, o.type, true) && compareDeep(productName, o.productName, true) && compareDeep(schedule, o.schedule, true)
1806           && compareDeep(quantity, o.quantity, true) && compareDeep(instruction, o.instruction, true);
1807      }
1808
1809      @Override
1810      public boolean equalsShallow(Base other_) {
1811        if (!super.equalsShallow(other_))
1812          return false;
1813        if (!(other_ instanceof NutritionOrderSupplementComponent))
1814          return false;
1815        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other_;
1816        return compareValues(productName, o.productName, true) && compareValues(instruction, o.instruction, true)
1817          ;
1818      }
1819
1820      public boolean isEmpty() {
1821        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, productName, schedule
1822          , quantity, instruction);
1823      }
1824
1825  public String fhirType() {
1826    return "NutritionOrder.supplement";
1827
1828  }
1829
1830  }
1831
1832    @Block()
1833    public static class NutritionOrderEnteralFormulaComponent extends BackboneElement implements IBaseBackboneElement {
1834        /**
1835         * The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.
1836         */
1837        @Child(name = "baseFormulaType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1838        @Description(shortDefinition="Type of enteral or infant formula", formalDefinition="The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula." )
1839        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/entformula-type")
1840        protected CodeableConcept baseFormulaType;
1841
1842        /**
1843         * The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1844         */
1845        @Child(name = "baseFormulaProductName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1846        @Description(shortDefinition="Product or brand name of the enteral or infant formula", formalDefinition="The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\"." )
1847        protected StringType baseFormulaProductName;
1848
1849        /**
1850         * Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.
1851         */
1852        @Child(name = "additiveType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1853        @Description(shortDefinition="Type of modular component to add to the feeding", formalDefinition="Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula." )
1854        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/entformula-additive")
1855        protected CodeableConcept additiveType;
1856
1857        /**
1858         * The product or brand name of the type of modular component to be added to the formula.
1859         */
1860        @Child(name = "additiveProductName", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1861        @Description(shortDefinition="Product or brand name of the modular additive", formalDefinition="The product or brand name of the type of modular component to be added to the formula." )
1862        protected StringType additiveProductName;
1863
1864        /**
1865         * The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.
1866         */
1867        @Child(name = "caloricDensity", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
1868        @Description(shortDefinition="Amount of energy per specified volume that is required", formalDefinition="The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL." )
1869        protected Quantity caloricDensity;
1870
1871        /**
1872         * The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.
1873         */
1874        @Child(name = "routeofAdministration", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1875        @Description(shortDefinition="How the formula should enter the patient's gastrointestinal tract", formalDefinition="The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube." )
1876        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/enteral-route")
1877        protected CodeableConcept routeofAdministration;
1878
1879        /**
1880         * Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.
1881         */
1882        @Child(name = "administration", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1883        @Description(shortDefinition="Formula feeding instruction as structured data", formalDefinition="Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours." )
1884        protected List<NutritionOrderEnteralFormulaAdministrationComponent> administration;
1885
1886        /**
1887         * The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.
1888         */
1889        @Child(name = "maxVolumeToDeliver", type = {Quantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
1890        @Description(shortDefinition="Upper limit on formula volume per unit of time", formalDefinition="The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours." )
1891        protected Quantity maxVolumeToDeliver;
1892
1893        /**
1894         * Free text formula administration, feeding instructions or additional instructions or information.
1895         */
1896        @Child(name = "administrationInstruction", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1897        @Description(shortDefinition="Formula feeding instructions expressed as text", formalDefinition="Free text formula administration, feeding instructions or additional instructions or information." )
1898        protected StringType administrationInstruction;
1899
1900        private static final long serialVersionUID = -124511395L;
1901
1902    /**
1903     * Constructor
1904     */
1905      public NutritionOrderEnteralFormulaComponent() {
1906        super();
1907      }
1908
1909        /**
1910         * @return {@link #baseFormulaType} (The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.)
1911         */
1912        public CodeableConcept getBaseFormulaType() { 
1913          if (this.baseFormulaType == null)
1914            if (Configuration.errorOnAutoCreate())
1915              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaType");
1916            else if (Configuration.doAutoCreate())
1917              this.baseFormulaType = new CodeableConcept(); // cc
1918          return this.baseFormulaType;
1919        }
1920
1921        public boolean hasBaseFormulaType() { 
1922          return this.baseFormulaType != null && !this.baseFormulaType.isEmpty();
1923        }
1924
1925        /**
1926         * @param value {@link #baseFormulaType} (The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.)
1927         */
1928        public NutritionOrderEnteralFormulaComponent setBaseFormulaType(CodeableConcept value) { 
1929          this.baseFormulaType = value;
1930          return this;
1931        }
1932
1933        /**
1934         * @return {@link #baseFormulaProductName} (The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".). This is the underlying object with id, value and extensions. The accessor "getBaseFormulaProductName" gives direct access to the value
1935         */
1936        public StringType getBaseFormulaProductNameElement() { 
1937          if (this.baseFormulaProductName == null)
1938            if (Configuration.errorOnAutoCreate())
1939              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaProductName");
1940            else if (Configuration.doAutoCreate())
1941              this.baseFormulaProductName = new StringType(); // bb
1942          return this.baseFormulaProductName;
1943        }
1944
1945        public boolean hasBaseFormulaProductNameElement() { 
1946          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
1947        }
1948
1949        public boolean hasBaseFormulaProductName() { 
1950          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
1951        }
1952
1953        /**
1954         * @param value {@link #baseFormulaProductName} (The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".). This is the underlying object with id, value and extensions. The accessor "getBaseFormulaProductName" gives direct access to the value
1955         */
1956        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductNameElement(StringType value) { 
1957          this.baseFormulaProductName = value;
1958          return this;
1959        }
1960
1961        /**
1962         * @return The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1963         */
1964        public String getBaseFormulaProductName() { 
1965          return this.baseFormulaProductName == null ? null : this.baseFormulaProductName.getValue();
1966        }
1967
1968        /**
1969         * @param value The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1970         */
1971        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductName(String value) { 
1972          if (Utilities.noString(value))
1973            this.baseFormulaProductName = null;
1974          else {
1975            if (this.baseFormulaProductName == null)
1976              this.baseFormulaProductName = new StringType();
1977            this.baseFormulaProductName.setValue(value);
1978          }
1979          return this;
1980        }
1981
1982        /**
1983         * @return {@link #additiveType} (Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.)
1984         */
1985        public CodeableConcept getAdditiveType() { 
1986          if (this.additiveType == null)
1987            if (Configuration.errorOnAutoCreate())
1988              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveType");
1989            else if (Configuration.doAutoCreate())
1990              this.additiveType = new CodeableConcept(); // cc
1991          return this.additiveType;
1992        }
1993
1994        public boolean hasAdditiveType() { 
1995          return this.additiveType != null && !this.additiveType.isEmpty();
1996        }
1997
1998        /**
1999         * @param value {@link #additiveType} (Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.)
2000         */
2001        public NutritionOrderEnteralFormulaComponent setAdditiveType(CodeableConcept value) { 
2002          this.additiveType = value;
2003          return this;
2004        }
2005
2006        /**
2007         * @return {@link #additiveProductName} (The product or brand name of the type of modular component to be added to the formula.). This is the underlying object with id, value and extensions. The accessor "getAdditiveProductName" gives direct access to the value
2008         */
2009        public StringType getAdditiveProductNameElement() { 
2010          if (this.additiveProductName == null)
2011            if (Configuration.errorOnAutoCreate())
2012              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveProductName");
2013            else if (Configuration.doAutoCreate())
2014              this.additiveProductName = new StringType(); // bb
2015          return this.additiveProductName;
2016        }
2017
2018        public boolean hasAdditiveProductNameElement() { 
2019          return this.additiveProductName != null && !this.additiveProductName.isEmpty();
2020        }
2021
2022        public boolean hasAdditiveProductName() { 
2023          return this.additiveProductName != null && !this.additiveProductName.isEmpty();
2024        }
2025
2026        /**
2027         * @param value {@link #additiveProductName} (The product or brand name of the type of modular component to be added to the formula.). This is the underlying object with id, value and extensions. The accessor "getAdditiveProductName" gives direct access to the value
2028         */
2029        public NutritionOrderEnteralFormulaComponent setAdditiveProductNameElement(StringType value) { 
2030          this.additiveProductName = value;
2031          return this;
2032        }
2033
2034        /**
2035         * @return The product or brand name of the type of modular component to be added to the formula.
2036         */
2037        public String getAdditiveProductName() { 
2038          return this.additiveProductName == null ? null : this.additiveProductName.getValue();
2039        }
2040
2041        /**
2042         * @param value The product or brand name of the type of modular component to be added to the formula.
2043         */
2044        public NutritionOrderEnteralFormulaComponent setAdditiveProductName(String value) { 
2045          if (Utilities.noString(value))
2046            this.additiveProductName = null;
2047          else {
2048            if (this.additiveProductName == null)
2049              this.additiveProductName = new StringType();
2050            this.additiveProductName.setValue(value);
2051          }
2052          return this;
2053        }
2054
2055        /**
2056         * @return {@link #caloricDensity} (The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.)
2057         */
2058        public Quantity getCaloricDensity() { 
2059          if (this.caloricDensity == null)
2060            if (Configuration.errorOnAutoCreate())
2061              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.caloricDensity");
2062            else if (Configuration.doAutoCreate())
2063              this.caloricDensity = new Quantity(); // cc
2064          return this.caloricDensity;
2065        }
2066
2067        public boolean hasCaloricDensity() { 
2068          return this.caloricDensity != null && !this.caloricDensity.isEmpty();
2069        }
2070
2071        /**
2072         * @param value {@link #caloricDensity} (The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.)
2073         */
2074        public NutritionOrderEnteralFormulaComponent setCaloricDensity(Quantity value) { 
2075          this.caloricDensity = value;
2076          return this;
2077        }
2078
2079        /**
2080         * @return {@link #routeofAdministration} (The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.)
2081         */
2082        public CodeableConcept getRouteofAdministration() { 
2083          if (this.routeofAdministration == null)
2084            if (Configuration.errorOnAutoCreate())
2085              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.routeofAdministration");
2086            else if (Configuration.doAutoCreate())
2087              this.routeofAdministration = new CodeableConcept(); // cc
2088          return this.routeofAdministration;
2089        }
2090
2091        public boolean hasRouteofAdministration() { 
2092          return this.routeofAdministration != null && !this.routeofAdministration.isEmpty();
2093        }
2094
2095        /**
2096         * @param value {@link #routeofAdministration} (The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.)
2097         */
2098        public NutritionOrderEnteralFormulaComponent setRouteofAdministration(CodeableConcept value) { 
2099          this.routeofAdministration = value;
2100          return this;
2101        }
2102
2103        /**
2104         * @return {@link #administration} (Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.)
2105         */
2106        public List<NutritionOrderEnteralFormulaAdministrationComponent> getAdministration() { 
2107          if (this.administration == null)
2108            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2109          return this.administration;
2110        }
2111
2112        /**
2113         * @return Returns a reference to <code>this</code> for easy method chaining
2114         */
2115        public NutritionOrderEnteralFormulaComponent setAdministration(List<NutritionOrderEnteralFormulaAdministrationComponent> theAdministration) { 
2116          this.administration = theAdministration;
2117          return this;
2118        }
2119
2120        public boolean hasAdministration() { 
2121          if (this.administration == null)
2122            return false;
2123          for (NutritionOrderEnteralFormulaAdministrationComponent item : this.administration)
2124            if (!item.isEmpty())
2125              return true;
2126          return false;
2127        }
2128
2129        public NutritionOrderEnteralFormulaAdministrationComponent addAdministration() { //3
2130          NutritionOrderEnteralFormulaAdministrationComponent t = new NutritionOrderEnteralFormulaAdministrationComponent();
2131          if (this.administration == null)
2132            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2133          this.administration.add(t);
2134          return t;
2135        }
2136
2137        public NutritionOrderEnteralFormulaComponent addAdministration(NutritionOrderEnteralFormulaAdministrationComponent t) { //3
2138          if (t == null)
2139            return this;
2140          if (this.administration == null)
2141            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2142          this.administration.add(t);
2143          return this;
2144        }
2145
2146        /**
2147         * @return The first repetition of repeating field {@link #administration}, creating it if it does not already exist
2148         */
2149        public NutritionOrderEnteralFormulaAdministrationComponent getAdministrationFirstRep() { 
2150          if (getAdministration().isEmpty()) {
2151            addAdministration();
2152          }
2153          return getAdministration().get(0);
2154        }
2155
2156        /**
2157         * @return {@link #maxVolumeToDeliver} (The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.)
2158         */
2159        public Quantity getMaxVolumeToDeliver() { 
2160          if (this.maxVolumeToDeliver == null)
2161            if (Configuration.errorOnAutoCreate())
2162              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.maxVolumeToDeliver");
2163            else if (Configuration.doAutoCreate())
2164              this.maxVolumeToDeliver = new Quantity(); // cc
2165          return this.maxVolumeToDeliver;
2166        }
2167
2168        public boolean hasMaxVolumeToDeliver() { 
2169          return this.maxVolumeToDeliver != null && !this.maxVolumeToDeliver.isEmpty();
2170        }
2171
2172        /**
2173         * @param value {@link #maxVolumeToDeliver} (The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.)
2174         */
2175        public NutritionOrderEnteralFormulaComponent setMaxVolumeToDeliver(Quantity value) { 
2176          this.maxVolumeToDeliver = value;
2177          return this;
2178        }
2179
2180        /**
2181         * @return {@link #administrationInstruction} (Free text formula administration, feeding instructions or additional instructions or information.). This is the underlying object with id, value and extensions. The accessor "getAdministrationInstruction" gives direct access to the value
2182         */
2183        public StringType getAdministrationInstructionElement() { 
2184          if (this.administrationInstruction == null)
2185            if (Configuration.errorOnAutoCreate())
2186              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.administrationInstruction");
2187            else if (Configuration.doAutoCreate())
2188              this.administrationInstruction = new StringType(); // bb
2189          return this.administrationInstruction;
2190        }
2191
2192        public boolean hasAdministrationInstructionElement() { 
2193          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
2194        }
2195
2196        public boolean hasAdministrationInstruction() { 
2197          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
2198        }
2199
2200        /**
2201         * @param value {@link #administrationInstruction} (Free text formula administration, feeding instructions or additional instructions or information.). This is the underlying object with id, value and extensions. The accessor "getAdministrationInstruction" gives direct access to the value
2202         */
2203        public NutritionOrderEnteralFormulaComponent setAdministrationInstructionElement(StringType value) { 
2204          this.administrationInstruction = value;
2205          return this;
2206        }
2207
2208        /**
2209         * @return Free text formula administration, feeding instructions or additional instructions or information.
2210         */
2211        public String getAdministrationInstruction() { 
2212          return this.administrationInstruction == null ? null : this.administrationInstruction.getValue();
2213        }
2214
2215        /**
2216         * @param value Free text formula administration, feeding instructions or additional instructions or information.
2217         */
2218        public NutritionOrderEnteralFormulaComponent setAdministrationInstruction(String value) { 
2219          if (Utilities.noString(value))
2220            this.administrationInstruction = null;
2221          else {
2222            if (this.administrationInstruction == null)
2223              this.administrationInstruction = new StringType();
2224            this.administrationInstruction.setValue(value);
2225          }
2226          return this;
2227        }
2228
2229        protected void listChildren(List<Property> children) {
2230          super.listChildren(children);
2231          children.add(new Property("baseFormulaType", "CodeableConcept", "The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.", 0, 1, baseFormulaType));
2232          children.add(new Property("baseFormulaProductName", "string", "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".", 0, 1, baseFormulaProductName));
2233          children.add(new Property("additiveType", "CodeableConcept", "Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.", 0, 1, additiveType));
2234          children.add(new Property("additiveProductName", "string", "The product or brand name of the type of modular component to be added to the formula.", 0, 1, additiveProductName));
2235          children.add(new Property("caloricDensity", "SimpleQuantity", "The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.", 0, 1, caloricDensity));
2236          children.add(new Property("routeofAdministration", "CodeableConcept", "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.", 0, 1, routeofAdministration));
2237          children.add(new Property("administration", "", "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.", 0, java.lang.Integer.MAX_VALUE, administration));
2238          children.add(new Property("maxVolumeToDeliver", "SimpleQuantity", "The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.", 0, 1, maxVolumeToDeliver));
2239          children.add(new Property("administrationInstruction", "string", "Free text formula administration, feeding instructions or additional instructions or information.", 0, 1, administrationInstruction));
2240        }
2241
2242        @Override
2243        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2244          switch (_hash) {
2245          case -138930641: /*baseFormulaType*/  return new Property("baseFormulaType", "CodeableConcept", "The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.", 0, 1, baseFormulaType);
2246          case -1267705979: /*baseFormulaProductName*/  return new Property("baseFormulaProductName", "string", "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".", 0, 1, baseFormulaProductName);
2247          case -470746842: /*additiveType*/  return new Property("additiveType", "CodeableConcept", "Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.", 0, 1, additiveType);
2248          case 488079534: /*additiveProductName*/  return new Property("additiveProductName", "string", "The product or brand name of the type of modular component to be added to the formula.", 0, 1, additiveProductName);
2249          case 186983261: /*caloricDensity*/  return new Property("caloricDensity", "SimpleQuantity", "The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.", 0, 1, caloricDensity);
2250          case -1710107042: /*routeofAdministration*/  return new Property("routeofAdministration", "CodeableConcept", "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.", 0, 1, routeofAdministration);
2251          case 1255702622: /*administration*/  return new Property("administration", "", "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.", 0, java.lang.Integer.MAX_VALUE, administration);
2252          case 2017924652: /*maxVolumeToDeliver*/  return new Property("maxVolumeToDeliver", "SimpleQuantity", "The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.", 0, 1, maxVolumeToDeliver);
2253          case 427085136: /*administrationInstruction*/  return new Property("administrationInstruction", "string", "Free text formula administration, feeding instructions or additional instructions or information.", 0, 1, administrationInstruction);
2254          default: return super.getNamedProperty(_hash, _name, _checkValid);
2255          }
2256
2257        }
2258
2259      @Override
2260      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2261        switch (hash) {
2262        case -138930641: /*baseFormulaType*/ return this.baseFormulaType == null ? new Base[0] : new Base[] {this.baseFormulaType}; // CodeableConcept
2263        case -1267705979: /*baseFormulaProductName*/ return this.baseFormulaProductName == null ? new Base[0] : new Base[] {this.baseFormulaProductName}; // StringType
2264        case -470746842: /*additiveType*/ return this.additiveType == null ? new Base[0] : new Base[] {this.additiveType}; // CodeableConcept
2265        case 488079534: /*additiveProductName*/ return this.additiveProductName == null ? new Base[0] : new Base[] {this.additiveProductName}; // StringType
2266        case 186983261: /*caloricDensity*/ return this.caloricDensity == null ? new Base[0] : new Base[] {this.caloricDensity}; // Quantity
2267        case -1710107042: /*routeofAdministration*/ return this.routeofAdministration == null ? new Base[0] : new Base[] {this.routeofAdministration}; // CodeableConcept
2268        case 1255702622: /*administration*/ return this.administration == null ? new Base[0] : this.administration.toArray(new Base[this.administration.size()]); // NutritionOrderEnteralFormulaAdministrationComponent
2269        case 2017924652: /*maxVolumeToDeliver*/ return this.maxVolumeToDeliver == null ? new Base[0] : new Base[] {this.maxVolumeToDeliver}; // Quantity
2270        case 427085136: /*administrationInstruction*/ return this.administrationInstruction == null ? new Base[0] : new Base[] {this.administrationInstruction}; // StringType
2271        default: return super.getProperty(hash, name, checkValid);
2272        }
2273
2274      }
2275
2276      @Override
2277      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2278        switch (hash) {
2279        case -138930641: // baseFormulaType
2280          this.baseFormulaType = castToCodeableConcept(value); // CodeableConcept
2281          return value;
2282        case -1267705979: // baseFormulaProductName
2283          this.baseFormulaProductName = castToString(value); // StringType
2284          return value;
2285        case -470746842: // additiveType
2286          this.additiveType = castToCodeableConcept(value); // CodeableConcept
2287          return value;
2288        case 488079534: // additiveProductName
2289          this.additiveProductName = castToString(value); // StringType
2290          return value;
2291        case 186983261: // caloricDensity
2292          this.caloricDensity = castToQuantity(value); // Quantity
2293          return value;
2294        case -1710107042: // routeofAdministration
2295          this.routeofAdministration = castToCodeableConcept(value); // CodeableConcept
2296          return value;
2297        case 1255702622: // administration
2298          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value); // NutritionOrderEnteralFormulaAdministrationComponent
2299          return value;
2300        case 2017924652: // maxVolumeToDeliver
2301          this.maxVolumeToDeliver = castToQuantity(value); // Quantity
2302          return value;
2303        case 427085136: // administrationInstruction
2304          this.administrationInstruction = castToString(value); // StringType
2305          return value;
2306        default: return super.setProperty(hash, name, value);
2307        }
2308
2309      }
2310
2311      @Override
2312      public Base setProperty(String name, Base value) throws FHIRException {
2313        if (name.equals("baseFormulaType")) {
2314          this.baseFormulaType = castToCodeableConcept(value); // CodeableConcept
2315        } else if (name.equals("baseFormulaProductName")) {
2316          this.baseFormulaProductName = castToString(value); // StringType
2317        } else if (name.equals("additiveType")) {
2318          this.additiveType = castToCodeableConcept(value); // CodeableConcept
2319        } else if (name.equals("additiveProductName")) {
2320          this.additiveProductName = castToString(value); // StringType
2321        } else if (name.equals("caloricDensity")) {
2322          this.caloricDensity = castToQuantity(value); // Quantity
2323        } else if (name.equals("routeofAdministration")) {
2324          this.routeofAdministration = castToCodeableConcept(value); // CodeableConcept
2325        } else if (name.equals("administration")) {
2326          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value);
2327        } else if (name.equals("maxVolumeToDeliver")) {
2328          this.maxVolumeToDeliver = castToQuantity(value); // Quantity
2329        } else if (name.equals("administrationInstruction")) {
2330          this.administrationInstruction = castToString(value); // StringType
2331        } else
2332          return super.setProperty(name, value);
2333        return value;
2334      }
2335
2336      @Override
2337      public Base makeProperty(int hash, String name) throws FHIRException {
2338        switch (hash) {
2339        case -138930641:  return getBaseFormulaType(); 
2340        case -1267705979:  return getBaseFormulaProductNameElement();
2341        case -470746842:  return getAdditiveType(); 
2342        case 488079534:  return getAdditiveProductNameElement();
2343        case 186983261:  return getCaloricDensity(); 
2344        case -1710107042:  return getRouteofAdministration(); 
2345        case 1255702622:  return addAdministration(); 
2346        case 2017924652:  return getMaxVolumeToDeliver(); 
2347        case 427085136:  return getAdministrationInstructionElement();
2348        default: return super.makeProperty(hash, name);
2349        }
2350
2351      }
2352
2353      @Override
2354      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2355        switch (hash) {
2356        case -138930641: /*baseFormulaType*/ return new String[] {"CodeableConcept"};
2357        case -1267705979: /*baseFormulaProductName*/ return new String[] {"string"};
2358        case -470746842: /*additiveType*/ return new String[] {"CodeableConcept"};
2359        case 488079534: /*additiveProductName*/ return new String[] {"string"};
2360        case 186983261: /*caloricDensity*/ return new String[] {"SimpleQuantity"};
2361        case -1710107042: /*routeofAdministration*/ return new String[] {"CodeableConcept"};
2362        case 1255702622: /*administration*/ return new String[] {};
2363        case 2017924652: /*maxVolumeToDeliver*/ return new String[] {"SimpleQuantity"};
2364        case 427085136: /*administrationInstruction*/ return new String[] {"string"};
2365        default: return super.getTypesForProperty(hash, name);
2366        }
2367
2368      }
2369
2370      @Override
2371      public Base addChild(String name) throws FHIRException {
2372        if (name.equals("baseFormulaType")) {
2373          this.baseFormulaType = new CodeableConcept();
2374          return this.baseFormulaType;
2375        }
2376        else if (name.equals("baseFormulaProductName")) {
2377          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.baseFormulaProductName");
2378        }
2379        else if (name.equals("additiveType")) {
2380          this.additiveType = new CodeableConcept();
2381          return this.additiveType;
2382        }
2383        else if (name.equals("additiveProductName")) {
2384          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.additiveProductName");
2385        }
2386        else if (name.equals("caloricDensity")) {
2387          this.caloricDensity = new Quantity();
2388          return this.caloricDensity;
2389        }
2390        else if (name.equals("routeofAdministration")) {
2391          this.routeofAdministration = new CodeableConcept();
2392          return this.routeofAdministration;
2393        }
2394        else if (name.equals("administration")) {
2395          return addAdministration();
2396        }
2397        else if (name.equals("maxVolumeToDeliver")) {
2398          this.maxVolumeToDeliver = new Quantity();
2399          return this.maxVolumeToDeliver;
2400        }
2401        else if (name.equals("administrationInstruction")) {
2402          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.administrationInstruction");
2403        }
2404        else
2405          return super.addChild(name);
2406      }
2407
2408      public NutritionOrderEnteralFormulaComponent copy() {
2409        NutritionOrderEnteralFormulaComponent dst = new NutritionOrderEnteralFormulaComponent();
2410        copyValues(dst);
2411        return dst;
2412      }
2413
2414      public void copyValues(NutritionOrderEnteralFormulaComponent dst) {
2415        super.copyValues(dst);
2416        dst.baseFormulaType = baseFormulaType == null ? null : baseFormulaType.copy();
2417        dst.baseFormulaProductName = baseFormulaProductName == null ? null : baseFormulaProductName.copy();
2418        dst.additiveType = additiveType == null ? null : additiveType.copy();
2419        dst.additiveProductName = additiveProductName == null ? null : additiveProductName.copy();
2420        dst.caloricDensity = caloricDensity == null ? null : caloricDensity.copy();
2421        dst.routeofAdministration = routeofAdministration == null ? null : routeofAdministration.copy();
2422        if (administration != null) {
2423          dst.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2424          for (NutritionOrderEnteralFormulaAdministrationComponent i : administration)
2425            dst.administration.add(i.copy());
2426        };
2427        dst.maxVolumeToDeliver = maxVolumeToDeliver == null ? null : maxVolumeToDeliver.copy();
2428        dst.administrationInstruction = administrationInstruction == null ? null : administrationInstruction.copy();
2429      }
2430
2431      @Override
2432      public boolean equalsDeep(Base other_) {
2433        if (!super.equalsDeep(other_))
2434          return false;
2435        if (!(other_ instanceof NutritionOrderEnteralFormulaComponent))
2436          return false;
2437        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other_;
2438        return compareDeep(baseFormulaType, o.baseFormulaType, true) && compareDeep(baseFormulaProductName, o.baseFormulaProductName, true)
2439           && compareDeep(additiveType, o.additiveType, true) && compareDeep(additiveProductName, o.additiveProductName, true)
2440           && compareDeep(caloricDensity, o.caloricDensity, true) && compareDeep(routeofAdministration, o.routeofAdministration, true)
2441           && compareDeep(administration, o.administration, true) && compareDeep(maxVolumeToDeliver, o.maxVolumeToDeliver, true)
2442           && compareDeep(administrationInstruction, o.administrationInstruction, true);
2443      }
2444
2445      @Override
2446      public boolean equalsShallow(Base other_) {
2447        if (!super.equalsShallow(other_))
2448          return false;
2449        if (!(other_ instanceof NutritionOrderEnteralFormulaComponent))
2450          return false;
2451        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other_;
2452        return compareValues(baseFormulaProductName, o.baseFormulaProductName, true) && compareValues(additiveProductName, o.additiveProductName, true)
2453           && compareValues(administrationInstruction, o.administrationInstruction, true);
2454      }
2455
2456      public boolean isEmpty() {
2457        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(baseFormulaType, baseFormulaProductName
2458          , additiveType, additiveProductName, caloricDensity, routeofAdministration, administration
2459          , maxVolumeToDeliver, administrationInstruction);
2460      }
2461
2462  public String fhirType() {
2463    return "NutritionOrder.enteralFormula";
2464
2465  }
2466
2467  }
2468
2469    @Block()
2470    public static class NutritionOrderEnteralFormulaAdministrationComponent extends BackboneElement implements IBaseBackboneElement {
2471        /**
2472         * The time period and frequency at which the enteral formula should be delivered to the patient.
2473         */
2474        @Child(name = "schedule", type = {Timing.class}, order=1, min=0, max=1, modifier=false, summary=false)
2475        @Description(shortDefinition="Scheduled frequency of enteral feeding", formalDefinition="The time period and frequency at which the enteral formula should be delivered to the patient." )
2476        protected Timing schedule;
2477
2478        /**
2479         * The volume of formula to provide to the patient per the specified administration schedule.
2480         */
2481        @Child(name = "quantity", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
2482        @Description(shortDefinition="The volume of formula to provide", formalDefinition="The volume of formula to provide to the patient per the specified administration schedule." )
2483        protected Quantity quantity;
2484
2485        /**
2486         * The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.
2487         */
2488        @Child(name = "rate", type = {Quantity.class, Ratio.class}, order=3, min=0, max=1, modifier=false, summary=false)
2489        @Description(shortDefinition="Speed with which the formula is provided per period of time", formalDefinition="The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule." )
2490        protected Type rate;
2491
2492        private static final long serialVersionUID = 673093291L;
2493
2494    /**
2495     * Constructor
2496     */
2497      public NutritionOrderEnteralFormulaAdministrationComponent() {
2498        super();
2499      }
2500
2501        /**
2502         * @return {@link #schedule} (The time period and frequency at which the enteral formula should be delivered to the patient.)
2503         */
2504        public Timing getSchedule() { 
2505          if (this.schedule == null)
2506            if (Configuration.errorOnAutoCreate())
2507              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.schedule");
2508            else if (Configuration.doAutoCreate())
2509              this.schedule = new Timing(); // cc
2510          return this.schedule;
2511        }
2512
2513        public boolean hasSchedule() { 
2514          return this.schedule != null && !this.schedule.isEmpty();
2515        }
2516
2517        /**
2518         * @param value {@link #schedule} (The time period and frequency at which the enteral formula should be delivered to the patient.)
2519         */
2520        public NutritionOrderEnteralFormulaAdministrationComponent setSchedule(Timing value) { 
2521          this.schedule = value;
2522          return this;
2523        }
2524
2525        /**
2526         * @return {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
2527         */
2528        public Quantity getQuantity() { 
2529          if (this.quantity == null)
2530            if (Configuration.errorOnAutoCreate())
2531              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.quantity");
2532            else if (Configuration.doAutoCreate())
2533              this.quantity = new Quantity(); // cc
2534          return this.quantity;
2535        }
2536
2537        public boolean hasQuantity() { 
2538          return this.quantity != null && !this.quantity.isEmpty();
2539        }
2540
2541        /**
2542         * @param value {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
2543         */
2544        public NutritionOrderEnteralFormulaAdministrationComponent setQuantity(Quantity value) { 
2545          this.quantity = value;
2546          return this;
2547        }
2548
2549        /**
2550         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2551         */
2552        public Type getRate() { 
2553          return this.rate;
2554        }
2555
2556        /**
2557         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2558         */
2559        public Quantity getRateQuantity() throws FHIRException { 
2560          if (this.rate == null)
2561            this.rate = new Quantity();
2562          if (!(this.rate instanceof Quantity))
2563            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.rate.getClass().getName()+" was encountered");
2564          return (Quantity) this.rate;
2565        }
2566
2567        public boolean hasRateQuantity() { 
2568          return this != null && this.rate instanceof Quantity;
2569        }
2570
2571        /**
2572         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2573         */
2574        public Ratio getRateRatio() throws FHIRException { 
2575          if (this.rate == null)
2576            this.rate = new Ratio();
2577          if (!(this.rate instanceof Ratio))
2578            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered");
2579          return (Ratio) this.rate;
2580        }
2581
2582        public boolean hasRateRatio() { 
2583          return this != null && this.rate instanceof Ratio;
2584        }
2585
2586        public boolean hasRate() { 
2587          return this.rate != null && !this.rate.isEmpty();
2588        }
2589
2590        /**
2591         * @param value {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2592         */
2593        public NutritionOrderEnteralFormulaAdministrationComponent setRate(Type value) { 
2594          if (value != null && !(value instanceof Quantity || value instanceof Ratio))
2595            throw new Error("Not the right type for NutritionOrder.enteralFormula.administration.rate[x]: "+value.fhirType());
2596          this.rate = value;
2597          return this;
2598        }
2599
2600        protected void listChildren(List<Property> children) {
2601          super.listChildren(children);
2602          children.add(new Property("schedule", "Timing", "The time period and frequency at which the enteral formula should be delivered to the patient.", 0, 1, schedule));
2603          children.add(new Property("quantity", "SimpleQuantity", "The volume of formula to provide to the patient per the specified administration schedule.", 0, 1, quantity));
2604          children.add(new Property("rate[x]", "SimpleQuantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate));
2605        }
2606
2607        @Override
2608        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2609          switch (_hash) {
2610          case -697920873: /*schedule*/  return new Property("schedule", "Timing", "The time period and frequency at which the enteral formula should be delivered to the patient.", 0, 1, schedule);
2611          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The volume of formula to provide to the patient per the specified administration schedule.", 0, 1, quantity);
2612          case 983460768: /*rate[x]*/  return new Property("rate[x]", "SimpleQuantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
2613          case 3493088: /*rate*/  return new Property("rate[x]", "SimpleQuantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
2614          case -1085459061: /*rateQuantity*/  return new Property("rate[x]", "SimpleQuantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
2615          case 204021515: /*rateRatio*/  return new Property("rate[x]", "SimpleQuantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
2616          default: return super.getNamedProperty(_hash, _name, _checkValid);
2617          }
2618
2619        }
2620
2621      @Override
2622      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2623        switch (hash) {
2624        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : new Base[] {this.schedule}; // Timing
2625        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
2626        case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // Type
2627        default: return super.getProperty(hash, name, checkValid);
2628        }
2629
2630      }
2631
2632      @Override
2633      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2634        switch (hash) {
2635        case -697920873: // schedule
2636          this.schedule = castToTiming(value); // Timing
2637          return value;
2638        case -1285004149: // quantity
2639          this.quantity = castToQuantity(value); // Quantity
2640          return value;
2641        case 3493088: // rate
2642          this.rate = castToType(value); // Type
2643          return value;
2644        default: return super.setProperty(hash, name, value);
2645        }
2646
2647      }
2648
2649      @Override
2650      public Base setProperty(String name, Base value) throws FHIRException {
2651        if (name.equals("schedule")) {
2652          this.schedule = castToTiming(value); // Timing
2653        } else if (name.equals("quantity")) {
2654          this.quantity = castToQuantity(value); // Quantity
2655        } else if (name.equals("rate[x]")) {
2656          this.rate = castToType(value); // Type
2657        } else
2658          return super.setProperty(name, value);
2659        return value;
2660      }
2661
2662      @Override
2663      public Base makeProperty(int hash, String name) throws FHIRException {
2664        switch (hash) {
2665        case -697920873:  return getSchedule(); 
2666        case -1285004149:  return getQuantity(); 
2667        case 983460768:  return getRate(); 
2668        case 3493088:  return getRate(); 
2669        default: return super.makeProperty(hash, name);
2670        }
2671
2672      }
2673
2674      @Override
2675      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2676        switch (hash) {
2677        case -697920873: /*schedule*/ return new String[] {"Timing"};
2678        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
2679        case 3493088: /*rate*/ return new String[] {"SimpleQuantity", "Ratio"};
2680        default: return super.getTypesForProperty(hash, name);
2681        }
2682
2683      }
2684
2685      @Override
2686      public Base addChild(String name) throws FHIRException {
2687        if (name.equals("schedule")) {
2688          this.schedule = new Timing();
2689          return this.schedule;
2690        }
2691        else if (name.equals("quantity")) {
2692          this.quantity = new Quantity();
2693          return this.quantity;
2694        }
2695        else if (name.equals("rateQuantity")) {
2696          this.rate = new Quantity();
2697          return this.rate;
2698        }
2699        else if (name.equals("rateRatio")) {
2700          this.rate = new Ratio();
2701          return this.rate;
2702        }
2703        else
2704          return super.addChild(name);
2705      }
2706
2707      public NutritionOrderEnteralFormulaAdministrationComponent copy() {
2708        NutritionOrderEnteralFormulaAdministrationComponent dst = new NutritionOrderEnteralFormulaAdministrationComponent();
2709        copyValues(dst);
2710        return dst;
2711      }
2712
2713      public void copyValues(NutritionOrderEnteralFormulaAdministrationComponent dst) {
2714        super.copyValues(dst);
2715        dst.schedule = schedule == null ? null : schedule.copy();
2716        dst.quantity = quantity == null ? null : quantity.copy();
2717        dst.rate = rate == null ? null : rate.copy();
2718      }
2719
2720      @Override
2721      public boolean equalsDeep(Base other_) {
2722        if (!super.equalsDeep(other_))
2723          return false;
2724        if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationComponent))
2725          return false;
2726        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other_;
2727        return compareDeep(schedule, o.schedule, true) && compareDeep(quantity, o.quantity, true) && compareDeep(rate, o.rate, true)
2728          ;
2729      }
2730
2731      @Override
2732      public boolean equalsShallow(Base other_) {
2733        if (!super.equalsShallow(other_))
2734          return false;
2735        if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationComponent))
2736          return false;
2737        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other_;
2738        return true;
2739      }
2740
2741      public boolean isEmpty() {
2742        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(schedule, quantity, rate
2743          );
2744      }
2745
2746  public String fhirType() {
2747    return "NutritionOrder.enteralFormula.administration";
2748
2749  }
2750
2751  }
2752
2753    /**
2754     * Identifiers assigned to this order by the order sender or by the order receiver.
2755     */
2756    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2757    @Description(shortDefinition="Identifiers assigned to this order", formalDefinition="Identifiers assigned to this order by the order sender or by the order receiver." )
2758    protected List<Identifier> identifier;
2759
2760    /**
2761     * The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
2762     */
2763    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2764    @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
2765    protected List<CanonicalType> instantiatesCanonical;
2766
2767    /**
2768     * The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
2769     */
2770    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2771    @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
2772    protected List<UriType> instantiatesUri;
2773
2774    /**
2775     * The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
2776     */
2777    @Child(name = "instantiates", type = {UriType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2778    @Description(shortDefinition="Instantiates protocol or definition", formalDefinition="The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
2779    protected List<UriType> instantiates;
2780
2781    /**
2782     * The workflow status of the nutrition order/request.
2783     */
2784    @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true)
2785    @Description(shortDefinition="draft | active | on-hold | revoked | completed | entered-in-error | unknown", formalDefinition="The workflow status of the nutrition order/request." )
2786    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-status")
2787    protected Enumeration<NutritionOrderStatus> status;
2788
2789    /**
2790     * Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
2791     */
2792    @Child(name = "intent", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true)
2793    @Description(shortDefinition="proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option", formalDefinition="Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain." )
2794    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-intent")
2795    protected Enumeration<NutritiionOrderIntent> intent;
2796
2797    /**
2798     * The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.
2799     */
2800    @Child(name = "patient", type = {Patient.class}, order=6, min=1, max=1, modifier=false, summary=true)
2801    @Description(shortDefinition="The person who requires the diet, formula or nutritional supplement", formalDefinition="The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding." )
2802    protected Reference patient;
2803
2804    /**
2805     * The actual object that is the target of the reference (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2806     */
2807    protected Patient patientTarget;
2808
2809    /**
2810     * An encounter that provides additional information about the healthcare context in which this request is made.
2811     */
2812    @Child(name = "encounter", type = {Encounter.class}, order=7, min=0, max=1, modifier=false, summary=false)
2813    @Description(shortDefinition="The encounter associated with this nutrition order", formalDefinition="An encounter that provides additional information about the healthcare context in which this request is made." )
2814    protected Reference encounter;
2815
2816    /**
2817     * The actual object that is the target of the reference (An encounter that provides additional information about the healthcare context in which this request is made.)
2818     */
2819    protected Encounter encounterTarget;
2820
2821    /**
2822     * The date and time that this nutrition order was requested.
2823     */
2824    @Child(name = "dateTime", type = {DateTimeType.class}, order=8, min=1, max=1, modifier=false, summary=true)
2825    @Description(shortDefinition="Date and time the nutrition order was requested", formalDefinition="The date and time that this nutrition order was requested." )
2826    protected DateTimeType dateTime;
2827
2828    /**
2829     * The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.
2830     */
2831    @Child(name = "orderer", type = {Practitioner.class, PractitionerRole.class}, order=9, min=0, max=1, modifier=false, summary=true)
2832    @Description(shortDefinition="Who ordered the diet, formula or nutritional supplement", formalDefinition="The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings." )
2833    protected Reference orderer;
2834
2835    /**
2836     * The actual object that is the target of the reference (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2837     */
2838    protected Resource ordererTarget;
2839
2840    /**
2841     * A link to a record of allergies or intolerances  which should be included in the nutrition order.
2842     */
2843    @Child(name = "allergyIntolerance", type = {AllergyIntolerance.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2844    @Description(shortDefinition="List of the patient's food and nutrition-related allergies and intolerances", formalDefinition="A link to a record of allergies or intolerances  which should be included in the nutrition order." )
2845    protected List<Reference> allergyIntolerance;
2846    /**
2847     * The actual objects that are the target of the reference (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2848     */
2849    protected List<AllergyIntolerance> allergyIntoleranceTarget;
2850
2851
2852    /**
2853     * This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.
2854     */
2855    @Child(name = "foodPreferenceModifier", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2856    @Description(shortDefinition="Order-specific modifier about the type of food that should be given", formalDefinition="This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings." )
2857    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-diet")
2858    protected List<CodeableConcept> foodPreferenceModifier;
2859
2860    /**
2861     * This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.
2862     */
2863    @Child(name = "excludeFoodModifier", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2864    @Description(shortDefinition="Order-specific modifier about the type of food that should not be given", formalDefinition="This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings." )
2865    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/food-type")
2866    protected List<CodeableConcept> excludeFoodModifier;
2867
2868    /**
2869     * Diet given orally in contrast to enteral (tube) feeding.
2870     */
2871    @Child(name = "oralDiet", type = {}, order=13, min=0, max=1, modifier=false, summary=false)
2872    @Description(shortDefinition="Oral diet components", formalDefinition="Diet given orally in contrast to enteral (tube) feeding." )
2873    protected NutritionOrderOralDietComponent oralDiet;
2874
2875    /**
2876     * Oral nutritional products given in order to add further nutritional value to the patient's diet.
2877     */
2878    @Child(name = "supplement", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2879    @Description(shortDefinition="Supplement components", formalDefinition="Oral nutritional products given in order to add further nutritional value to the patient's diet." )
2880    protected List<NutritionOrderSupplementComponent> supplement;
2881
2882    /**
2883     * Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.
2884     */
2885    @Child(name = "enteralFormula", type = {}, order=15, min=0, max=1, modifier=false, summary=false)
2886    @Description(shortDefinition="Enteral formula components", formalDefinition="Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity." )
2887    protected NutritionOrderEnteralFormulaComponent enteralFormula;
2888
2889    /**
2890     * Comments made about the {{title}} by the requester, performer, subject or other participants.
2891     */
2892    @Child(name = "note", type = {Annotation.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2893    @Description(shortDefinition="Comments", formalDefinition="Comments made about the {{title}} by the requester, performer, subject or other participants." )
2894    protected List<Annotation> note;
2895
2896    private static final long serialVersionUID = 1746744267L;
2897
2898  /**
2899   * Constructor
2900   */
2901    public NutritionOrder() {
2902      super();
2903    }
2904
2905  /**
2906   * Constructor
2907   */
2908    public NutritionOrder(Enumeration<NutritionOrderStatus> status, Enumeration<NutritiionOrderIntent> intent, Reference patient, DateTimeType dateTime) {
2909      super();
2910      this.status = status;
2911      this.intent = intent;
2912      this.patient = patient;
2913      this.dateTime = dateTime;
2914    }
2915
2916    /**
2917     * @return {@link #identifier} (Identifiers assigned to this order by the order sender or by the order receiver.)
2918     */
2919    public List<Identifier> getIdentifier() { 
2920      if (this.identifier == null)
2921        this.identifier = new ArrayList<Identifier>();
2922      return this.identifier;
2923    }
2924
2925    /**
2926     * @return Returns a reference to <code>this</code> for easy method chaining
2927     */
2928    public NutritionOrder setIdentifier(List<Identifier> theIdentifier) { 
2929      this.identifier = theIdentifier;
2930      return this;
2931    }
2932
2933    public boolean hasIdentifier() { 
2934      if (this.identifier == null)
2935        return false;
2936      for (Identifier item : this.identifier)
2937        if (!item.isEmpty())
2938          return true;
2939      return false;
2940    }
2941
2942    public Identifier addIdentifier() { //3
2943      Identifier t = new Identifier();
2944      if (this.identifier == null)
2945        this.identifier = new ArrayList<Identifier>();
2946      this.identifier.add(t);
2947      return t;
2948    }
2949
2950    public NutritionOrder addIdentifier(Identifier t) { //3
2951      if (t == null)
2952        return this;
2953      if (this.identifier == null)
2954        this.identifier = new ArrayList<Identifier>();
2955      this.identifier.add(t);
2956      return this;
2957    }
2958
2959    /**
2960     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2961     */
2962    public Identifier getIdentifierFirstRep() { 
2963      if (getIdentifier().isEmpty()) {
2964        addIdentifier();
2965      }
2966      return getIdentifier().get(0);
2967    }
2968
2969    /**
2970     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2971     */
2972    public List<CanonicalType> getInstantiatesCanonical() { 
2973      if (this.instantiatesCanonical == null)
2974        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2975      return this.instantiatesCanonical;
2976    }
2977
2978    /**
2979     * @return Returns a reference to <code>this</code> for easy method chaining
2980     */
2981    public NutritionOrder setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
2982      this.instantiatesCanonical = theInstantiatesCanonical;
2983      return this;
2984    }
2985
2986    public boolean hasInstantiatesCanonical() { 
2987      if (this.instantiatesCanonical == null)
2988        return false;
2989      for (CanonicalType item : this.instantiatesCanonical)
2990        if (!item.isEmpty())
2991          return true;
2992      return false;
2993    }
2994
2995    /**
2996     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2997     */
2998    public CanonicalType addInstantiatesCanonicalElement() {//2 
2999      CanonicalType t = new CanonicalType();
3000      if (this.instantiatesCanonical == null)
3001        this.instantiatesCanonical = new ArrayList<CanonicalType>();
3002      this.instantiatesCanonical.add(t);
3003      return t;
3004    }
3005
3006    /**
3007     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3008     */
3009    public NutritionOrder addInstantiatesCanonical(String value) { //1
3010      CanonicalType t = new CanonicalType();
3011      t.setValue(value);
3012      if (this.instantiatesCanonical == null)
3013        this.instantiatesCanonical = new ArrayList<CanonicalType>();
3014      this.instantiatesCanonical.add(t);
3015      return this;
3016    }
3017
3018    /**
3019     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3020     */
3021    public boolean hasInstantiatesCanonical(String value) { 
3022      if (this.instantiatesCanonical == null)
3023        return false;
3024      for (CanonicalType v : this.instantiatesCanonical)
3025        if (v.getValue().equals(value)) // canonical(ActivityDefinition|PlanDefinition)
3026          return true;
3027      return false;
3028    }
3029
3030    /**
3031     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3032     */
3033    public List<UriType> getInstantiatesUri() { 
3034      if (this.instantiatesUri == null)
3035        this.instantiatesUri = new ArrayList<UriType>();
3036      return this.instantiatesUri;
3037    }
3038
3039    /**
3040     * @return Returns a reference to <code>this</code> for easy method chaining
3041     */
3042    public NutritionOrder setInstantiatesUri(List<UriType> theInstantiatesUri) { 
3043      this.instantiatesUri = theInstantiatesUri;
3044      return this;
3045    }
3046
3047    public boolean hasInstantiatesUri() { 
3048      if (this.instantiatesUri == null)
3049        return false;
3050      for (UriType item : this.instantiatesUri)
3051        if (!item.isEmpty())
3052          return true;
3053      return false;
3054    }
3055
3056    /**
3057     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3058     */
3059    public UriType addInstantiatesUriElement() {//2 
3060      UriType t = new UriType();
3061      if (this.instantiatesUri == null)
3062        this.instantiatesUri = new ArrayList<UriType>();
3063      this.instantiatesUri.add(t);
3064      return t;
3065    }
3066
3067    /**
3068     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3069     */
3070    public NutritionOrder addInstantiatesUri(String value) { //1
3071      UriType t = new UriType();
3072      t.setValue(value);
3073      if (this.instantiatesUri == null)
3074        this.instantiatesUri = new ArrayList<UriType>();
3075      this.instantiatesUri.add(t);
3076      return this;
3077    }
3078
3079    /**
3080     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3081     */
3082    public boolean hasInstantiatesUri(String value) { 
3083      if (this.instantiatesUri == null)
3084        return false;
3085      for (UriType v : this.instantiatesUri)
3086        if (v.getValue().equals(value)) // uri
3087          return true;
3088      return false;
3089    }
3090
3091    /**
3092     * @return {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3093     */
3094    public List<UriType> getInstantiates() { 
3095      if (this.instantiates == null)
3096        this.instantiates = new ArrayList<UriType>();
3097      return this.instantiates;
3098    }
3099
3100    /**
3101     * @return Returns a reference to <code>this</code> for easy method chaining
3102     */
3103    public NutritionOrder setInstantiates(List<UriType> theInstantiates) { 
3104      this.instantiates = theInstantiates;
3105      return this;
3106    }
3107
3108    public boolean hasInstantiates() { 
3109      if (this.instantiates == null)
3110        return false;
3111      for (UriType item : this.instantiates)
3112        if (!item.isEmpty())
3113          return true;
3114      return false;
3115    }
3116
3117    /**
3118     * @return {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3119     */
3120    public UriType addInstantiatesElement() {//2 
3121      UriType t = new UriType();
3122      if (this.instantiates == null)
3123        this.instantiates = new ArrayList<UriType>();
3124      this.instantiates.add(t);
3125      return t;
3126    }
3127
3128    /**
3129     * @param value {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3130     */
3131    public NutritionOrder addInstantiates(String value) { //1
3132      UriType t = new UriType();
3133      t.setValue(value);
3134      if (this.instantiates == null)
3135        this.instantiates = new ArrayList<UriType>();
3136      this.instantiates.add(t);
3137      return this;
3138    }
3139
3140    /**
3141     * @param value {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3142     */
3143    public boolean hasInstantiates(String value) { 
3144      if (this.instantiates == null)
3145        return false;
3146      for (UriType v : this.instantiates)
3147        if (v.getValue().equals(value)) // uri
3148          return true;
3149      return false;
3150    }
3151
3152    /**
3153     * @return {@link #status} (The workflow status of the nutrition order/request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
3154     */
3155    public Enumeration<NutritionOrderStatus> getStatusElement() { 
3156      if (this.status == null)
3157        if (Configuration.errorOnAutoCreate())
3158          throw new Error("Attempt to auto-create NutritionOrder.status");
3159        else if (Configuration.doAutoCreate())
3160          this.status = new Enumeration<NutritionOrderStatus>(new NutritionOrderStatusEnumFactory()); // bb
3161      return this.status;
3162    }
3163
3164    public boolean hasStatusElement() { 
3165      return this.status != null && !this.status.isEmpty();
3166    }
3167
3168    public boolean hasStatus() { 
3169      return this.status != null && !this.status.isEmpty();
3170    }
3171
3172    /**
3173     * @param value {@link #status} (The workflow status of the nutrition order/request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
3174     */
3175    public NutritionOrder setStatusElement(Enumeration<NutritionOrderStatus> value) { 
3176      this.status = value;
3177      return this;
3178    }
3179
3180    /**
3181     * @return The workflow status of the nutrition order/request.
3182     */
3183    public NutritionOrderStatus getStatus() { 
3184      return this.status == null ? null : this.status.getValue();
3185    }
3186
3187    /**
3188     * @param value The workflow status of the nutrition order/request.
3189     */
3190    public NutritionOrder setStatus(NutritionOrderStatus value) { 
3191        if (this.status == null)
3192          this.status = new Enumeration<NutritionOrderStatus>(new NutritionOrderStatusEnumFactory());
3193        this.status.setValue(value);
3194      return this;
3195    }
3196
3197    /**
3198     * @return {@link #intent} (Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
3199     */
3200    public Enumeration<NutritiionOrderIntent> getIntentElement() { 
3201      if (this.intent == null)
3202        if (Configuration.errorOnAutoCreate())
3203          throw new Error("Attempt to auto-create NutritionOrder.intent");
3204        else if (Configuration.doAutoCreate())
3205          this.intent = new Enumeration<NutritiionOrderIntent>(new NutritiionOrderIntentEnumFactory()); // bb
3206      return this.intent;
3207    }
3208
3209    public boolean hasIntentElement() { 
3210      return this.intent != null && !this.intent.isEmpty();
3211    }
3212
3213    public boolean hasIntent() { 
3214      return this.intent != null && !this.intent.isEmpty();
3215    }
3216
3217    /**
3218     * @param value {@link #intent} (Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
3219     */
3220    public NutritionOrder setIntentElement(Enumeration<NutritiionOrderIntent> value) { 
3221      this.intent = value;
3222      return this;
3223    }
3224
3225    /**
3226     * @return Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
3227     */
3228    public NutritiionOrderIntent getIntent() { 
3229      return this.intent == null ? null : this.intent.getValue();
3230    }
3231
3232    /**
3233     * @param value Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
3234     */
3235    public NutritionOrder setIntent(NutritiionOrderIntent value) { 
3236        if (this.intent == null)
3237          this.intent = new Enumeration<NutritiionOrderIntent>(new NutritiionOrderIntentEnumFactory());
3238        this.intent.setValue(value);
3239      return this;
3240    }
3241
3242    /**
3243     * @return {@link #patient} (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
3244     */
3245    public Reference getPatient() { 
3246      if (this.patient == null)
3247        if (Configuration.errorOnAutoCreate())
3248          throw new Error("Attempt to auto-create NutritionOrder.patient");
3249        else if (Configuration.doAutoCreate())
3250          this.patient = new Reference(); // cc
3251      return this.patient;
3252    }
3253
3254    public boolean hasPatient() { 
3255      return this.patient != null && !this.patient.isEmpty();
3256    }
3257
3258    /**
3259     * @param value {@link #patient} (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
3260     */
3261    public NutritionOrder setPatient(Reference value) { 
3262      this.patient = value;
3263      return this;
3264    }
3265
3266    /**
3267     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
3268     */
3269    public Patient getPatientTarget() { 
3270      if (this.patientTarget == null)
3271        if (Configuration.errorOnAutoCreate())
3272          throw new Error("Attempt to auto-create NutritionOrder.patient");
3273        else if (Configuration.doAutoCreate())
3274          this.patientTarget = new Patient(); // aa
3275      return this.patientTarget;
3276    }
3277
3278    /**
3279     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
3280     */
3281    public NutritionOrder setPatientTarget(Patient value) { 
3282      this.patientTarget = value;
3283      return this;
3284    }
3285
3286    /**
3287     * @return {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
3288     */
3289    public Reference getEncounter() { 
3290      if (this.encounter == null)
3291        if (Configuration.errorOnAutoCreate())
3292          throw new Error("Attempt to auto-create NutritionOrder.encounter");
3293        else if (Configuration.doAutoCreate())
3294          this.encounter = new Reference(); // cc
3295      return this.encounter;
3296    }
3297
3298    public boolean hasEncounter() { 
3299      return this.encounter != null && !this.encounter.isEmpty();
3300    }
3301
3302    /**
3303     * @param value {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
3304     */
3305    public NutritionOrder setEncounter(Reference value) { 
3306      this.encounter = value;
3307      return this;
3308    }
3309
3310    /**
3311     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (An encounter that provides additional information about the healthcare context in which this request is made.)
3312     */
3313    public Encounter getEncounterTarget() { 
3314      if (this.encounterTarget == null)
3315        if (Configuration.errorOnAutoCreate())
3316          throw new Error("Attempt to auto-create NutritionOrder.encounter");
3317        else if (Configuration.doAutoCreate())
3318          this.encounterTarget = new Encounter(); // aa
3319      return this.encounterTarget;
3320    }
3321
3322    /**
3323     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (An encounter that provides additional information about the healthcare context in which this request is made.)
3324     */
3325    public NutritionOrder setEncounterTarget(Encounter value) { 
3326      this.encounterTarget = value;
3327      return this;
3328    }
3329
3330    /**
3331     * @return {@link #dateTime} (The date and time that this nutrition order was requested.). This is the underlying object with id, value and extensions. The accessor "getDateTime" gives direct access to the value
3332     */
3333    public DateTimeType getDateTimeElement() { 
3334      if (this.dateTime == null)
3335        if (Configuration.errorOnAutoCreate())
3336          throw new Error("Attempt to auto-create NutritionOrder.dateTime");
3337        else if (Configuration.doAutoCreate())
3338          this.dateTime = new DateTimeType(); // bb
3339      return this.dateTime;
3340    }
3341
3342    public boolean hasDateTimeElement() { 
3343      return this.dateTime != null && !this.dateTime.isEmpty();
3344    }
3345
3346    public boolean hasDateTime() { 
3347      return this.dateTime != null && !this.dateTime.isEmpty();
3348    }
3349
3350    /**
3351     * @param value {@link #dateTime} (The date and time that this nutrition order was requested.). This is the underlying object with id, value and extensions. The accessor "getDateTime" gives direct access to the value
3352     */
3353    public NutritionOrder setDateTimeElement(DateTimeType value) { 
3354      this.dateTime = value;
3355      return this;
3356    }
3357
3358    /**
3359     * @return The date and time that this nutrition order was requested.
3360     */
3361    public Date getDateTime() { 
3362      return this.dateTime == null ? null : this.dateTime.getValue();
3363    }
3364
3365    /**
3366     * @param value The date and time that this nutrition order was requested.
3367     */
3368    public NutritionOrder setDateTime(Date value) { 
3369        if (this.dateTime == null)
3370          this.dateTime = new DateTimeType();
3371        this.dateTime.setValue(value);
3372      return this;
3373    }
3374
3375    /**
3376     * @return {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
3377     */
3378    public Reference getOrderer() { 
3379      if (this.orderer == null)
3380        if (Configuration.errorOnAutoCreate())
3381          throw new Error("Attempt to auto-create NutritionOrder.orderer");
3382        else if (Configuration.doAutoCreate())
3383          this.orderer = new Reference(); // cc
3384      return this.orderer;
3385    }
3386
3387    public boolean hasOrderer() { 
3388      return this.orderer != null && !this.orderer.isEmpty();
3389    }
3390
3391    /**
3392     * @param value {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
3393     */
3394    public NutritionOrder setOrderer(Reference value) { 
3395      this.orderer = value;
3396      return this;
3397    }
3398
3399    /**
3400     * @return {@link #orderer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
3401     */
3402    public Resource getOrdererTarget() { 
3403      return this.ordererTarget;
3404    }
3405
3406    /**
3407     * @param value {@link #orderer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
3408     */
3409    public NutritionOrder setOrdererTarget(Resource value) { 
3410      this.ordererTarget = value;
3411      return this;
3412    }
3413
3414    /**
3415     * @return {@link #allergyIntolerance} (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
3416     */
3417    public List<Reference> getAllergyIntolerance() { 
3418      if (this.allergyIntolerance == null)
3419        this.allergyIntolerance = new ArrayList<Reference>();
3420      return this.allergyIntolerance;
3421    }
3422
3423    /**
3424     * @return Returns a reference to <code>this</code> for easy method chaining
3425     */
3426    public NutritionOrder setAllergyIntolerance(List<Reference> theAllergyIntolerance) { 
3427      this.allergyIntolerance = theAllergyIntolerance;
3428      return this;
3429    }
3430
3431    public boolean hasAllergyIntolerance() { 
3432      if (this.allergyIntolerance == null)
3433        return false;
3434      for (Reference item : this.allergyIntolerance)
3435        if (!item.isEmpty())
3436          return true;
3437      return false;
3438    }
3439
3440    public Reference addAllergyIntolerance() { //3
3441      Reference t = new Reference();
3442      if (this.allergyIntolerance == null)
3443        this.allergyIntolerance = new ArrayList<Reference>();
3444      this.allergyIntolerance.add(t);
3445      return t;
3446    }
3447
3448    public NutritionOrder addAllergyIntolerance(Reference t) { //3
3449      if (t == null)
3450        return this;
3451      if (this.allergyIntolerance == null)
3452        this.allergyIntolerance = new ArrayList<Reference>();
3453      this.allergyIntolerance.add(t);
3454      return this;
3455    }
3456
3457    /**
3458     * @return The first repetition of repeating field {@link #allergyIntolerance}, creating it if it does not already exist
3459     */
3460    public Reference getAllergyIntoleranceFirstRep() { 
3461      if (getAllergyIntolerance().isEmpty()) {
3462        addAllergyIntolerance();
3463      }
3464      return getAllergyIntolerance().get(0);
3465    }
3466
3467    /**
3468     * @deprecated Use Reference#setResource(IBaseResource) instead
3469     */
3470    @Deprecated
3471    public List<AllergyIntolerance> getAllergyIntoleranceTarget() { 
3472      if (this.allergyIntoleranceTarget == null)
3473        this.allergyIntoleranceTarget = new ArrayList<AllergyIntolerance>();
3474      return this.allergyIntoleranceTarget;
3475    }
3476
3477    /**
3478     * @deprecated Use Reference#setResource(IBaseResource) instead
3479     */
3480    @Deprecated
3481    public AllergyIntolerance addAllergyIntoleranceTarget() { 
3482      AllergyIntolerance r = new AllergyIntolerance();
3483      if (this.allergyIntoleranceTarget == null)
3484        this.allergyIntoleranceTarget = new ArrayList<AllergyIntolerance>();
3485      this.allergyIntoleranceTarget.add(r);
3486      return r;
3487    }
3488
3489    /**
3490     * @return {@link #foodPreferenceModifier} (This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.)
3491     */
3492    public List<CodeableConcept> getFoodPreferenceModifier() { 
3493      if (this.foodPreferenceModifier == null)
3494        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3495      return this.foodPreferenceModifier;
3496    }
3497
3498    /**
3499     * @return Returns a reference to <code>this</code> for easy method chaining
3500     */
3501    public NutritionOrder setFoodPreferenceModifier(List<CodeableConcept> theFoodPreferenceModifier) { 
3502      this.foodPreferenceModifier = theFoodPreferenceModifier;
3503      return this;
3504    }
3505
3506    public boolean hasFoodPreferenceModifier() { 
3507      if (this.foodPreferenceModifier == null)
3508        return false;
3509      for (CodeableConcept item : this.foodPreferenceModifier)
3510        if (!item.isEmpty())
3511          return true;
3512      return false;
3513    }
3514
3515    public CodeableConcept addFoodPreferenceModifier() { //3
3516      CodeableConcept t = new CodeableConcept();
3517      if (this.foodPreferenceModifier == null)
3518        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3519      this.foodPreferenceModifier.add(t);
3520      return t;
3521    }
3522
3523    public NutritionOrder addFoodPreferenceModifier(CodeableConcept t) { //3
3524      if (t == null)
3525        return this;
3526      if (this.foodPreferenceModifier == null)
3527        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3528      this.foodPreferenceModifier.add(t);
3529      return this;
3530    }
3531
3532    /**
3533     * @return The first repetition of repeating field {@link #foodPreferenceModifier}, creating it if it does not already exist
3534     */
3535    public CodeableConcept getFoodPreferenceModifierFirstRep() { 
3536      if (getFoodPreferenceModifier().isEmpty()) {
3537        addFoodPreferenceModifier();
3538      }
3539      return getFoodPreferenceModifier().get(0);
3540    }
3541
3542    /**
3543     * @return {@link #excludeFoodModifier} (This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.)
3544     */
3545    public List<CodeableConcept> getExcludeFoodModifier() { 
3546      if (this.excludeFoodModifier == null)
3547        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
3548      return this.excludeFoodModifier;
3549    }
3550
3551    /**
3552     * @return Returns a reference to <code>this</code> for easy method chaining
3553     */
3554    public NutritionOrder setExcludeFoodModifier(List<CodeableConcept> theExcludeFoodModifier) { 
3555      this.excludeFoodModifier = theExcludeFoodModifier;
3556      return this;
3557    }
3558
3559    public boolean hasExcludeFoodModifier() { 
3560      if (this.excludeFoodModifier == null)
3561        return false;
3562      for (CodeableConcept item : this.excludeFoodModifier)
3563        if (!item.isEmpty())
3564          return true;
3565      return false;
3566    }
3567
3568    public CodeableConcept addExcludeFoodModifier() { //3
3569      CodeableConcept t = new CodeableConcept();
3570      if (this.excludeFoodModifier == null)
3571        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
3572      this.excludeFoodModifier.add(t);
3573      return t;
3574    }
3575
3576    public NutritionOrder addExcludeFoodModifier(CodeableConcept t) { //3
3577      if (t == null)
3578        return this;
3579      if (this.excludeFoodModifier == null)
3580        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
3581      this.excludeFoodModifier.add(t);
3582      return this;
3583    }
3584
3585    /**
3586     * @return The first repetition of repeating field {@link #excludeFoodModifier}, creating it if it does not already exist
3587     */
3588    public CodeableConcept getExcludeFoodModifierFirstRep() { 
3589      if (getExcludeFoodModifier().isEmpty()) {
3590        addExcludeFoodModifier();
3591      }
3592      return getExcludeFoodModifier().get(0);
3593    }
3594
3595    /**
3596     * @return {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
3597     */
3598    public NutritionOrderOralDietComponent getOralDiet() { 
3599      if (this.oralDiet == null)
3600        if (Configuration.errorOnAutoCreate())
3601          throw new Error("Attempt to auto-create NutritionOrder.oralDiet");
3602        else if (Configuration.doAutoCreate())
3603          this.oralDiet = new NutritionOrderOralDietComponent(); // cc
3604      return this.oralDiet;
3605    }
3606
3607    public boolean hasOralDiet() { 
3608      return this.oralDiet != null && !this.oralDiet.isEmpty();
3609    }
3610
3611    /**
3612     * @param value {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
3613     */
3614    public NutritionOrder setOralDiet(NutritionOrderOralDietComponent value) { 
3615      this.oralDiet = value;
3616      return this;
3617    }
3618
3619    /**
3620     * @return {@link #supplement} (Oral nutritional products given in order to add further nutritional value to the patient's diet.)
3621     */
3622    public List<NutritionOrderSupplementComponent> getSupplement() { 
3623      if (this.supplement == null)
3624        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3625      return this.supplement;
3626    }
3627
3628    /**
3629     * @return Returns a reference to <code>this</code> for easy method chaining
3630     */
3631    public NutritionOrder setSupplement(List<NutritionOrderSupplementComponent> theSupplement) { 
3632      this.supplement = theSupplement;
3633      return this;
3634    }
3635
3636    public boolean hasSupplement() { 
3637      if (this.supplement == null)
3638        return false;
3639      for (NutritionOrderSupplementComponent item : this.supplement)
3640        if (!item.isEmpty())
3641          return true;
3642      return false;
3643    }
3644
3645    public NutritionOrderSupplementComponent addSupplement() { //3
3646      NutritionOrderSupplementComponent t = new NutritionOrderSupplementComponent();
3647      if (this.supplement == null)
3648        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3649      this.supplement.add(t);
3650      return t;
3651    }
3652
3653    public NutritionOrder addSupplement(NutritionOrderSupplementComponent t) { //3
3654      if (t == null)
3655        return this;
3656      if (this.supplement == null)
3657        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3658      this.supplement.add(t);
3659      return this;
3660    }
3661
3662    /**
3663     * @return The first repetition of repeating field {@link #supplement}, creating it if it does not already exist
3664     */
3665    public NutritionOrderSupplementComponent getSupplementFirstRep() { 
3666      if (getSupplement().isEmpty()) {
3667        addSupplement();
3668      }
3669      return getSupplement().get(0);
3670    }
3671
3672    /**
3673     * @return {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
3674     */
3675    public NutritionOrderEnteralFormulaComponent getEnteralFormula() { 
3676      if (this.enteralFormula == null)
3677        if (Configuration.errorOnAutoCreate())
3678          throw new Error("Attempt to auto-create NutritionOrder.enteralFormula");
3679        else if (Configuration.doAutoCreate())
3680          this.enteralFormula = new NutritionOrderEnteralFormulaComponent(); // cc
3681      return this.enteralFormula;
3682    }
3683
3684    public boolean hasEnteralFormula() { 
3685      return this.enteralFormula != null && !this.enteralFormula.isEmpty();
3686    }
3687
3688    /**
3689     * @param value {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
3690     */
3691    public NutritionOrder setEnteralFormula(NutritionOrderEnteralFormulaComponent value) { 
3692      this.enteralFormula = value;
3693      return this;
3694    }
3695
3696    /**
3697     * @return {@link #note} (Comments made about the {{title}} by the requester, performer, subject or other participants.)
3698     */
3699    public List<Annotation> getNote() { 
3700      if (this.note == null)
3701        this.note = new ArrayList<Annotation>();
3702      return this.note;
3703    }
3704
3705    /**
3706     * @return Returns a reference to <code>this</code> for easy method chaining
3707     */
3708    public NutritionOrder setNote(List<Annotation> theNote) { 
3709      this.note = theNote;
3710      return this;
3711    }
3712
3713    public boolean hasNote() { 
3714      if (this.note == null)
3715        return false;
3716      for (Annotation item : this.note)
3717        if (!item.isEmpty())
3718          return true;
3719      return false;
3720    }
3721
3722    public Annotation addNote() { //3
3723      Annotation t = new Annotation();
3724      if (this.note == null)
3725        this.note = new ArrayList<Annotation>();
3726      this.note.add(t);
3727      return t;
3728    }
3729
3730    public NutritionOrder addNote(Annotation t) { //3
3731      if (t == null)
3732        return this;
3733      if (this.note == null)
3734        this.note = new ArrayList<Annotation>();
3735      this.note.add(t);
3736      return this;
3737    }
3738
3739    /**
3740     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
3741     */
3742    public Annotation getNoteFirstRep() { 
3743      if (getNote().isEmpty()) {
3744        addNote();
3745      }
3746      return getNote().get(0);
3747    }
3748
3749      protected void listChildren(List<Property> children) {
3750        super.listChildren(children);
3751        children.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the order sender or by the order receiver.", 0, java.lang.Integer.MAX_VALUE, identifier));
3752        children.add(new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
3753        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
3754        children.add(new Property("instantiates", "uri", "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiates));
3755        children.add(new Property("status", "code", "The workflow status of the nutrition order/request.", 0, 1, status));
3756        children.add(new Property("intent", "code", "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.", 0, 1, intent));
3757        children.add(new Property("patient", "Reference(Patient)", "The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.", 0, 1, patient));
3758        children.add(new Property("encounter", "Reference(Encounter)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, 1, encounter));
3759        children.add(new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0, 1, dateTime));
3760        children.add(new Property("orderer", "Reference(Practitioner|PractitionerRole)", "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.", 0, 1, orderer));
3761        children.add(new Property("allergyIntolerance", "Reference(AllergyIntolerance)", "A link to a record of allergies or intolerances  which should be included in the nutrition order.", 0, java.lang.Integer.MAX_VALUE, allergyIntolerance));
3762        children.add(new Property("foodPreferenceModifier", "CodeableConcept", "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, foodPreferenceModifier));
3763        children.add(new Property("excludeFoodModifier", "CodeableConcept", "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, excludeFoodModifier));
3764        children.add(new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, 1, oralDiet));
3765        children.add(new Property("supplement", "", "Oral nutritional products given in order to add further nutritional value to the patient's diet.", 0, java.lang.Integer.MAX_VALUE, supplement));
3766        children.add(new Property("enteralFormula", "", "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.", 0, 1, enteralFormula));
3767        children.add(new Property("note", "Annotation", "Comments made about the {{title}} by the requester, performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note));
3768      }
3769
3770      @Override
3771      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3772        switch (_hash) {
3773        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers assigned to this order by the order sender or by the order receiver.", 0, java.lang.Integer.MAX_VALUE, identifier);
3774        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
3775        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
3776        case -246883639: /*instantiates*/  return new Property("instantiates", "uri", "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiates);
3777        case -892481550: /*status*/  return new Property("status", "code", "The workflow status of the nutrition order/request.", 0, 1, status);
3778        case -1183762788: /*intent*/  return new Property("intent", "code", "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.", 0, 1, intent);
3779        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.", 0, 1, patient);
3780        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, 1, encounter);
3781        case 1792749467: /*dateTime*/  return new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0, 1, dateTime);
3782        case -1207109509: /*orderer*/  return new Property("orderer", "Reference(Practitioner|PractitionerRole)", "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.", 0, 1, orderer);
3783        case -120164120: /*allergyIntolerance*/  return new Property("allergyIntolerance", "Reference(AllergyIntolerance)", "A link to a record of allergies or intolerances  which should be included in the nutrition order.", 0, java.lang.Integer.MAX_VALUE, allergyIntolerance);
3784        case 659473872: /*foodPreferenceModifier*/  return new Property("foodPreferenceModifier", "CodeableConcept", "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, foodPreferenceModifier);
3785        case 1760260175: /*excludeFoodModifier*/  return new Property("excludeFoodModifier", "CodeableConcept", "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, excludeFoodModifier);
3786        case 1153521250: /*oralDiet*/  return new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, 1, oralDiet);
3787        case -711993159: /*supplement*/  return new Property("supplement", "", "Oral nutritional products given in order to add further nutritional value to the patient's diet.", 0, java.lang.Integer.MAX_VALUE, supplement);
3788        case -671083805: /*enteralFormula*/  return new Property("enteralFormula", "", "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.", 0, 1, enteralFormula);
3789        case 3387378: /*note*/  return new Property("note", "Annotation", "Comments made about the {{title}} by the requester, performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note);
3790        default: return super.getNamedProperty(_hash, _name, _checkValid);
3791        }
3792
3793      }
3794
3795      @Override
3796      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3797        switch (hash) {
3798        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3799        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
3800        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
3801        case -246883639: /*instantiates*/ return this.instantiates == null ? new Base[0] : this.instantiates.toArray(new Base[this.instantiates.size()]); // UriType
3802        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<NutritionOrderStatus>
3803        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<NutritiionOrderIntent>
3804        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
3805        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
3806        case 1792749467: /*dateTime*/ return this.dateTime == null ? new Base[0] : new Base[] {this.dateTime}; // DateTimeType
3807        case -1207109509: /*orderer*/ return this.orderer == null ? new Base[0] : new Base[] {this.orderer}; // Reference
3808        case -120164120: /*allergyIntolerance*/ return this.allergyIntolerance == null ? new Base[0] : this.allergyIntolerance.toArray(new Base[this.allergyIntolerance.size()]); // Reference
3809        case 659473872: /*foodPreferenceModifier*/ return this.foodPreferenceModifier == null ? new Base[0] : this.foodPreferenceModifier.toArray(new Base[this.foodPreferenceModifier.size()]); // CodeableConcept
3810        case 1760260175: /*excludeFoodModifier*/ return this.excludeFoodModifier == null ? new Base[0] : this.excludeFoodModifier.toArray(new Base[this.excludeFoodModifier.size()]); // CodeableConcept
3811        case 1153521250: /*oralDiet*/ return this.oralDiet == null ? new Base[0] : new Base[] {this.oralDiet}; // NutritionOrderOralDietComponent
3812        case -711993159: /*supplement*/ return this.supplement == null ? new Base[0] : this.supplement.toArray(new Base[this.supplement.size()]); // NutritionOrderSupplementComponent
3813        case -671083805: /*enteralFormula*/ return this.enteralFormula == null ? new Base[0] : new Base[] {this.enteralFormula}; // NutritionOrderEnteralFormulaComponent
3814        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3815        default: return super.getProperty(hash, name, checkValid);
3816        }
3817
3818      }
3819
3820      @Override
3821      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3822        switch (hash) {
3823        case -1618432855: // identifier
3824          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3825          return value;
3826        case 8911915: // instantiatesCanonical
3827          this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
3828          return value;
3829        case -1926393373: // instantiatesUri
3830          this.getInstantiatesUri().add(castToUri(value)); // UriType
3831          return value;
3832        case -246883639: // instantiates
3833          this.getInstantiates().add(castToUri(value)); // UriType
3834          return value;
3835        case -892481550: // status
3836          value = new NutritionOrderStatusEnumFactory().fromType(castToCode(value));
3837          this.status = (Enumeration) value; // Enumeration<NutritionOrderStatus>
3838          return value;
3839        case -1183762788: // intent
3840          value = new NutritiionOrderIntentEnumFactory().fromType(castToCode(value));
3841          this.intent = (Enumeration) value; // Enumeration<NutritiionOrderIntent>
3842          return value;
3843        case -791418107: // patient
3844          this.patient = castToReference(value); // Reference
3845          return value;
3846        case 1524132147: // encounter
3847          this.encounter = castToReference(value); // Reference
3848          return value;
3849        case 1792749467: // dateTime
3850          this.dateTime = castToDateTime(value); // DateTimeType
3851          return value;
3852        case -1207109509: // orderer
3853          this.orderer = castToReference(value); // Reference
3854          return value;
3855        case -120164120: // allergyIntolerance
3856          this.getAllergyIntolerance().add(castToReference(value)); // Reference
3857          return value;
3858        case 659473872: // foodPreferenceModifier
3859          this.getFoodPreferenceModifier().add(castToCodeableConcept(value)); // CodeableConcept
3860          return value;
3861        case 1760260175: // excludeFoodModifier
3862          this.getExcludeFoodModifier().add(castToCodeableConcept(value)); // CodeableConcept
3863          return value;
3864        case 1153521250: // oralDiet
3865          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
3866          return value;
3867        case -711993159: // supplement
3868          this.getSupplement().add((NutritionOrderSupplementComponent) value); // NutritionOrderSupplementComponent
3869          return value;
3870        case -671083805: // enteralFormula
3871          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
3872          return value;
3873        case 3387378: // note
3874          this.getNote().add(castToAnnotation(value)); // Annotation
3875          return value;
3876        default: return super.setProperty(hash, name, value);
3877        }
3878
3879      }
3880
3881      @Override
3882      public Base setProperty(String name, Base value) throws FHIRException {
3883        if (name.equals("identifier")) {
3884          this.getIdentifier().add(castToIdentifier(value));
3885        } else if (name.equals("instantiatesCanonical")) {
3886          this.getInstantiatesCanonical().add(castToCanonical(value));
3887        } else if (name.equals("instantiatesUri")) {
3888          this.getInstantiatesUri().add(castToUri(value));
3889        } else if (name.equals("instantiates")) {
3890          this.getInstantiates().add(castToUri(value));
3891        } else if (name.equals("status")) {
3892          value = new NutritionOrderStatusEnumFactory().fromType(castToCode(value));
3893          this.status = (Enumeration) value; // Enumeration<NutritionOrderStatus>
3894        } else if (name.equals("intent")) {
3895          value = new NutritiionOrderIntentEnumFactory().fromType(castToCode(value));
3896          this.intent = (Enumeration) value; // Enumeration<NutritiionOrderIntent>
3897        } else if (name.equals("patient")) {
3898          this.patient = castToReference(value); // Reference
3899        } else if (name.equals("encounter")) {
3900          this.encounter = castToReference(value); // Reference
3901        } else if (name.equals("dateTime")) {
3902          this.dateTime = castToDateTime(value); // DateTimeType
3903        } else if (name.equals("orderer")) {
3904          this.orderer = castToReference(value); // Reference
3905        } else if (name.equals("allergyIntolerance")) {
3906          this.getAllergyIntolerance().add(castToReference(value));
3907        } else if (name.equals("foodPreferenceModifier")) {
3908          this.getFoodPreferenceModifier().add(castToCodeableConcept(value));
3909        } else if (name.equals("excludeFoodModifier")) {
3910          this.getExcludeFoodModifier().add(castToCodeableConcept(value));
3911        } else if (name.equals("oralDiet")) {
3912          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
3913        } else if (name.equals("supplement")) {
3914          this.getSupplement().add((NutritionOrderSupplementComponent) value);
3915        } else if (name.equals("enteralFormula")) {
3916          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
3917        } else if (name.equals("note")) {
3918          this.getNote().add(castToAnnotation(value));
3919        } else
3920          return super.setProperty(name, value);
3921        return value;
3922      }
3923
3924      @Override
3925      public Base makeProperty(int hash, String name) throws FHIRException {
3926        switch (hash) {
3927        case -1618432855:  return addIdentifier(); 
3928        case 8911915:  return addInstantiatesCanonicalElement();
3929        case -1926393373:  return addInstantiatesUriElement();
3930        case -246883639:  return addInstantiatesElement();
3931        case -892481550:  return getStatusElement();
3932        case -1183762788:  return getIntentElement();
3933        case -791418107:  return getPatient(); 
3934        case 1524132147:  return getEncounter(); 
3935        case 1792749467:  return getDateTimeElement();
3936        case -1207109509:  return getOrderer(); 
3937        case -120164120:  return addAllergyIntolerance(); 
3938        case 659473872:  return addFoodPreferenceModifier(); 
3939        case 1760260175:  return addExcludeFoodModifier(); 
3940        case 1153521250:  return getOralDiet(); 
3941        case -711993159:  return addSupplement(); 
3942        case -671083805:  return getEnteralFormula(); 
3943        case 3387378:  return addNote(); 
3944        default: return super.makeProperty(hash, name);
3945        }
3946
3947      }
3948
3949      @Override
3950      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3951        switch (hash) {
3952        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3953        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
3954        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
3955        case -246883639: /*instantiates*/ return new String[] {"uri"};
3956        case -892481550: /*status*/ return new String[] {"code"};
3957        case -1183762788: /*intent*/ return new String[] {"code"};
3958        case -791418107: /*patient*/ return new String[] {"Reference"};
3959        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3960        case 1792749467: /*dateTime*/ return new String[] {"dateTime"};
3961        case -1207109509: /*orderer*/ return new String[] {"Reference"};
3962        case -120164120: /*allergyIntolerance*/ return new String[] {"Reference"};
3963        case 659473872: /*foodPreferenceModifier*/ return new String[] {"CodeableConcept"};
3964        case 1760260175: /*excludeFoodModifier*/ return new String[] {"CodeableConcept"};
3965        case 1153521250: /*oralDiet*/ return new String[] {};
3966        case -711993159: /*supplement*/ return new String[] {};
3967        case -671083805: /*enteralFormula*/ return new String[] {};
3968        case 3387378: /*note*/ return new String[] {"Annotation"};
3969        default: return super.getTypesForProperty(hash, name);
3970        }
3971
3972      }
3973
3974      @Override
3975      public Base addChild(String name) throws FHIRException {
3976        if (name.equals("identifier")) {
3977          return addIdentifier();
3978        }
3979        else if (name.equals("instantiatesCanonical")) {
3980          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiatesCanonical");
3981        }
3982        else if (name.equals("instantiatesUri")) {
3983          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiatesUri");
3984        }
3985        else if (name.equals("instantiates")) {
3986          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiates");
3987        }
3988        else if (name.equals("status")) {
3989          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.status");
3990        }
3991        else if (name.equals("intent")) {
3992          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.intent");
3993        }
3994        else if (name.equals("patient")) {
3995          this.patient = new Reference();
3996          return this.patient;
3997        }
3998        else if (name.equals("encounter")) {
3999          this.encounter = new Reference();
4000          return this.encounter;
4001        }
4002        else if (name.equals("dateTime")) {
4003          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.dateTime");
4004        }
4005        else if (name.equals("orderer")) {
4006          this.orderer = new Reference();
4007          return this.orderer;
4008        }
4009        else if (name.equals("allergyIntolerance")) {
4010          return addAllergyIntolerance();
4011        }
4012        else if (name.equals("foodPreferenceModifier")) {
4013          return addFoodPreferenceModifier();
4014        }
4015        else if (name.equals("excludeFoodModifier")) {
4016          return addExcludeFoodModifier();
4017        }
4018        else if (name.equals("oralDiet")) {
4019          this.oralDiet = new NutritionOrderOralDietComponent();
4020          return this.oralDiet;
4021        }
4022        else if (name.equals("supplement")) {
4023          return addSupplement();
4024        }
4025        else if (name.equals("enteralFormula")) {
4026          this.enteralFormula = new NutritionOrderEnteralFormulaComponent();
4027          return this.enteralFormula;
4028        }
4029        else if (name.equals("note")) {
4030          return addNote();
4031        }
4032        else
4033          return super.addChild(name);
4034      }
4035
4036  public String fhirType() {
4037    return "NutritionOrder";
4038
4039  }
4040
4041      public NutritionOrder copy() {
4042        NutritionOrder dst = new NutritionOrder();
4043        copyValues(dst);
4044        return dst;
4045      }
4046
4047      public void copyValues(NutritionOrder dst) {
4048        super.copyValues(dst);
4049        if (identifier != null) {
4050          dst.identifier = new ArrayList<Identifier>();
4051          for (Identifier i : identifier)
4052            dst.identifier.add(i.copy());
4053        };
4054        if (instantiatesCanonical != null) {
4055          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
4056          for (CanonicalType i : instantiatesCanonical)
4057            dst.instantiatesCanonical.add(i.copy());
4058        };
4059        if (instantiatesUri != null) {
4060          dst.instantiatesUri = new ArrayList<UriType>();
4061          for (UriType i : instantiatesUri)
4062            dst.instantiatesUri.add(i.copy());
4063        };
4064        if (instantiates != null) {
4065          dst.instantiates = new ArrayList<UriType>();
4066          for (UriType i : instantiates)
4067            dst.instantiates.add(i.copy());
4068        };
4069        dst.status = status == null ? null : status.copy();
4070        dst.intent = intent == null ? null : intent.copy();
4071        dst.patient = patient == null ? null : patient.copy();
4072        dst.encounter = encounter == null ? null : encounter.copy();
4073        dst.dateTime = dateTime == null ? null : dateTime.copy();
4074        dst.orderer = orderer == null ? null : orderer.copy();
4075        if (allergyIntolerance != null) {
4076          dst.allergyIntolerance = new ArrayList<Reference>();
4077          for (Reference i : allergyIntolerance)
4078            dst.allergyIntolerance.add(i.copy());
4079        };
4080        if (foodPreferenceModifier != null) {
4081          dst.foodPreferenceModifier = new ArrayList<CodeableConcept>();
4082          for (CodeableConcept i : foodPreferenceModifier)
4083            dst.foodPreferenceModifier.add(i.copy());
4084        };
4085        if (excludeFoodModifier != null) {
4086          dst.excludeFoodModifier = new ArrayList<CodeableConcept>();
4087          for (CodeableConcept i : excludeFoodModifier)
4088            dst.excludeFoodModifier.add(i.copy());
4089        };
4090        dst.oralDiet = oralDiet == null ? null : oralDiet.copy();
4091        if (supplement != null) {
4092          dst.supplement = new ArrayList<NutritionOrderSupplementComponent>();
4093          for (NutritionOrderSupplementComponent i : supplement)
4094            dst.supplement.add(i.copy());
4095        };
4096        dst.enteralFormula = enteralFormula == null ? null : enteralFormula.copy();
4097        if (note != null) {
4098          dst.note = new ArrayList<Annotation>();
4099          for (Annotation i : note)
4100            dst.note.add(i.copy());
4101        };
4102      }
4103
4104      protected NutritionOrder typedCopy() {
4105        return copy();
4106      }
4107
4108      @Override
4109      public boolean equalsDeep(Base other_) {
4110        if (!super.equalsDeep(other_))
4111          return false;
4112        if (!(other_ instanceof NutritionOrder))
4113          return false;
4114        NutritionOrder o = (NutritionOrder) other_;
4115        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
4116           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(instantiates, o.instantiates, true)
4117           && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true) && compareDeep(patient, o.patient, true)
4118           && compareDeep(encounter, o.encounter, true) && compareDeep(dateTime, o.dateTime, true) && compareDeep(orderer, o.orderer, true)
4119           && compareDeep(allergyIntolerance, o.allergyIntolerance, true) && compareDeep(foodPreferenceModifier, o.foodPreferenceModifier, true)
4120           && compareDeep(excludeFoodModifier, o.excludeFoodModifier, true) && compareDeep(oralDiet, o.oralDiet, true)
4121           && compareDeep(supplement, o.supplement, true) && compareDeep(enteralFormula, o.enteralFormula, true)
4122           && compareDeep(note, o.note, true);
4123      }
4124
4125      @Override
4126      public boolean equalsShallow(Base other_) {
4127        if (!super.equalsShallow(other_))
4128          return false;
4129        if (!(other_ instanceof NutritionOrder))
4130          return false;
4131        NutritionOrder o = (NutritionOrder) other_;
4132        return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(instantiates, o.instantiates, true)
4133           && compareValues(status, o.status, true) && compareValues(intent, o.intent, true) && compareValues(dateTime, o.dateTime, true)
4134          ;
4135      }
4136
4137      public boolean isEmpty() {
4138        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
4139          , instantiatesUri, instantiates, status, intent, patient, encounter, dateTime
4140          , orderer, allergyIntolerance, foodPreferenceModifier, excludeFoodModifier, oralDiet
4141          , supplement, enteralFormula, note);
4142      }
4143
4144  @Override
4145  public ResourceType getResourceType() {
4146    return ResourceType.NutritionOrder;
4147   }
4148
4149 /**
4150   * Search parameter: <b>identifier</b>
4151   * <p>
4152   * Description: <b>Return nutrition orders with this external identifier</b><br>
4153   * Type: <b>token</b><br>
4154   * Path: <b>NutritionOrder.identifier</b><br>
4155   * </p>
4156   */
4157  @SearchParamDefinition(name="identifier", path="NutritionOrder.identifier", description="Return nutrition orders with this external identifier", type="token" )
4158  public static final String SP_IDENTIFIER = "identifier";
4159 /**
4160   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4161   * <p>
4162   * Description: <b>Return nutrition orders with this external identifier</b><br>
4163   * Type: <b>token</b><br>
4164   * Path: <b>NutritionOrder.identifier</b><br>
4165   * </p>
4166   */
4167  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4168
4169 /**
4170   * Search parameter: <b>datetime</b>
4171   * <p>
4172   * Description: <b>Return nutrition orders requested on this date</b><br>
4173   * Type: <b>date</b><br>
4174   * Path: <b>NutritionOrder.dateTime</b><br>
4175   * </p>
4176   */
4177  @SearchParamDefinition(name="datetime", path="NutritionOrder.dateTime", description="Return nutrition orders requested on this date", type="date" )
4178  public static final String SP_DATETIME = "datetime";
4179 /**
4180   * <b>Fluent Client</b> search parameter constant for <b>datetime</b>
4181   * <p>
4182   * Description: <b>Return nutrition orders requested on this date</b><br>
4183   * Type: <b>date</b><br>
4184   * Path: <b>NutritionOrder.dateTime</b><br>
4185   * </p>
4186   */
4187  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATETIME = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATETIME);
4188
4189 /**
4190   * Search parameter: <b>provider</b>
4191   * <p>
4192   * Description: <b>The identity of the provider who placed the nutrition order</b><br>
4193   * Type: <b>reference</b><br>
4194   * Path: <b>NutritionOrder.orderer</b><br>
4195   * </p>
4196   */
4197  @SearchParamDefinition(name="provider", path="NutritionOrder.orderer", description="The identity of the provider who placed the nutrition order", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class, PractitionerRole.class } )
4198  public static final String SP_PROVIDER = "provider";
4199 /**
4200   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
4201   * <p>
4202   * Description: <b>The identity of the provider who placed the nutrition order</b><br>
4203   * Type: <b>reference</b><br>
4204   * Path: <b>NutritionOrder.orderer</b><br>
4205   * </p>
4206   */
4207  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
4208
4209/**
4210   * Constant for fluent queries to be used to add include statements. Specifies
4211   * the path value of "<b>NutritionOrder:provider</b>".
4212   */
4213  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("NutritionOrder:provider").toLocked();
4214
4215 /**
4216   * Search parameter: <b>patient</b>
4217   * <p>
4218   * Description: <b>The identity of the person who requires the diet, formula or nutritional supplement</b><br>
4219   * Type: <b>reference</b><br>
4220   * Path: <b>NutritionOrder.patient</b><br>
4221   * </p>
4222   */
4223  @SearchParamDefinition(name="patient", path="NutritionOrder.patient", description="The identity of the person who requires the diet, formula or nutritional supplement", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
4224  public static final String SP_PATIENT = "patient";
4225 /**
4226   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4227   * <p>
4228   * Description: <b>The identity of the person who requires the diet, formula or nutritional supplement</b><br>
4229   * Type: <b>reference</b><br>
4230   * Path: <b>NutritionOrder.patient</b><br>
4231   * </p>
4232   */
4233  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4234
4235/**
4236   * Constant for fluent queries to be used to add include statements. Specifies
4237   * the path value of "<b>NutritionOrder:patient</b>".
4238   */
4239  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("NutritionOrder:patient").toLocked();
4240
4241 /**
4242   * Search parameter: <b>supplement</b>
4243   * <p>
4244   * Description: <b>Type of supplement product requested</b><br>
4245   * Type: <b>token</b><br>
4246   * Path: <b>NutritionOrder.supplement.type</b><br>
4247   * </p>
4248   */
4249  @SearchParamDefinition(name="supplement", path="NutritionOrder.supplement.type", description="Type of supplement product requested", type="token" )
4250  public static final String SP_SUPPLEMENT = "supplement";
4251 /**
4252   * <b>Fluent Client</b> search parameter constant for <b>supplement</b>
4253   * <p>
4254   * Description: <b>Type of supplement product requested</b><br>
4255   * Type: <b>token</b><br>
4256   * Path: <b>NutritionOrder.supplement.type</b><br>
4257   * </p>
4258   */
4259  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUPPLEMENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUPPLEMENT);
4260
4261 /**
4262   * Search parameter: <b>formula</b>
4263   * <p>
4264   * Description: <b>Type of enteral or infant formula</b><br>
4265   * Type: <b>token</b><br>
4266   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
4267   * </p>
4268   */
4269  @SearchParamDefinition(name="formula", path="NutritionOrder.enteralFormula.baseFormulaType", description="Type of enteral or infant formula", type="token" )
4270  public static final String SP_FORMULA = "formula";
4271 /**
4272   * <b>Fluent Client</b> search parameter constant for <b>formula</b>
4273   * <p>
4274   * Description: <b>Type of enteral or infant formula</b><br>
4275   * Type: <b>token</b><br>
4276   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
4277   * </p>
4278   */
4279  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORMULA = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FORMULA);
4280
4281 /**
4282   * Search parameter: <b>instantiates-canonical</b>
4283   * <p>
4284   * Description: <b>Instantiates FHIR protocol or definition</b><br>
4285   * Type: <b>reference</b><br>
4286   * Path: <b>NutritionOrder.instantiatesCanonical</b><br>
4287   * </p>
4288   */
4289  @SearchParamDefinition(name="instantiates-canonical", path="NutritionOrder.instantiatesCanonical", description="Instantiates FHIR protocol or definition", type="reference", target={ActivityDefinition.class, PlanDefinition.class } )
4290  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
4291 /**
4292   * <b>Fluent Client</b> search parameter constant for <b>instantiates-canonical</b>
4293   * <p>
4294   * Description: <b>Instantiates FHIR protocol or definition</b><br>
4295   * Type: <b>reference</b><br>
4296   * Path: <b>NutritionOrder.instantiatesCanonical</b><br>
4297   * </p>
4298   */
4299  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSTANTIATES_CANONICAL);
4300
4301/**
4302   * Constant for fluent queries to be used to add include statements. Specifies
4303   * the path value of "<b>NutritionOrder:instantiates-canonical</b>".
4304   */
4305  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include("NutritionOrder:instantiates-canonical").toLocked();
4306
4307 /**
4308   * Search parameter: <b>instantiates-uri</b>
4309   * <p>
4310   * Description: <b>Instantiates external protocol or definition</b><br>
4311   * Type: <b>uri</b><br>
4312   * Path: <b>NutritionOrder.instantiatesUri</b><br>
4313   * </p>
4314   */
4315  @SearchParamDefinition(name="instantiates-uri", path="NutritionOrder.instantiatesUri", description="Instantiates external protocol or definition", type="uri" )
4316  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
4317 /**
4318   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
4319   * <p>
4320   * Description: <b>Instantiates external protocol or definition</b><br>
4321   * Type: <b>uri</b><br>
4322   * Path: <b>NutritionOrder.instantiatesUri</b><br>
4323   * </p>
4324   */
4325  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES_URI);
4326
4327 /**
4328   * Search parameter: <b>encounter</b>
4329   * <p>
4330   * Description: <b>Return nutrition orders with this encounter identifier</b><br>
4331   * Type: <b>reference</b><br>
4332   * Path: <b>NutritionOrder.encounter</b><br>
4333   * </p>
4334   */
4335  @SearchParamDefinition(name="encounter", path="NutritionOrder.encounter", description="Return nutrition orders with this encounter identifier", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
4336  public static final String SP_ENCOUNTER = "encounter";
4337 /**
4338   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
4339   * <p>
4340   * Description: <b>Return nutrition orders with this encounter identifier</b><br>
4341   * Type: <b>reference</b><br>
4342   * Path: <b>NutritionOrder.encounter</b><br>
4343   * </p>
4344   */
4345  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
4346
4347/**
4348   * Constant for fluent queries to be used to add include statements. Specifies
4349   * the path value of "<b>NutritionOrder:encounter</b>".
4350   */
4351  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("NutritionOrder:encounter").toLocked();
4352
4353 /**
4354   * Search parameter: <b>oraldiet</b>
4355   * <p>
4356   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
4357   * Type: <b>token</b><br>
4358   * Path: <b>NutritionOrder.oralDiet.type</b><br>
4359   * </p>
4360   */
4361  @SearchParamDefinition(name="oraldiet", path="NutritionOrder.oralDiet.type", description="Type of diet that can be consumed orally (i.e., take via the mouth).", type="token" )
4362  public static final String SP_ORALDIET = "oraldiet";
4363 /**
4364   * <b>Fluent Client</b> search parameter constant for <b>oraldiet</b>
4365   * <p>
4366   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
4367   * Type: <b>token</b><br>
4368   * Path: <b>NutritionOrder.oralDiet.type</b><br>
4369   * </p>
4370   */
4371  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ORALDIET = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ORALDIET);
4372
4373 /**
4374   * Search parameter: <b>status</b>
4375   * <p>
4376   * Description: <b>Status of the nutrition order.</b><br>
4377   * Type: <b>token</b><br>
4378   * Path: <b>NutritionOrder.status</b><br>
4379   * </p>
4380   */
4381  @SearchParamDefinition(name="status", path="NutritionOrder.status", description="Status of the nutrition order.", type="token" )
4382  public static final String SP_STATUS = "status";
4383 /**
4384   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4385   * <p>
4386   * Description: <b>Status of the nutrition order.</b><br>
4387   * Type: <b>token</b><br>
4388   * Path: <b>NutritionOrder.status</b><br>
4389   * </p>
4390   */
4391  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4392
4393 /**
4394   * Search parameter: <b>additive</b>
4395   * <p>
4396   * Description: <b>Type of module component to add to the feeding</b><br>
4397   * Type: <b>token</b><br>
4398   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
4399   * </p>
4400   */
4401  @SearchParamDefinition(name="additive", path="NutritionOrder.enteralFormula.additiveType", description="Type of module component to add to the feeding", type="token" )
4402  public static final String SP_ADDITIVE = "additive";
4403 /**
4404   * <b>Fluent Client</b> search parameter constant for <b>additive</b>
4405   * <p>
4406   * Description: <b>Type of module component to add to the feeding</b><br>
4407   * Type: <b>token</b><br>
4408   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
4409   * </p>
4410   */
4411  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDITIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDITIVE);
4412
4413
4414}