package net.heartshield.filter;

import org.apache.commons.math3.complex.Complex;

/**
 * Realtime batch-processing filter block interface.
 * Real input, complex output.
 *
 * @author David Madl (git@abanbytes.eu)
 * @date 2017-03-26
 */
public abstract class RCFilterBlock implements IRFilterBlock {
    protected CFilterBlock mConsumer;

    public void connect(CFilterBlock consumer) {
        mConsumer = consumer;
    }

    /** batch-add an array and push results through consumers */
    @Override
    public void put(double[] x) {
        mConsumer.put(this.batch(x));
    }

    /** batch-process an array and return array of output values */
    protected abstract Complex[] batch(double[] x);
}
