execute method

  1. @override
List execute(
  1. List results,
  2. Map<String, dynamic> passed
)
override

The iterable, nested function that evaluates the entire FHIRPath expression one object at a time

Implementation

@override
List execute(List results, Map<String, dynamic> passed) {
  final executedBefore = before.execute(results.toList(), passed);
  final executedAfter = after.execute(results.toList(), passed);

  final beforeBool = SingletonEvaluation.toBool(executedBefore,
      name: "parameter before 'xor'", operation: 'xor', collection: results);
  final afterBool = SingletonEvaluation.toBool(executedAfter,
      name: "parameter after 'xor'", operation: 'xor', collection: results);

  if (beforeBool == null || afterBool == null) {
    return [];
  }

  if (beforeBool == false && afterBool == false) {
    return [false];
  }

  if (beforeBool == true && afterBool == true) {
    return [false];
  }

  return [true];
}