final FilterBuilder filterBuilder = new FilterBuilder();
final DataType testedType = tested.getDataType();
final ExpressionNode filter = filterBuilder.buildFilterByExample( 0, this.test, testedType );
final ExpressionNodeForFoldDatabase apply;
if (this.folded == null) {
apply = new ExpressionNodeForFoldDatabase( this.fold, New.array( testedType ), this.colPrefix(), filter, 0,
null, null, tested );
}
else {
TypeAnnotator.annotateExpr( this.folded );
final DataType foldedType = this.folded.getDataType();
apply = new ExpressionNodeForFoldDatabase( this.fold, New.array( testedType, foldedType ), this.colPrefix(),
filter, 1, null, null, vectorsToMatrix( tested, makeVertical( this.folded ) ) );
}
return filterBuilder.encloseFoldInLets( apply );
}