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