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>();
// R2 - can't use ElementUtil
result.add(new BooleanType(!focus.isEmpty()));
return result;
}
use of org.hl7.fhir.r4.model.BooleanType in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method funcSubsetOf.
private List<Base> funcSubsetOf(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws PathEngineException {
List<Base> target = execute(context, focus, exp.getParameters().get(0), true);
boolean valid = true;
for (Base item : focus) {
boolean found = false;
for (Base t : target) {
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;
}
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;
}
use of org.hl7.fhir.r4.model.BooleanType in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method funcAll.
private List<Base> funcAll(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws PathEngineException {
if (exp.getParameters().size() == 1) {
List<Base> result = new ArrayList<Base>();
List<Base> pc = new ArrayList<Base>();
boolean all = true;
for (Base item : focus) {
pc.clear();
pc.add(item);
if (!convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), false))) {
all = false;
break;
}
}
result.add(new BooleanType(all));
return result;
} else {
// (exp.getParameters().size() == 0) {
List<Base> result = new ArrayList<Base>();
boolean all = true;
for (Base item : focus) {
boolean v = false;
if (item instanceof BooleanType) {
v = ((BooleanType) item).booleanValue();
} else
v = item != null;
if (!v) {
all = false;
break;
}
}
result.add(new BooleanType(all));
return result;
}
}
use of org.hl7.fhir.r4.model.BooleanType in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method funcEmpty.
private List<Base> funcEmpty(ExecutionContext context, List<Base> focus, ExpressionNode exp) {
List<Base> result = new ArrayList<Base>();
result.add(new BooleanType(focus.isEmpty()));
return result;
}
Aggregations