Search in sources :

Example 26 with BooleanType

use of org.hl7.fhir.r4.model.BooleanType in project org.hl7.fhir.core by hapifhir.

the class FHIRPathEngine method opIs.

private List<Base> opIs(List<Base> left, List<Base> right) {
    List<Base> result = new ArrayList<Base>();
    if (left.size() != 1 || right.size() != 1)
        result.add(new BooleanType(false));
    else {
        String tn = convertToString(right);
        result.add(new BooleanType(left.get(0).hasType(tn)));
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) BooleanType(org.hl7.fhir.dstu2016may.model.BooleanType) ParserBase(org.hl7.fhir.dstu2016may.metamodel.ParserBase) Base(org.hl7.fhir.dstu2016may.model.Base)

Example 27 with BooleanType

use of org.hl7.fhir.r4.model.BooleanType in project org.hl7.fhir.core by hapifhir.

the class FHIRPathEngine method funcSupersetOf.

private List<Base> funcSupersetOf(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws FHIRException {
    List<Base> target = execute(context, focus, exp.getParameters().get(0), true);
    boolean valid = true;
    for (Base item : target) {
        boolean found = false;
        for (Base t : focus) {
            if (Base.compareDeep(item, t, false)) {
                found = true;
                break;
            }
        }
        if (!found) {
            valid = false;
            break;
        }
    }
    List<Base> result = new ArrayList<Base>();
    result.add(new BooleanType(valid));
    return result;
}
Also used : ArrayList(java.util.ArrayList) BooleanType(org.hl7.fhir.dstu2016may.model.BooleanType) ParserBase(org.hl7.fhir.dstu2016may.metamodel.ParserBase) Base(org.hl7.fhir.dstu2016may.model.Base)

Example 28 with BooleanType

use of org.hl7.fhir.r4.model.BooleanType in project org.hl7.fhir.core by hapifhir.

the class FHIRPathEngine method funcIs.

private List<Base> funcIs(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws PathEngineException {
    List<Base> result = new ArrayList<Base>();
    if (focus.size() == 0 || focus.size() > 1)
        result.add(new BooleanType(false));
    else {
        String tn = exp.getParameters().get(0).getName();
        result.add(new BooleanType(focus.get(0).hasType(tn)));
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) BooleanType(org.hl7.fhir.dstu2016may.model.BooleanType) ParserBase(org.hl7.fhir.dstu2016may.metamodel.ParserBase) Base(org.hl7.fhir.dstu2016may.model.Base)

Example 29 with BooleanType

use of org.hl7.fhir.r4.model.BooleanType in project org.hl7.fhir.core by hapifhir.

the class FHIRPathEngine method funcExists.

private List<Base> funcExists(ExecutionContext context, List<Base> focus, ExpressionNode exp) {
    List<Base> result = new ArrayList<Base>();
    result.add(new BooleanType(!focus.isEmpty()));
    return result;
}
Also used : ArrayList(java.util.ArrayList) BooleanType(org.hl7.fhir.dstu2016may.model.BooleanType) ParserBase(org.hl7.fhir.dstu2016may.metamodel.ParserBase) Base(org.hl7.fhir.dstu2016may.model.Base)

Example 30 with BooleanType

use of org.hl7.fhir.r4.model.BooleanType in project org.hl7.fhir.core by hapifhir.

the class FHIRPathEngine method makeBoolean.

private List<Base> makeBoolean(boolean b) {
    List<Base> res = new ArrayList<Base>();
    res.add(new BooleanType(b));
    return res;
}
Also used : ArrayList(java.util.ArrayList) BooleanType(org.hl7.fhir.dstu2016may.model.BooleanType) ParserBase(org.hl7.fhir.dstu2016may.metamodel.ParserBase) Base(org.hl7.fhir.dstu2016may.model.Base)

Aggregations

ArrayList (java.util.ArrayList)59 BooleanType (org.hl7.fhir.r5.model.BooleanType)38 BooleanType (org.hl7.fhir.r4.model.BooleanType)37 FHIRException (org.hl7.fhir.exceptions.FHIRException)33 BooleanType (org.hl7.fhir.r4b.model.BooleanType)27 BooleanType (org.hl7.fhir.dstu3.model.BooleanType)19 NotImplementedException (org.apache.commons.lang3.NotImplementedException)18 Base (org.hl7.fhir.r5.model.Base)17 Test (org.junit.Test)16 StringType (org.hl7.fhir.r4.model.StringType)15 Base (org.hl7.fhir.r4b.model.Base)15 BooleanType (org.hl7.fhir.dstu2016may.model.BooleanType)13 IOException (java.io.IOException)12 HashMap (java.util.HashMap)11 BooleanType (org.hl7.fhir.dstu2.model.BooleanType)11 Base (org.hl7.fhir.dstu2.model.Base)10 StringType (org.hl7.fhir.dstu3.model.StringType)10 StringType (org.hl7.fhir.r5.model.StringType)10 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)9 Coding (org.hl7.fhir.r4.model.Coding)9