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 'implies'",
      operation: 'implies',
      collection: results);
  final afterBool = SingletonEvaluation.toBool(executedAfter,
      name: "parameter after 'implies'",
      operation: 'implies',
      collection: results);

  if (beforeBool == true) {
    return afterBool != null ? [afterBool] : [];
  }

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

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

  return [];
}