import { throwFilterOutput, } from "./filter-operators.js";
import { filterPush } from "./filter-push.js";
import {} from "./data.js";
/**
 * The Filter operator filters data through a predicate. It is stateless.
 *
 * The predicate must be pure.
 */
export class Filter {
    #input;
    #predicate;
    #output = throwFilterOutput;
    constructor(input, predicate) {
        this.#input = input;
        this.#predicate = predicate;
        input.setFilterOutput(this);
    }
    filter(node, cleanup) {
        return this.#predicate(node.row) && this.#output.filter(node, cleanup);
    }
    setFilterOutput(output) {
        this.#output = output;
    }
    destroy() {
        this.#input.destroy();
    }
    getSchema() {
        return this.#input.getSchema();
    }
    push(change) {
        filterPush(change, this.#output, this, this.#predicate);
    }
}
//# sourceMappingURL=filter.js.map