filter method

  1. @override
List<TreeReference> filter(
  1. DataInstance sourceInstance,
  2. TreeReference nodeset,
  3. XPathExpression predicate,
  4. List<TreeReference> children,
  5. EvaluationContext context,
  6. List<TreeReference> next(),
)
override

The children of nodeset that pass predicate, or the result of next (the rest of the chain) when this strategy doesn't apply.

Implementation

@override
List<TreeReference> filter(
  DataInstance sourceInstance,
  TreeReference nodeset,
  XPathExpression predicate,
  List<TreeReference> children,
  EvaluationContext context,
  List<TreeReference> Function() next,
) {
  final key = '$nodeset$predicate';
  final cached = _cache[key];
  if (cached != null) return cached;
  final filtered = next();
  if (predicate.isIdempotent) _cache[key] = filtered;
  return filtered;
}