Beispiel #1
0
 public BigDecimal getFirst() {
   if (this.type == Type.VALUE) {
     return this.value[0];
   } else {
     throw new IllegalStateException("Wrong type " + type.toString());
   }
 }
Beispiel #2
0
 public boolean isLeftAssociative() {
   if (this.type == Type.OPERATOR) {
     if (this.operator == '^') return false;
     else return true;
   } else {
     throw new IllegalStateException("Wrong type " + type.toString());
   }
 }
Beispiel #3
0
 @Override
 public void setProperty(String name, Base value) throws FHIRException {
   if (name.equals("value")) this.value = castToDecimal(value); // DecimalType
   else if (name.equals("comparator"))
     this.comparator =
         new QuantityComparatorEnumFactory().fromType(value); // Enumeration<QuantityComparator>
   else if (name.equals("unit")) this.unit = castToString(value); // StringType
   else if (name.equals("system")) this.system = castToUri(value); // UriType
   else if (name.equals("code")) this.code = castToCode(value); // CodeType
   else super.setProperty(name, value);
 }
Beispiel #4
0
 protected void listChildren(List<Property> childrenList) {
   super.listChildren(childrenList);
   childrenList.add(
       new Property(
           "value",
           "decimal",
           "The value of the measured amount. The value includes an implicit precision in the presentation of the value.",
           0,
           java.lang.Integer.MAX_VALUE,
           value));
   childrenList.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,
           java.lang.Integer.MAX_VALUE,
           comparator));
   childrenList.add(
       new Property(
           "unit",
           "string",
           "A human-readable form of the unit.",
           0,
           java.lang.Integer.MAX_VALUE,
           unit));
   childrenList.add(
       new Property(
           "system",
           "uri",
           "The identification of the system that provides the coded form of the unit.",
           0,
           java.lang.Integer.MAX_VALUE,
           system));
   childrenList.add(
       new Property(
           "code",
           "code",
           "A computer processable form of the unit in some unit representation system.",
           0,
           java.lang.Integer.MAX_VALUE,
           code));
 }
Beispiel #5
0
 @Override
 public void setProperty(int hash, String name, Base value) throws FHIRException {
   switch (hash) {
     case 111972721: // value
       this.value = castToDecimal(value); // DecimalType
       break;
     case -844673834: // comparator
       this.comparator =
           new QuantityComparatorEnumFactory().fromType(value); // Enumeration<QuantityComparator>
       break;
     case 3594628: // unit
       this.unit = castToString(value); // StringType
       break;
     case -887328209: // system
       this.system = castToUri(value); // UriType
       break;
     case 3059181: // code
       this.code = castToCode(value); // CodeType
       break;
     default:
       super.setProperty(hash, name, value);
   }
 }
Beispiel #6
0
  public int getPrecedence() {
    if (this.type == Type.OPERATOR) {
      switch (this.operator) {
        case '^':
          return 3;

        case '*':
        case '/':
          return 2;

        case '+':
        case '-':
          return 1;

        default:
          return -1;
      }
    } else if (this.type == Type.FUNCTION) {
      return 4;
    } else {
      throw new IllegalStateException("Wrong type " + type.toString());
    }
  }