001package org.hl7.fhir.instance.model;
002
003import ca.uhn.fhir.model.api.annotation.DatatypeDef;
004/**
005 * 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.
006 */
007@DatatypeDef(name="Money", profileOf=Quantity.class)
008public class Money extends Quantity {
009
010    private static final long serialVersionUID = 1069574054L;
011
012      public Money copy() {
013        Money dst = new Money();
014        copyValues(dst);
015        dst.value = value == null ? null : value.copy();
016        dst.comparator = comparator == null ? null : comparator.copy();
017        dst.unit = unit == null ? null : unit.copy();
018        dst.system = system == null ? null : system.copy();
019        dst.code = code == null ? null : code.copy();
020        return dst;
021      }
022
023      protected Money typedCopy() {
024        return copy();
025      }
026
027      @Override
028      public boolean equalsDeep(Base other) {
029        if (!super.equalsDeep(other))
030          return false;
031        if (!(other instanceof Money))
032          return false;
033        Money o = (Money) other;
034        return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(unit, o.unit, true)
035           && compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
036      }
037
038      @Override
039      public boolean equalsShallow(Base other) {
040        if (!super.equalsShallow(other))
041          return false;
042        if (!(other instanceof Money))
043          return false;
044        Money o = (Money) other;
045        return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(unit, o.unit, true)
046           && compareValues(system, o.system, true) && compareValues(code, o.code, true);
047      }
048
049      public boolean isEmpty() {
050        return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
051           && (unit == null || unit.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
052          ;
053      }
054
055
056}
057