
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 java.math.*; 038import org.hl7.fhir.utilities.Utilities; 039import org.hl7.fhir.r5.openehr.Enumerations.*; 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.r5.model.*; 042import org.hl7.fhir.instance.model.api.ICompositeType; 043import ca.uhn.fhir.model.api.annotation.Child; 044import ca.uhn.fhir.model.api.annotation.ChildOrder; 045import ca.uhn.fhir.model.api.annotation.DatatypeDef; 046import ca.uhn.fhir.model.api.annotation.Description; 047import ca.uhn.fhir.model.api.annotation.Block; 048 049/** 050 * 051 */ 052@DatatypeDef(name="WebTemplateInputValidationRange") 053public class WebTemplateInputValidationRange extends LogicalBase implements ICompositeType { 054 055 /** 056 * 057 */ 058 @Child(name = "minOp", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=false) 059 @Description(shortDefinition="todo", formalDefinition="" ) 060 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="https://specifications.openehr.org/fhir/valueset-range-minop") 061 protected CodeType minOp; 062 063 /** 064 * 065 */ 066 @Child(name = "min", type = {DecimalType.class}, order=1, min=1, max=1, modifier=false, summary=false) 067 @Description(shortDefinition="todo", formalDefinition="" ) 068 protected DecimalType min; 069 070 /** 071 * 072 */ 073 @Child(name = "maxOp", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false) 074 @Description(shortDefinition="todo", formalDefinition="" ) 075 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="https://specifications.openehr.org/fhir/valueset-range-maxop") 076 protected CodeType maxOp; 077 078 /** 079 * 080 */ 081 @Child(name = "max", type = {DecimalType.class}, order=3, min=1, max=1, modifier=false, summary=false) 082 @Description(shortDefinition="todo", formalDefinition="" ) 083 protected DecimalType max; 084 085 private static final long serialVersionUID = 42305724L; 086 087 /** 088 * Constructor 089 */ 090 public WebTemplateInputValidationRange() { 091 super(); 092 } 093 094 /** 095 * Constructor 096 */ 097 public WebTemplateInputValidationRange(String minOp, BigDecimal min, String maxOp, BigDecimal max) { 098 super(); 099 this.setMinOp(minOp); 100 this.setMin(min); 101 this.setMaxOp(maxOp); 102 this.setMax(max); 103 } 104 105 /** 106 * @return {@link #minOp} (). This is the underlying object with id, value and extensions. The accessor "getMinOp" gives direct access to the value 107 */ 108 public CodeType getMinOpElement() { 109 if (this.minOp == null) 110 if (Configuration.errorOnAutoCreate()) 111 throw new Error("Attempt to auto-create WebTemplateInputValidationRange.minOp"); 112 else if (Configuration.doAutoCreate()) 113 this.minOp = new CodeType(); // bb 114 return this.minOp; 115 } 116 117 public boolean hasMinOpElement() { 118 return this.minOp != null && !this.minOp.isEmpty(); 119 } 120 121 public boolean hasMinOp() { 122 return this.minOp != null && !this.minOp.isEmpty(); 123 } 124 125 /** 126 * @param value {@link #minOp} (). This is the underlying object with id, value and extensions. The accessor "getMinOp" gives direct access to the value 127 */ 128 public WebTemplateInputValidationRange setMinOpElement(CodeType value) { 129 this.minOp = value; 130 return this; 131 } 132 133 /** 134 * @return 135 */ 136 public String getMinOp() { 137 return this.minOp == null ? null : this.minOp.getValue(); 138 } 139 140 /** 141 * @param value 142 */ 143 public WebTemplateInputValidationRange setMinOp(String value) { 144 if (this.minOp == null) 145 this.minOp = new CodeType(); 146 this.minOp.setValue(value); 147 return this; 148 } 149 150 /** 151 * @return {@link #min} (). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value 152 */ 153 public DecimalType getMinElement() { 154 if (this.min == null) 155 if (Configuration.errorOnAutoCreate()) 156 throw new Error("Attempt to auto-create WebTemplateInputValidationRange.min"); 157 else if (Configuration.doAutoCreate()) 158 this.min = new DecimalType(); // bb 159 return this.min; 160 } 161 162 public boolean hasMinElement() { 163 return this.min != null && !this.min.isEmpty(); 164 } 165 166 public boolean hasMin() { 167 return this.min != null && !this.min.isEmpty(); 168 } 169 170 /** 171 * @param value {@link #min} (). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value 172 */ 173 public WebTemplateInputValidationRange setMinElement(DecimalType value) { 174 this.min = value; 175 return this; 176 } 177 178 /** 179 * @return 180 */ 181 public BigDecimal getMin() { 182 return this.min == null ? null : this.min.getValue(); 183 } 184 185 /** 186 * @param value 187 */ 188 public WebTemplateInputValidationRange setMin(BigDecimal value) { 189 if (this.min == null) 190 this.min = new DecimalType(); 191 this.min.setValue(value); 192 return this; 193 } 194 195 /** 196 * @param value 197 */ 198 public WebTemplateInputValidationRange setMin(long value) { 199 this.min = new DecimalType(); 200 this.min.setValue(value); 201 return this; 202 } 203 204 /** 205 * @param value 206 */ 207 public WebTemplateInputValidationRange setMin(double value) { 208 this.min = new DecimalType(); 209 this.min.setValue(value); 210 return this; 211 } 212 213 /** 214 * @return {@link #maxOp} (). This is the underlying object with id, value and extensions. The accessor "getMaxOp" gives direct access to the value 215 */ 216 public CodeType getMaxOpElement() { 217 if (this.maxOp == null) 218 if (Configuration.errorOnAutoCreate()) 219 throw new Error("Attempt to auto-create WebTemplateInputValidationRange.maxOp"); 220 else if (Configuration.doAutoCreate()) 221 this.maxOp = new CodeType(); // bb 222 return this.maxOp; 223 } 224 225 public boolean hasMaxOpElement() { 226 return this.maxOp != null && !this.maxOp.isEmpty(); 227 } 228 229 public boolean hasMaxOp() { 230 return this.maxOp != null && !this.maxOp.isEmpty(); 231 } 232 233 /** 234 * @param value {@link #maxOp} (). This is the underlying object with id, value and extensions. The accessor "getMaxOp" gives direct access to the value 235 */ 236 public WebTemplateInputValidationRange setMaxOpElement(CodeType value) { 237 this.maxOp = value; 238 return this; 239 } 240 241 /** 242 * @return 243 */ 244 public String getMaxOp() { 245 return this.maxOp == null ? null : this.maxOp.getValue(); 246 } 247 248 /** 249 * @param value 250 */ 251 public WebTemplateInputValidationRange setMaxOp(String value) { 252 if (this.maxOp == null) 253 this.maxOp = new CodeType(); 254 this.maxOp.setValue(value); 255 return this; 256 } 257 258 /** 259 * @return {@link #max} (). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value 260 */ 261 public DecimalType getMaxElement() { 262 if (this.max == null) 263 if (Configuration.errorOnAutoCreate()) 264 throw new Error("Attempt to auto-create WebTemplateInputValidationRange.max"); 265 else if (Configuration.doAutoCreate()) 266 this.max = new DecimalType(); // bb 267 return this.max; 268 } 269 270 public boolean hasMaxElement() { 271 return this.max != null && !this.max.isEmpty(); 272 } 273 274 public boolean hasMax() { 275 return this.max != null && !this.max.isEmpty(); 276 } 277 278 /** 279 * @param value {@link #max} (). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value 280 */ 281 public WebTemplateInputValidationRange setMaxElement(DecimalType value) { 282 this.max = value; 283 return this; 284 } 285 286 /** 287 * @return 288 */ 289 public BigDecimal getMax() { 290 return this.max == null ? null : this.max.getValue(); 291 } 292 293 /** 294 * @param value 295 */ 296 public WebTemplateInputValidationRange setMax(BigDecimal value) { 297 if (this.max == null) 298 this.max = new DecimalType(); 299 this.max.setValue(value); 300 return this; 301 } 302 303 /** 304 * @param value 305 */ 306 public WebTemplateInputValidationRange setMax(long value) { 307 this.max = new DecimalType(); 308 this.max.setValue(value); 309 return this; 310 } 311 312 /** 313 * @param value 314 */ 315 public WebTemplateInputValidationRange setMax(double value) { 316 this.max = new DecimalType(); 317 this.max.setValue(value); 318 return this; 319 } 320 321 protected void listChildren(List<Property> children) { 322 super.listChildren(children); 323 children.add(new Property("minOp", "code", "", 0, 1, minOp)); 324 children.add(new Property("min", "decimal", "", 0, 1, min)); 325 children.add(new Property("maxOp", "code", "", 0, 1, maxOp)); 326 children.add(new Property("max", "decimal", "", 0, 1, max)); 327 } 328 329 @Override 330 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 331 switch (_hash) { 332 case 103900115: /*minOp*/ return new Property("minOp", "code", "", 0, 1, minOp); 333 case 108114: /*min*/ return new Property("min", "decimal", "", 0, 1, min); 334 case 103671397: /*maxOp*/ return new Property("maxOp", "code", "", 0, 1, maxOp); 335 case 107876: /*max*/ return new Property("max", "decimal", "", 0, 1, max); 336 default: return super.getNamedProperty(_hash, _name, _checkValid); 337 } 338 339 } 340 341 @Override 342 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 343 switch (hash) { 344 case 103900115: /*minOp*/ return this.minOp == null ? new Base[0] : new Base[] {this.minOp}; // CodeType 345 case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // DecimalType 346 case 103671397: /*maxOp*/ return this.maxOp == null ? new Base[0] : new Base[] {this.maxOp}; // CodeType 347 case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // DecimalType 348 default: return super.getProperty(hash, name, checkValid); 349 } 350 351 } 352 353 @Override 354 public Base setProperty(int hash, String name, Base value) throws FHIRException { 355 switch (hash) { 356 case 103900115: // minOp 357 this.minOp = TypeConvertor.castToCode(value); // CodeType 358 return value; 359 case 108114: // min 360 this.min = TypeConvertor.castToDecimal(value); // DecimalType 361 return value; 362 case 103671397: // maxOp 363 this.maxOp = TypeConvertor.castToCode(value); // CodeType 364 return value; 365 case 107876: // max 366 this.max = TypeConvertor.castToDecimal(value); // DecimalType 367 return value; 368 default: return super.setProperty(hash, name, value); 369 } 370 371 } 372 373 @Override 374 public Base setProperty(String name, Base value) throws FHIRException { 375 if (name.equals("minOp")) { 376 this.minOp = TypeConvertor.castToCode(value); // CodeType 377 } else if (name.equals("min")) { 378 this.min = TypeConvertor.castToDecimal(value); // DecimalType 379 } else if (name.equals("maxOp")) { 380 this.maxOp = TypeConvertor.castToCode(value); // CodeType 381 } else if (name.equals("max")) { 382 this.max = TypeConvertor.castToDecimal(value); // DecimalType 383 } else 384 return super.setProperty(name, value); 385 return value; 386 } 387 388 @Override 389 public Base makeProperty(int hash, String name) throws FHIRException { 390 switch (hash) { 391 case 103900115: return getMinOpElement(); 392 case 108114: return getMinElement(); 393 case 103671397: return getMaxOpElement(); 394 case 107876: return getMaxElement(); 395 default: return super.makeProperty(hash, name); 396 } 397 398 } 399 400 @Override 401 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 402 switch (hash) { 403 case 103900115: /*minOp*/ return new String[] {"code"}; 404 case 108114: /*min*/ return new String[] {"decimal"}; 405 case 103671397: /*maxOp*/ return new String[] {"code"}; 406 case 107876: /*max*/ return new String[] {"decimal"}; 407 default: return super.getTypesForProperty(hash, name); 408 } 409 410 } 411 412 @Override 413 public Base addChild(String name) throws FHIRException { 414 if (name.equals("minOp")) { 415 throw new FHIRException("Cannot call addChild on a singleton property WebTemplateInputValidationRange.minOp"); 416 } 417 else if (name.equals("min")) { 418 throw new FHIRException("Cannot call addChild on a singleton property WebTemplateInputValidationRange.min"); 419 } 420 else if (name.equals("maxOp")) { 421 throw new FHIRException("Cannot call addChild on a singleton property WebTemplateInputValidationRange.maxOp"); 422 } 423 else if (name.equals("max")) { 424 throw new FHIRException("Cannot call addChild on a singleton property WebTemplateInputValidationRange.max"); 425 } 426 else 427 return super.addChild(name); 428 } 429 430 public String fhirType() { 431 return "WebTemplateInputValidationRange"; 432 433 } 434 435 public WebTemplateInputValidationRange copy() { 436 WebTemplateInputValidationRange dst = new WebTemplateInputValidationRange(); 437 copyValues(dst); 438 return dst; 439 } 440 441 public void copyValues(WebTemplateInputValidationRange dst) { 442 super.copyValues(dst); 443 dst.minOp = minOp == null ? null : minOp.copy(); 444 dst.min = min == null ? null : min.copy(); 445 dst.maxOp = maxOp == null ? null : maxOp.copy(); 446 dst.max = max == null ? null : max.copy(); 447 } 448 449 protected WebTemplateInputValidationRange typedCopy() { 450 return copy(); 451 } 452 453 @Override 454 public boolean equalsDeep(Base other_) { 455 if (!super.equalsDeep(other_)) 456 return false; 457 if (!(other_ instanceof WebTemplateInputValidationRange)) 458 return false; 459 WebTemplateInputValidationRange o = (WebTemplateInputValidationRange) other_; 460 return compareDeep(minOp, o.minOp, true) && compareDeep(min, o.min, true) && compareDeep(maxOp, o.maxOp, true) 461 && compareDeep(max, o.max, true); 462 } 463 464 @Override 465 public boolean equalsShallow(Base other_) { 466 if (!super.equalsShallow(other_)) 467 return false; 468 if (!(other_ instanceof WebTemplateInputValidationRange)) 469 return false; 470 WebTemplateInputValidationRange o = (WebTemplateInputValidationRange) other_; 471 return compareValues(minOp, o.minOp, true) && compareValues(min, o.min, true) && compareValues(maxOp, o.maxOp, true) 472 && compareValues(max, o.max, true); 473 } 474 475 public boolean isEmpty() { 476 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(minOp, min, maxOp, max 477 ); 478 } 479 480 481} 482