001package org.hl7.fhir.r5.model;
002
003
004/*
005 * #%L
006 * org.hl7.fhir.r5
007 * %%
008 * Copyright (C) 2014 - 2019 Health Level 7
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the \"License\");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an \"AS IS\" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, \
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this \
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, \
034     this list of conditions and the following disclaimer in the documentation \
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
049  POSSIBILITY OF SUCH DAMAGE.
050  */
051
052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
053
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057import java.math.*;
058import org.hl7.fhir.utilities.Utilities;
059import org.hl7.fhir.r5.model.Enumerations.*;
060import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
061import org.hl7.fhir.exceptions.FHIRException;
062import org.hl7.fhir.instance.model.api.ICompositeType;
063import ca.uhn.fhir.model.api.annotation.Child;
064import ca.uhn.fhir.model.api.annotation.ChildOrder;
065import ca.uhn.fhir.model.api.annotation.DatatypeDef;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068
069/**
070 * Base StructureDefinition for Quantity Type: A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
071 */
072@DatatypeDef(name="Quantity")
073public class Quantity extends DataType implements ICompositeType, ICoding {
074
075    /**
076     * The value of the measured amount. The value includes an implicit precision in the presentation of the value.
077     */
078    @Child(name = "value", type = {DecimalType.class}, order=0, min=0, max=1, modifier=false, summary=true)
079    @Description(shortDefinition="Numerical value (with implicit precision)", formalDefinition="The value of the measured amount. The value includes an implicit precision in the presentation of the value." )
080    protected DecimalType value;
081
082    /**
083     * How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.
084     */
085    @Child(name = "comparator", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
086    @Description(shortDefinition="< | <= | >= | > - how to understand the value", formalDefinition="How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value." )
087    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/quantity-comparator")
088    protected Enumeration<QuantityComparator> comparator;
089
090    /**
091     * A human-readable form of the unit.
092     */
093    @Child(name = "unit", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
094    @Description(shortDefinition="Unit representation", formalDefinition="A human-readable form of the unit." )
095    protected StringType unit;
096
097    /**
098     * The identification of the system that provides the coded form of the unit.
099     */
100    @Child(name = "system", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=true)
101    @Description(shortDefinition="System that defines coded unit form", formalDefinition="The identification of the system that provides the coded form of the unit." )
102    protected UriType system;
103
104    /**
105     * A computer processable form of the unit in some unit representation system.
106     */
107    @Child(name = "code", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
108    @Description(shortDefinition="Coded form of the unit", formalDefinition="A computer processable form of the unit in some unit representation system." )
109    protected CodeType code;
110
111    private static final long serialVersionUID = 1069574054L;
112
113  /**
114   * Constructor
115   */
116    public Quantity() {
117      super();
118    }
119
120 /**
121   * Convenience constructor
122   * 
123   * @param theValue The {@link #setValue(double) value}
124   */
125  public Quantity(double theValue) {
126    setValue(theValue);
127  }
128
129  /**
130   * Convenience constructor
131   * 
132   * @param theValue The {@link #setValue(long) value}
133   */
134  public Quantity(long theValue) {
135    setValue(theValue);
136  }
137  
138  /**
139   * Convenience constructor
140   * 
141   * @param theComparator The {@link #setComparator(QuantityComparator) comparator}
142   * @param theValue The {@link #setValue(BigDecimal) value}
143   * @param theSystem The {@link #setSystem(String)} (the code system for the units}
144   * @param theCode The {@link #setCode(String)} (the code for the units}
145   * @param theUnit The {@link #setUnit(String)} (the human readable display name for the units}
146   */
147  public Quantity(QuantityComparator theComparator, double theValue, String theSystem, String theCode, String theUnit) {
148    setValue(theValue);
149    setComparator(theComparator);
150    setSystem(theSystem);
151    setCode(theCode);
152    setUnit(theUnit);
153  }
154
155  /**
156   * Convenience constructor
157   * 
158   * @param theComparator The {@link #setComparator(QuantityComparator) comparator}
159   * @param theValue The {@link #setValue(BigDecimal) value}
160   * @param theSystem The {@link #setSystem(String)} (the code system for the units}
161   * @param theCode The {@link #setCode(String)} (the code for the units}
162   * @param theUnit The {@link #setUnit(String)} (the human readable display name for the units}
163   */
164  public Quantity(QuantityComparator theComparator, long theValue, String theSystem, String theCode, String theUnit) {
165    setValue(theValue);
166    setComparator(theComparator);
167    setSystem(theSystem);
168    setCode(theCode);
169    setUnit(theUnit);
170  }
171    /**
172     * @return {@link #value} (The value of the measured amount. The value includes an implicit precision in the presentation of the value.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
173     */
174    public DecimalType getValueElement() { 
175      if (this.value == null)
176        if (Configuration.errorOnAutoCreate())
177          throw new Error("Attempt to auto-create Quantity.value");
178        else if (Configuration.doAutoCreate())
179          this.value = new DecimalType(); // bb
180      return this.value;
181    }
182
183    public boolean hasValueElement() { 
184      return this.value != null && !this.value.isEmpty();
185    }
186
187    public boolean hasValue() { 
188      return this.value != null && !this.value.isEmpty();
189    }
190
191    /**
192     * @param value {@link #value} (The value of the measured amount. The value includes an implicit precision in the presentation of the value.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
193     */
194    public Quantity setValueElement(DecimalType value) { 
195      this.value = value;
196      return this;
197    }
198
199    /**
200     * @return The value of the measured amount. The value includes an implicit precision in the presentation of the value.
201     */
202    public BigDecimal getValue() { 
203      return this.value == null ? null : this.value.getValue();
204    }
205
206    /**
207     * @param value The value of the measured amount. The value includes an implicit precision in the presentation of the value.
208     */
209    public Quantity setValue(BigDecimal value) { 
210      if (value == null)
211        this.value = null;
212      else {
213        if (this.value == null)
214          this.value = new DecimalType();
215        this.value.setValue(value);
216      }
217      return this;
218    }
219
220    /**
221     * @param value The value of the measured amount. The value includes an implicit precision in the presentation of the value.
222     */
223    public Quantity setValue(long value) { 
224          this.value = new DecimalType();
225        this.value.setValue(value);
226      return this;
227    }
228
229    /**
230     * @param value The value of the measured amount. The value includes an implicit precision in the presentation of the value.
231     */
232    public Quantity setValue(double value) { 
233          this.value = new DecimalType();
234        this.value.setValue(value);
235      return this;
236    }
237
238    /**
239     * @return {@link #comparator} (How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.). This is the underlying object with id, value and extensions. The accessor "getComparator" gives direct access to the value
240     */
241    public Enumeration<QuantityComparator> getComparatorElement() { 
242      if (this.comparator == null)
243        if (Configuration.errorOnAutoCreate())
244          throw new Error("Attempt to auto-create Quantity.comparator");
245        else if (Configuration.doAutoCreate())
246          this.comparator = new Enumeration<QuantityComparator>(new QuantityComparatorEnumFactory()); // bb
247      return this.comparator;
248    }
249
250    public boolean hasComparatorElement() { 
251      return this.comparator != null && !this.comparator.isEmpty();
252    }
253
254    public boolean hasComparator() { 
255      return this.comparator != null && !this.comparator.isEmpty();
256    }
257
258    /**
259     * @param value {@link #comparator} (How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.). This is the underlying object with id, value and extensions. The accessor "getComparator" gives direct access to the value
260     */
261    public Quantity setComparatorElement(Enumeration<QuantityComparator> value) { 
262      this.comparator = value;
263      return this;
264    }
265
266    /**
267     * @return How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.
268     */
269    public QuantityComparator getComparator() { 
270      return this.comparator == null ? null : this.comparator.getValue();
271    }
272
273    /**
274     * @param value How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.
275     */
276    public Quantity setComparator(QuantityComparator value) { 
277      if (value == null)
278        this.comparator = null;
279      else {
280        if (this.comparator == null)
281          this.comparator = new Enumeration<QuantityComparator>(new QuantityComparatorEnumFactory());
282        this.comparator.setValue(value);
283      }
284      return this;
285    }
286
287    /**
288     * @return {@link #unit} (A human-readable form of the unit.). This is the underlying object with id, value and extensions. The accessor "getUnit" gives direct access to the value
289     */
290    public StringType getUnitElement() { 
291      if (this.unit == null)
292        if (Configuration.errorOnAutoCreate())
293          throw new Error("Attempt to auto-create Quantity.unit");
294        else if (Configuration.doAutoCreate())
295          this.unit = new StringType(); // bb
296      return this.unit;
297    }
298
299    public boolean hasUnitElement() { 
300      return this.unit != null && !this.unit.isEmpty();
301    }
302
303    public boolean hasUnit() { 
304      return this.unit != null && !this.unit.isEmpty();
305    }
306
307    /**
308     * @param value {@link #unit} (A human-readable form of the unit.). This is the underlying object with id, value and extensions. The accessor "getUnit" gives direct access to the value
309     */
310    public Quantity setUnitElement(StringType value) { 
311      this.unit = value;
312      return this;
313    }
314
315    /**
316     * @return A human-readable form of the unit.
317     */
318    public String getUnit() { 
319      return this.unit == null ? null : this.unit.getValue();
320    }
321
322    /**
323     * @param value A human-readable form of the unit.
324     */
325    public Quantity setUnit(String value) { 
326      if (Utilities.noString(value))
327        this.unit = null;
328      else {
329        if (this.unit == null)
330          this.unit = new StringType();
331        this.unit.setValue(value);
332      }
333      return this;
334    }
335
336    /**
337     * @return {@link #system} (The identification of the system that provides the coded form of the unit.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
338     */
339    public UriType getSystemElement() { 
340      if (this.system == null)
341        if (Configuration.errorOnAutoCreate())
342          throw new Error("Attempt to auto-create Quantity.system");
343        else if (Configuration.doAutoCreate())
344          this.system = new UriType(); // bb
345      return this.system;
346    }
347
348    public boolean hasSystemElement() { 
349      return this.system != null && !this.system.isEmpty();
350    }
351
352    public boolean hasSystem() { 
353      return this.system != null && !this.system.isEmpty();
354    }
355
356    /**
357     * @param value {@link #system} (The identification of the system that provides the coded form of the unit.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
358     */
359    public Quantity setSystemElement(UriType value) { 
360      this.system = value;
361      return this;
362    }
363
364    /**
365     * @return The identification of the system that provides the coded form of the unit.
366     */
367    public String getSystem() { 
368      return this.system == null ? null : this.system.getValue();
369    }
370
371    /**
372     * @param value The identification of the system that provides the coded form of the unit.
373     */
374    public Quantity setSystem(String value) { 
375      if (Utilities.noString(value))
376        this.system = null;
377      else {
378        if (this.system == null)
379          this.system = new UriType();
380        this.system.setValue(value);
381      }
382      return this;
383    }
384
385    /**
386     * @return {@link #code} (A computer processable form of the unit in some unit representation system.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
387     */
388    public CodeType getCodeElement() { 
389      if (this.code == null)
390        if (Configuration.errorOnAutoCreate())
391          throw new Error("Attempt to auto-create Quantity.code");
392        else if (Configuration.doAutoCreate())
393          this.code = new CodeType(); // bb
394      return this.code;
395    }
396
397    public boolean hasCodeElement() { 
398      return this.code != null && !this.code.isEmpty();
399    }
400
401    public boolean hasCode() { 
402      return this.code != null && !this.code.isEmpty();
403    }
404
405    /**
406     * @param value {@link #code} (A computer processable form of the unit in some unit representation system.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
407     */
408    public Quantity setCodeElement(CodeType value) { 
409      this.code = value;
410      return this;
411    }
412
413    /**
414     * @return A computer processable form of the unit in some unit representation system.
415     */
416    public String getCode() { 
417      return this.code == null ? null : this.code.getValue();
418    }
419
420    /**
421     * @param value A computer processable form of the unit in some unit representation system.
422     */
423    public Quantity setCode(String value) { 
424      if (Utilities.noString(value))
425        this.code = null;
426      else {
427        if (this.code == null)
428          this.code = new CodeType();
429        this.code.setValue(value);
430      }
431      return this;
432    }
433
434      protected void listChildren(List<Property> children) {
435        super.listChildren(children);
436        children.add(new Property("value", "decimal", "The value of the measured amount. The value includes an implicit precision in the presentation of the value.", 0, 1, value));
437        children.add(new Property("comparator", "code", "How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value.", 0, 1, comparator));
438        children.add(new Property("unit", "string", "A human-readable form of the unit.", 0, 1, unit));
439        children.add(new Property("system", "uri", "The identification of the system that provides the coded form of the unit.", 0, 1, system));
440        children.add(new Property("code", "code", "A computer processable form of the unit in some unit representation system.", 0, 1, code));
441      }
442
443      @Override
444      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
445        switch (_hash) {
446        case 111972721: /*value*/  return new Property("value", "decimal", "The value of the measured amount. The value includes an implicit precision in the presentation of the value.", 0, 1, value);
447        case -844673834: /*comparator*/  return new Property("comparator", "code", "How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value.", 0, 1, comparator);
448        case 3594628: /*unit*/  return new Property("unit", "string", "A human-readable form of the unit.", 0, 1, unit);
449        case -887328209: /*system*/  return new Property("system", "uri", "The identification of the system that provides the coded form of the unit.", 0, 1, system);
450        case 3059181: /*code*/  return new Property("code", "code", "A computer processable form of the unit in some unit representation system.", 0, 1, code);
451        default: return super.getNamedProperty(_hash, _name, _checkValid);
452        }
453
454      }
455
456      @Override
457      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
458        switch (hash) {
459        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
460        case -844673834: /*comparator*/ return this.comparator == null ? new Base[0] : new Base[] {this.comparator}; // Enumeration<QuantityComparator>
461        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // StringType
462        case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType
463        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeType
464        default: return super.getProperty(hash, name, checkValid);
465        }
466
467      }
468
469      @Override
470      public Base setProperty(int hash, String name, Base value) throws FHIRException {
471        switch (hash) {
472        case 111972721: // value
473          this.value = TypeConvertor.castToDecimal(value); // DecimalType
474          return value;
475        case -844673834: // comparator
476          value = new QuantityComparatorEnumFactory().fromType(TypeConvertor.castToCode(value));
477          this.comparator = (Enumeration) value; // Enumeration<QuantityComparator>
478          return value;
479        case 3594628: // unit
480          this.unit = TypeConvertor.castToString(value); // StringType
481          return value;
482        case -887328209: // system
483          this.system = TypeConvertor.castToUri(value); // UriType
484          return value;
485        case 3059181: // code
486          this.code = TypeConvertor.castToCode(value); // CodeType
487          return value;
488        default: return super.setProperty(hash, name, value);
489        }
490
491      }
492
493      @Override
494      public Base setProperty(String name, Base value) throws FHIRException {
495        if (name.equals("value")) {
496          this.value = TypeConvertor.castToDecimal(value); // DecimalType
497        } else if (name.equals("comparator")) {
498          value = new QuantityComparatorEnumFactory().fromType(TypeConvertor.castToCode(value));
499          this.comparator = (Enumeration) value; // Enumeration<QuantityComparator>
500        } else if (name.equals("unit")) {
501          this.unit = TypeConvertor.castToString(value); // StringType
502        } else if (name.equals("system")) {
503          this.system = TypeConvertor.castToUri(value); // UriType
504        } else if (name.equals("code")) {
505          this.code = TypeConvertor.castToCode(value); // CodeType
506        } else
507          return super.setProperty(name, value);
508        return value;
509      }
510
511      @Override
512      public Base makeProperty(int hash, String name) throws FHIRException {
513        switch (hash) {
514        case 111972721:  return getValueElement();
515        case -844673834:  return getComparatorElement();
516        case 3594628:  return getUnitElement();
517        case -887328209:  return getSystemElement();
518        case 3059181:  return getCodeElement();
519        default: return super.makeProperty(hash, name);
520        }
521
522      }
523
524      @Override
525      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
526        switch (hash) {
527        case 111972721: /*value*/ return new String[] {"decimal"};
528        case -844673834: /*comparator*/ return new String[] {"code"};
529        case 3594628: /*unit*/ return new String[] {"string"};
530        case -887328209: /*system*/ return new String[] {"uri"};
531        case 3059181: /*code*/ return new String[] {"code"};
532        default: return super.getTypesForProperty(hash, name);
533        }
534
535      }
536
537      @Override
538      public Base addChild(String name) throws FHIRException {
539        if (name.equals("value")) {
540          throw new FHIRException("Cannot call addChild on a primitive type Quantity.value");
541        }
542        else if (name.equals("comparator")) {
543          throw new FHIRException("Cannot call addChild on a primitive type Quantity.comparator");
544        }
545        else if (name.equals("unit")) {
546          throw new FHIRException("Cannot call addChild on a primitive type Quantity.unit");
547        }
548        else if (name.equals("system")) {
549          throw new FHIRException("Cannot call addChild on a primitive type Quantity.system");
550        }
551        else if (name.equals("code")) {
552          throw new FHIRException("Cannot call addChild on a primitive type Quantity.code");
553        }
554        else
555          return super.addChild(name);
556      }
557
558  public String fhirType() {
559    return "Quantity";
560
561  }
562
563      public Quantity copy() {
564        Quantity dst = new Quantity();
565        copyValues(dst);
566        return dst;
567      }
568
569      public void copyValues(Quantity dst) {
570        super.copyValues(dst);
571        dst.value = value == null ? null : value.copy();
572        dst.comparator = comparator == null ? null : comparator.copy();
573        dst.unit = unit == null ? null : unit.copy();
574        dst.system = system == null ? null : system.copy();
575        dst.code = code == null ? null : code.copy();
576      }
577
578      protected Quantity typedCopy() {
579        return copy();
580      }
581
582      @Override
583      public boolean equalsDeep(Base other_) {
584        if (!super.equalsDeep(other_))
585          return false;
586        if (!(other_ instanceof Quantity))
587          return false;
588        Quantity o = (Quantity) other_;
589        return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(unit, o.unit, true)
590           && compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
591      }
592
593      @Override
594      public boolean equalsShallow(Base other_) {
595        if (!super.equalsShallow(other_))
596          return false;
597        if (!(other_ instanceof Quantity))
598          return false;
599        Quantity o = (Quantity) other_;
600        return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(unit, o.unit, true)
601           && compareValues(system, o.system, true) && compareValues(code, o.code, true);
602      }
603
604      public boolean isEmpty() {
605        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, comparator, unit
606          , system, code);
607      }
608
609// Manual code (from Configuration.txt)t:
610
611      @Override
612      public String getVersion() {
613        return null;
614      }
615
616      @Override
617      public boolean hasVersion() {
618        return false;
619      }
620
621      @Override
622      public boolean supportsVersion() {
623        return false;
624      }
625
626      @Override
627      public String getDisplay() {
628        return null;
629      }
630
631      @Override
632      public boolean hasDisplay() {
633        return false;
634      }
635
636      @Override
637      public boolean supportsDisplay() {
638        return false;
639      }
640
641   public static Quantity fromUcum(String v, String code) {
642      Quantity res = new Quantity();
643      res.setValue(new BigDecimal(v));
644      res.setSystem("http://unitsofmeasure.org");
645      res.setCode(code);
646      return res;
647    }
648
649
650
651// end addition
652
653}
654