filter method
List<TreeReference>
filter(
- DataInstance sourceInstance,
- TreeReference nodeset,
- XPathExpression predicate,
- List<
TreeReference> children, - EvaluationContext context,
- 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 passed = <TreeReference>[];
for (var i = 0; i < children.length; i++) {
final childContext = context.rescope(children[i], i);
Measure.log('PredicateEvaluation');
if (predicate.eval(sourceInstance, childContext) == true) {
passed.add(children[i]);
}
}
return passed;
}