
001package org.hl7.fhir.r5.openehr; 002 003 004/* 005 Copyright (c) 2011+, HL7, Inc. 006 All rights reserved. 007 008 Redistribution and use in source and binary forms, with or without modification, \ 009 are permitted provided that the following conditions are met: 010 011 * Redistributions of source code must retain the above copyright notice, this \ 012 list of conditions and the following disclaimer. 013 * Redistributions in binary form must reproduce the above copyright notice, \ 014 this list of conditions and the following disclaimer in the documentation \ 015 and/or other materials provided with the distribution. 016 * Neither the name of HL7 nor the names of its contributors may be used to 017 endorse or promote products derived from this software without specific 018 prior written permission. 019 020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 021 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 022 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 023 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 027 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 029 POSSIBILITY OF SUCH DAMAGE. 030 */ 031 032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0 033 034import java.util.ArrayList; 035import java.util.Date; 036import java.util.List; 037import org.hl7.fhir.r5.openehr.Enumerations.*; 038import org.hl7.fhir.exceptions.FHIRException; 039import org.hl7.fhir.r5.model.*; 040import org.hl7.fhir.instance.model.api.ICompositeType; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.ChildOrder; 043import ca.uhn.fhir.model.api.annotation.DatatypeDef; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.Block; 046 047/** 048 * Defines a single interval event in a series. 049 */ 050@DatatypeDef(name="INTERVAL_EVENT") 051public class INTERVAL_EVENT extends EVENT implements ICompositeType { 052 053 /** 054 * Duration of the time interval during which the values recorded under data are true and, if set, the values recorded under state are true. Void if an instantaneous event. 055 */ 056 @Child(name = "width", type = {DV_DURATION.class}, order=0, min=1, max=1, modifier=false, summary=false) 057 @Description(shortDefinition="Duration of the time interval during which the values recorded under data are true", formalDefinition="Duration of the time interval during which the values recorded under data are true and, if set, the values recorded under state are true. Void if an instantaneous event." ) 058 protected DV_DURATION width; 059 060 /** 061 * Optional count of original samples to which this event corresponds. 062 */ 063 @Child(name = "sample_count", type = {IntegerType.class}, order=1, min=0, max=1, modifier=false, summary=false) 064 @Description(shortDefinition="Optional count of original samples to which this event corresponds", formalDefinition="Optional count of original samples to which this event corresponds." ) 065 protected IntegerType sample_count; 066 067 /** 068 * Mathematical function of the data of this event, e.g. maximum, mean etc. Coded using openEHR vocabulary event math function. Default value 640|actual|, meaning 'actual value'. 069 */ 070 @Child(name = "math_function", type = {DV_CODED_TEXT.class}, order=2, min=1, max=1, modifier=false, summary=false) 071 @Description(shortDefinition="Mathematical function of the data of this event", formalDefinition="Mathematical function of the data of this event, e.g. maximum, mean etc. Coded using openEHR vocabulary event math function. Default value 640|actual|, meaning 'actual value'." ) 072 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="https://specifications.openehr.org/fhir/valueset-event_math_function") 073 protected DV_CODED_TEXT math_function; 074 075 private static final long serialVersionUID = 1763307354L; 076 077 /** 078 * Constructor 079 */ 080 public INTERVAL_EVENT() { 081 super(); 082 } 083 084 /** 085 * Constructor 086 */ 087 public INTERVAL_EVENT(DV_DURATION width, DV_CODED_TEXT math_function) { 088 super(); 089 this.setWidth(width); 090 this.setMath_function(math_function); 091 } 092 093 /** 094 * @return {@link #width} (Duration of the time interval during which the values recorded under data are true and, if set, the values recorded under state are true. Void if an instantaneous event.) 095 */ 096 public DV_DURATION getWidth() { 097 if (this.width == null) 098 if (Configuration.errorOnAutoCreate()) 099 throw new Error("Attempt to auto-create INTERVAL_EVENT.width"); 100 else if (Configuration.doAutoCreate()) 101 this.width = new DV_DURATION(); // cc 102 return this.width; 103 } 104 105 public boolean hasWidth() { 106 return this.width != null && !this.width.isEmpty(); 107 } 108 109 /** 110 * @param value {@link #width} (Duration of the time interval during which the values recorded under data are true and, if set, the values recorded under state are true. Void if an instantaneous event.) 111 */ 112 public INTERVAL_EVENT setWidth(DV_DURATION value) { 113 this.width = value; 114 return this; 115 } 116 117 /** 118 * @return {@link #sample_count} (Optional count of original samples to which this event corresponds.). This is the underlying object with id, value and extensions. The accessor "getSample_count" gives direct access to the value 119 */ 120 public IntegerType getSample_countElement() { 121 if (this.sample_count == null) 122 if (Configuration.errorOnAutoCreate()) 123 throw new Error("Attempt to auto-create INTERVAL_EVENT.sample_count"); 124 else if (Configuration.doAutoCreate()) 125 this.sample_count = new IntegerType(); // bb 126 return this.sample_count; 127 } 128 129 public boolean hasSample_countElement() { 130 return this.sample_count != null && !this.sample_count.isEmpty(); 131 } 132 133 public boolean hasSample_count() { 134 return this.sample_count != null && !this.sample_count.isEmpty(); 135 } 136 137 /** 138 * @param value {@link #sample_count} (Optional count of original samples to which this event corresponds.). This is the underlying object with id, value and extensions. The accessor "getSample_count" gives direct access to the value 139 */ 140 public INTERVAL_EVENT setSample_countElement(IntegerType value) { 141 this.sample_count = value; 142 return this; 143 } 144 145 /** 146 * @return Optional count of original samples to which this event corresponds. 147 */ 148 public int getSample_count() { 149 return this.sample_count == null || this.sample_count.isEmpty() ? 0 : this.sample_count.getValue(); 150 } 151 152 /** 153 * @param value Optional count of original samples to which this event corresponds. 154 */ 155 public INTERVAL_EVENT setSample_count(int value) { 156 if (this.sample_count == null) 157 this.sample_count = new IntegerType(); 158 this.sample_count.setValue(value); 159 return this; 160 } 161 162 /** 163 * @return {@link #math_function} (Mathematical function of the data of this event, e.g. maximum, mean etc. Coded using openEHR vocabulary event math function. Default value 640|actual|, meaning 'actual value'.) 164 */ 165 public DV_CODED_TEXT getMath_function() { 166 if (this.math_function == null) 167 if (Configuration.errorOnAutoCreate()) 168 throw new Error("Attempt to auto-create INTERVAL_EVENT.math_function"); 169 else if (Configuration.doAutoCreate()) 170 this.math_function = new DV_CODED_TEXT(); // cc 171 return this.math_function; 172 } 173 174 public boolean hasMath_function() { 175 return this.math_function != null && !this.math_function.isEmpty(); 176 } 177 178 /** 179 * @param value {@link #math_function} (Mathematical function of the data of this event, e.g. maximum, mean etc. Coded using openEHR vocabulary event math function. Default value 640|actual|, meaning 'actual value'.) 180 */ 181 public INTERVAL_EVENT setMath_function(DV_CODED_TEXT value) { 182 this.math_function = value; 183 return this; 184 } 185 186 protected void listChildren(List<Property> children) { 187 super.listChildren(children); 188 children.add(new Property("width", "http://openehr.org/fhir/StructureDefinition/DV-DURATION", "Duration of the time interval during which the values recorded under data are true and, if set, the values recorded under state are true. Void if an instantaneous event.", 0, 1, width)); 189 children.add(new Property("sample_count", "integer", "Optional count of original samples to which this event corresponds.", 0, 1, sample_count)); 190 children.add(new Property("math_function", "http://openehr.org/fhir/StructureDefinition/DV-CODED-TEXT", "Mathematical function of the data of this event, e.g. maximum, mean etc. Coded using openEHR vocabulary event math function. Default value 640|actual|, meaning 'actual value'.", 0, 1, math_function)); 191 } 192 193 @Override 194 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 195 switch (_hash) { 196 case 113126854: /*width*/ return new Property("width", "http://openehr.org/fhir/StructureDefinition/DV-DURATION", "Duration of the time interval during which the values recorded under data are true and, if set, the values recorded under state are true. Void if an instantaneous event.", 0, 1, width); 197 case 440582714: /*sample_count*/ return new Property("sample_count", "integer", "Optional count of original samples to which this event corresponds.", 0, 1, sample_count); 198 case -2059073745: /*math_function*/ return new Property("math_function", "http://openehr.org/fhir/StructureDefinition/DV-CODED-TEXT", "Mathematical function of the data of this event, e.g. maximum, mean etc. Coded using openEHR vocabulary event math function. Default value 640|actual|, meaning 'actual value'.", 0, 1, math_function); 199 default: return super.getNamedProperty(_hash, _name, _checkValid); 200 } 201 202 } 203 204 @Override 205 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 206 switch (hash) { 207 case 113126854: /*width*/ return this.width == null ? new Base[0] : new Base[] {this.width}; // DV_DURATION 208 case 440582714: /*sample_count*/ return this.sample_count == null ? new Base[0] : new Base[] {this.sample_count}; // IntegerType 209 case -2059073745: /*math_function*/ return this.math_function == null ? new Base[0] : new Base[] {this.math_function}; // DV_CODED_TEXT 210 default: return super.getProperty(hash, name, checkValid); 211 } 212 213 } 214 215 @Override 216 public Base setProperty(int hash, String name, Base value) throws FHIRException { 217 switch (hash) { 218 case 113126854: // width 219 this.width = (DV_DURATION) value; // DV_DURATION 220 return value; 221 case 440582714: // sample_count 222 this.sample_count = TypeConvertor.castToInteger(value); // IntegerType 223 return value; 224 case -2059073745: // math_function 225 this.math_function = (DV_CODED_TEXT) value; // DV_CODED_TEXT 226 return value; 227 default: return super.setProperty(hash, name, value); 228 } 229 230 } 231 232 @Override 233 public Base setProperty(String name, Base value) throws FHIRException { 234 if (name.equals("width")) { 235 this.width = (DV_DURATION) value; // DV_DURATION 236 } else if (name.equals("sample_count")) { 237 this.sample_count = TypeConvertor.castToInteger(value); // IntegerType 238 } else if (name.equals("math_function")) { 239 this.math_function = (DV_CODED_TEXT) value; // DV_CODED_TEXT 240 } else 241 return super.setProperty(name, value); 242 return value; 243 } 244 245 @Override 246 public Base makeProperty(int hash, String name) throws FHIRException { 247 switch (hash) { 248 case 113126854: return getWidth(); 249 case 440582714: return getSample_countElement(); 250 case -2059073745: return getMath_function(); 251 default: return super.makeProperty(hash, name); 252 } 253 254 } 255 256 @Override 257 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 258 switch (hash) { 259 case 113126854: /*width*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-DURATION"}; 260 case 440582714: /*sample_count*/ return new String[] {"integer"}; 261 case -2059073745: /*math_function*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-CODED-TEXT"}; 262 default: return super.getTypesForProperty(hash, name); 263 } 264 265 } 266 267 @Override 268 public Base addChild(String name) throws FHIRException { 269 if (name.equals("width")) { 270 this.width = new DV_DURATION(); 271 return this.width; 272 } 273 else if (name.equals("sample_count")) { 274 throw new FHIRException("Cannot call addChild on a singleton property INTERVAL_EVENT.sample_count"); 275 } 276 else if (name.equals("math_function")) { 277 this.math_function = new DV_CODED_TEXT(); 278 return this.math_function; 279 } 280 else 281 return super.addChild(name); 282 } 283 284 public String fhirType() { 285 return "INTERVAL_EVENT"; 286 287 } 288 289 public INTERVAL_EVENT copy() { 290 INTERVAL_EVENT dst = new INTERVAL_EVENT(); 291 copyValues(dst); 292 return dst; 293 } 294 295 public void copyValues(INTERVAL_EVENT dst) { 296 super.copyValues(dst); 297 dst.width = width == null ? null : width.copy(); 298 dst.sample_count = sample_count == null ? null : sample_count.copy(); 299 dst.math_function = math_function == null ? null : math_function.copy(); 300 } 301 302 protected INTERVAL_EVENT typedCopy() { 303 return copy(); 304 } 305 306 @Override 307 public boolean equalsDeep(Base other_) { 308 if (!super.equalsDeep(other_)) 309 return false; 310 if (!(other_ instanceof INTERVAL_EVENT)) 311 return false; 312 INTERVAL_EVENT o = (INTERVAL_EVENT) other_; 313 return compareDeep(width, o.width, true) && compareDeep(sample_count, o.sample_count, true) && compareDeep(math_function, o.math_function, true) 314 ; 315 } 316 317 @Override 318 public boolean equalsShallow(Base other_) { 319 if (!super.equalsShallow(other_)) 320 return false; 321 if (!(other_ instanceof INTERVAL_EVENT)) 322 return false; 323 INTERVAL_EVENT o = (INTERVAL_EVENT) other_; 324 return compareValues(sample_count, o.sample_count, true); 325 } 326 327 public boolean isEmpty() { 328 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(width, sample_count, math_function 329 ); 330 } 331 332 333} 334