import { throwFilterOutput } from "./filter-operators.js";
import { filterPush } from "./filter-push.js";
import "compare-utf8";
class Filter {
  #input;
  #predicate;
  #output = throwFilterOutput;
  constructor(input, predicate) {
    this.#input = input;
    this.#predicate = predicate;
    input.setFilterOutput(this);
  }
  beginFilter() {
    this.#output.beginFilter();
  }
  endFilter() {
    this.#output.endFilter();
  }
  *filter(node) {
    return this.#predicate(node.row) && (yield* this.#output.filter(node));
  }
  setFilterOutput(output) {
    this.#output = output;
  }
  destroy() {
    this.#input.destroy();
  }
  getSchema() {
    return this.#input.getSchema();
  }
  *push(change) {
    yield* filterPush(change, this.#output, this, this.#predicate);
  }
}
export {
  Filter
};
//# sourceMappingURL=filter.js.map
