
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.utilities.Utilities; 038import org.hl7.fhir.r5.openehr.Enumerations.*; 039import org.hl7.fhir.exceptions.FHIRException; 040import org.hl7.fhir.r5.model.*; 041import org.hl7.fhir.instance.model.api.ICompositeType; 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.ChildOrder; 044import ca.uhn.fhir.model.api.annotation.DatatypeDef; 045import ca.uhn.fhir.model.api.annotation.Description; 046import ca.uhn.fhir.model.api.annotation.Block; 047 048/** 049 * Abstract class defining the concept of true quantified values, i.e. values which are not only ordered, but which have a precise magnitude. 050 */ 051@DatatypeDef(name="DV_QUANTIFIED") 052public abstract class DV_QUANTIFIED extends DV_ORDERED implements ICompositeType { 053 054 /** 055 * Optional status of magnitude with values: 056* '=' : magnitude is a point value 057* '<' : value is < magnitude 058* '>' : value is > magnitude 059* '<=' : value is <= magnitude 060* '>=' : value is >= magnitude 061* '~' : value is approximately magnitude 062 063If not present, assumed meaning is '=' . 064 */ 065 @Child(name = "magnitude_status", type = {StringType.class}, order=0, min=0, max=1, modifier=false, summary=false) 066 @Description(shortDefinition="Optional status of magnitude: =, <, >, <=, >=, ~", formalDefinition="Optional status of magnitude with values:\r\n* '=' : magnitude is a point value\r\n* '<' : value is < magnitude\r\n* '>' : value is > magnitude\r\n* '<=' : value is <= magnitude\r\n* '>=' : value is >= magnitude\r\n* '~' : value is approximately magnitude\r\n\r\nIf not present, assumed meaning is '=' ." ) 067 protected StringType magnitude_status; 068 069 /** 070 * Accuracy of measurement. Exact form of expression determined in descendants. 071 */ 072 @Child(name = "accuracy", type = {Base.class}, order=1, min=0, max=1, modifier=false, summary=false) 073 @Description(shortDefinition="Accuracy of measurement. Exact form of expression determined in descendants", formalDefinition="Accuracy of measurement. Exact form of expression determined in descendants." ) 074 protected Base accuracy; 075 076 private static final long serialVersionUID = 1989595286L; 077 078 /** 079 * Constructor 080 */ 081 public DV_QUANTIFIED() { 082 super(); 083 } 084 085 /** 086 * @return {@link #magnitude_status} (Optional status of magnitude with values: 087* '=' : magnitude is a point value 088* '<' : value is < magnitude 089* '>' : value is > magnitude 090* '<=' : value is <= magnitude 091* '>=' : value is >= magnitude 092* '~' : value is approximately magnitude 093 094If not present, assumed meaning is '=' .). This is the underlying object with id, value and extensions. The accessor "getMagnitude_status" gives direct access to the value 095 */ 096 public StringType getMagnitude_statusElement() { 097 if (this.magnitude_status == null) 098 if (Configuration.errorOnAutoCreate()) 099 throw new Error("Attempt to auto-create DV_QUANTIFIED.magnitude_status"); 100 else if (Configuration.doAutoCreate()) 101 this.magnitude_status = new StringType(); // bb 102 return this.magnitude_status; 103 } 104 105 public boolean hasMagnitude_statusElement() { 106 return this.magnitude_status != null && !this.magnitude_status.isEmpty(); 107 } 108 109 public boolean hasMagnitude_status() { 110 return this.magnitude_status != null && !this.magnitude_status.isEmpty(); 111 } 112 113 /** 114 * @param value {@link #magnitude_status} (Optional status of magnitude with values: 115* '=' : magnitude is a point value 116* '<' : value is < magnitude 117* '>' : value is > magnitude 118* '<=' : value is <= magnitude 119* '>=' : value is >= magnitude 120* '~' : value is approximately magnitude 121 122If not present, assumed meaning is '=' .). This is the underlying object with id, value and extensions. The accessor "getMagnitude_status" gives direct access to the value 123 */ 124 public DV_QUANTIFIED setMagnitude_statusElement(StringType value) { 125 this.magnitude_status = value; 126 return this; 127 } 128 129 /** 130 * @return Optional status of magnitude with values: 131* '=' : magnitude is a point value 132* '<' : value is < magnitude 133* '>' : value is > magnitude 134* '<=' : value is <= magnitude 135* '>=' : value is >= magnitude 136* '~' : value is approximately magnitude 137 138If not present, assumed meaning is '=' . 139 */ 140 public String getMagnitude_status() { 141 return this.magnitude_status == null ? null : this.magnitude_status.getValue(); 142 } 143 144 /** 145 * @param value Optional status of magnitude with values: 146* '=' : magnitude is a point value 147* '<' : value is < magnitude 148* '>' : value is > magnitude 149* '<=' : value is <= magnitude 150* '>=' : value is >= magnitude 151* '~' : value is approximately magnitude 152 153If not present, assumed meaning is '=' . 154 */ 155 public DV_QUANTIFIED setMagnitude_status(String value) { 156 if (Utilities.noString(value)) 157 this.magnitude_status = null; 158 else { 159 if (this.magnitude_status == null) 160 this.magnitude_status = new StringType(); 161 this.magnitude_status.setValue(value); 162 } 163 return this; 164 } 165 166 /** 167 * @return {@link #accuracy} (Accuracy of measurement. Exact form of expression determined in descendants.) 168 */ 169 public Base getAccuracy() { 170 return this.accuracy; 171 } 172 173 public boolean hasAccuracy() { 174 return this.accuracy != null && !this.accuracy.isEmpty(); 175 } 176 177 /** 178 * @param value {@link #accuracy} (Accuracy of measurement. Exact form of expression determined in descendants.) 179 */ 180 public DV_QUANTIFIED setAccuracy(Base value) { 181 this.accuracy = value; 182 return this; 183 } 184 185 protected void listChildren(List<Property> children) { 186 super.listChildren(children); 187 children.add(new Property("magnitude_status", "string", "Optional status of magnitude with values:\r\n* '=' : magnitude is a point value\r\n* '<' : value is < magnitude\r\n* '>' : value is > magnitude\r\n* '<=' : value is <= magnitude\r\n* '>=' : value is >= magnitude\r\n* '~' : value is approximately magnitude\r\n\r\nIf not present, assumed meaning is '=' .", 0, 1, magnitude_status)); 188 children.add(new Property("accuracy", "Base", "Accuracy of measurement. Exact form of expression determined in descendants.", 0, 1, accuracy)); 189 } 190 191 @Override 192 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 193 switch (_hash) { 194 case 195430657: /*magnitude_status*/ return new Property("magnitude_status", "string", "Optional status of magnitude with values:\r\n* '=' : magnitude is a point value\r\n* '<' : value is < magnitude\r\n* '>' : value is > magnitude\r\n* '<=' : value is <= magnitude\r\n* '>=' : value is >= magnitude\r\n* '~' : value is approximately magnitude\r\n\r\nIf not present, assumed meaning is '=' .", 0, 1, magnitude_status); 195 case -2131707655: /*accuracy*/ return new Property("accuracy", "Base", "Accuracy of measurement. Exact form of expression determined in descendants.", 0, 1, accuracy); 196 default: return super.getNamedProperty(_hash, _name, _checkValid); 197 } 198 199 } 200 201 @Override 202 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 203 switch (hash) { 204 case 195430657: /*magnitude_status*/ return this.magnitude_status == null ? new Base[0] : new Base[] {this.magnitude_status}; // StringType 205 case -2131707655: /*accuracy*/ return this.accuracy == null ? new Base[0] : new Base[] {this.accuracy}; // Base 206 default: return super.getProperty(hash, name, checkValid); 207 } 208 209 } 210 211 @Override 212 public Base setProperty(int hash, String name, Base value) throws FHIRException { 213 switch (hash) { 214 case 195430657: // magnitude_status 215 this.magnitude_status = TypeConvertor.castToString(value); // StringType 216 return value; 217 case -2131707655: // accuracy 218 this.accuracy = (Base) value; // Base 219 return value; 220 default: return super.setProperty(hash, name, value); 221 } 222 223 } 224 225 @Override 226 public Base setProperty(String name, Base value) throws FHIRException { 227 if (name.equals("magnitude_status")) { 228 this.magnitude_status = TypeConvertor.castToString(value); // StringType 229 } else if (name.equals("accuracy")) { 230 this.accuracy = (Base) value; // Base 231 } else 232 return super.setProperty(name, value); 233 return value; 234 } 235 236 @Override 237 public Base makeProperty(int hash, String name) throws FHIRException { 238 switch (hash) { 239 case 195430657: return getMagnitude_statusElement(); 240 case -2131707655: /*div*/ 241 throw new Error("Unable to make an instance of the abstract property 'accuracy'"); 242 default: return super.makeProperty(hash, name); 243 } 244 245 } 246 247 @Override 248 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 249 switch (hash) { 250 case 195430657: /*magnitude_status*/ return new String[] {"string"}; 251 case -2131707655: /*accuracy*/ return new String[] {"Base"}; 252 default: return super.getTypesForProperty(hash, name); 253 } 254 255 } 256 257 @Override 258 public Base addChild(String name) throws FHIRException { 259 if (name.equals("magnitude_status")) { 260 throw new FHIRException("Cannot call addChild on a singleton property DV_QUANTIFIED.magnitude_status"); 261 } 262 else if (name.equals("accuracy")) { 263 throw new FHIRException("Cannot call addChild on an abstract type DV_QUANTIFIED.accuracy"); 264 } 265 else 266 return super.addChild(name); 267 } 268 269 public String fhirType() { 270 return "DV_QUANTIFIED"; 271 272 } 273 274 public abstract DV_QUANTIFIED copy(); 275 276 public void copyValues(DV_QUANTIFIED dst) { 277 super.copyValues(dst); 278 dst.magnitude_status = magnitude_status == null ? null : magnitude_status.copy(); 279 dst.accuracy = accuracy == null ? null : accuracy.copy(); 280 } 281 282 @Override 283 public boolean equalsDeep(Base other_) { 284 if (!super.equalsDeep(other_)) 285 return false; 286 if (!(other_ instanceof DV_QUANTIFIED)) 287 return false; 288 DV_QUANTIFIED o = (DV_QUANTIFIED) other_; 289 return compareDeep(magnitude_status, o.magnitude_status, true) && compareDeep(accuracy, o.accuracy, true) 290 ; 291 } 292 293 @Override 294 public boolean equalsShallow(Base other_) { 295 if (!super.equalsShallow(other_)) 296 return false; 297 if (!(other_ instanceof DV_QUANTIFIED)) 298 return false; 299 DV_QUANTIFIED o = (DV_QUANTIFIED) other_; 300 return compareValues(magnitude_status, o.magnitude_status, true); 301 } 302 303 public boolean isEmpty() { 304 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(magnitude_status, accuracy 305 ); 306 } 307 308 309} 310