class TrendCycleFilterFactory {

    public static SymmetricFilter makeHendersonFilter(int length) {
	if (length % 2 == 0)
	    throw new LinearFilterException("Invalid length for Henderson filter. Should be odd");
	int m = length / 2;
	double[] c = new double[m + 1];
	int n = m + 2;

	double n2 = n * n;
	for (int i = 0; i < m + 1; i++) {
	    double ii = (i - m) * (i - m);
	    double up = 315 * (n2 - n * 2 + 1 - (ii));
	    up *= n2 - ii;
	    up *= n2 + n * 2 + 1 - ii;
	    up *= n2 * 3 - 16 - ii * 11;
	    double down = n * 8;
	    down *= n2 - 1;
	    down *= n2 * 4 - 1;
	    down *= n2 * 4 - 9;
	    down *= n2 * 4 - 25;
	    c[m - i] = up / down;
	}
	return SymmetricFilter.of(c);
    }

    private  TrendCycleFilterFactory();

}