EasterRelatedDay implements ISpecialDay { @Override public double[][] getLongTermMeanEffect(int freq) { int w = offset % 7; if (w == 0) { return null; } if (w < 0) { w += 7; } --w; int d0, d1; if (julian) { d0 = JSTART + offset; d1 = d0 + JDEL; } else { d0 = START + offset; d1 = d0 + DEL; } int ifreq = (int) freq; int c = 12 / ifreq; int c0 = 0, c1 = 0; for (int i = 0; i < c; ++i) { c1 += g_days[i]; } double[][] rslt = new double[ifreq][]; for (int i = 0; i < ifreq;) { if (d0 < c1 && d1 > c0) { double[] m = new double[7]; double x = 0; for (int j = Math.max(d0, c0); j < Math.min(d1, c1); ++j) { x += probEaster(j - d0); } m[w] = x * weight; m[6] = -m[w]; rslt[i] = m; } c0 = c1; if (++i < ifreq) { for (int j = 0; j < c; ++j) { c1 += g_days[i * c + j]; } } } return rslt; } EasterRelatedDay();  EasterRelatedDay(int offset);  EasterRelatedDay(int offset, boolean julian);  EasterRelatedDay(int offset, double weight);  EasterRelatedDay(int offset, double weight, boolean julian); EasterRelatedDay reweight(double nweight); EasterRelatedDay plus(int ndays); boolean isJulian(); @Override double getWeight(); @Override boolean match(Context context); Day calcDay(int year); @Override Iterable<IDayInfo> getIterable(TsFrequency freq, Day start, Day end); @Override double[][] getLongTermMeanEffect(int freq); @Override boolean equals(Object obj); @Override int hashCode(); @Override TsDomain getSignificantDomain(TsFrequency freq, Day start, Day end); final int offset; static final EasterRelatedDay ShroveMonday; }
@Test public void testLongTermCorrection() { double w = .88; EasterRelatedDay day = new EasterRelatedDay(-39, w); double[][] le = day.getLongTermMeanEffect(12); double p = 0; for (int i = 0; i < 6; ++i) { for (int j = 0; j < le.length; ++j) { if (le[j] != null) { p += le[j][i]; } } } org.junit.Assert.assertTrue(Math.abs(p - w) < 1e-9); }