package net.heartshield.filter;

import net.heartshield.signal.CVec;

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

/**
 * Filter block accepting data and storing it into an array.
 *
 * @author David Madl (git@abanbytes.eu)
 * @date 2017-03-26
 */
public class CDataSink implements CFilterBlock {
    private Complex[] mData;

    CDataSink() {
        mData = new Complex[0];
    }

    public Complex[] getData() {
        return mData;
    }

    @Override
    public void put(Complex[] x) {
        mData = CVec.stack(mData, x);
    }

    protected Complex[] batch(Complex[] x) {
        throw new IllegalStateException("should not call batch() here");
    }
}
