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