package net.heartshield.filter;

/**
 * Realtime batch-processing filter block interface.
 *
 * @author David Madl (git@abanbytes.eu)
 * @date 2017-03-26
 */
public abstract class FFilterBlock implements IFFilterBlock {
    protected IFFilterBlock mConsumer;

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

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

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