Utilities { public static Day julianEaster3(int year, boolean gregorian) { int a = year % 19; int b = year % 4; int c = year % 7; int d = (19 * a + 15) % 30; int e = (2 * b + 4 * c - d + 34) % 7; int f = d + e + 114; int month = f / 31; int day = (f % 31) + 1; Day easterJ = new Day(year, Month.valueOf(month - 1), day - 1); if (gregorian) { return JDN2GregorianDate(julianDate2JDN(year, month, day)); } else { return easterJ; } }  static int[] daysCount(TsDomain domain); static int[] daysCount(TsDomain domain, DayOfWeek day); static Day easter(int y); static Day easter2(int y); @Deprecated static Day julianEaster(int year, boolean gregorian); @Deprecated static Day julianEaster2(int year, boolean gregorian); static int julianDate2JDN(int year, int month, int day); static int gregorianDate2JDN(int year, int month, int day); static Day JDN2GregorianDate(int jdn); static Day julianEaster3(int year, boolean gregorian); static Day firstWeekDay(DayOfWeek day, int year, Month month); static int[] lastDay(TsDomain domain); static void leapYear(TsPeriod start, DataBlock buffer); static void lengthofPeriod(TsPeriod start, DataBlock buffer); static double logJacobian(LengthOfPeriodType kind, TsDomain domain,
            boolean back); @Deprecated static int[][] tradingDays(TsDomain domain); static int[][] tdCount(TsDomain domain); static void transform(LengthOfPeriodType kind, TsData tsdata,
            boolean back); static double probJulianEaster(int pos); static double probEaster(int pos); static final double LUNARY; }
@Test public void testJulianEaster3() { for (int i = 2000; i < 3000; ++i) { assertTrue(Utilities.julianEaster3(i, true).getDayOfWeek() == DayOfWeek.Sunday); } }
@Test @Ignore public void computeJulianEasterDistribution() { System.out.println(""); int[] prob = new int[50]; for (int i = 0; i < 2 * Utilities.CYCLE; ++i) { Day julianEaster = Utilities.julianEaster3(1583 + i, true); Day first = new Day(1583 + i, Month.April, 0); prob[julianEaster.difference(first)]++; } for (int i = 0; i < 50; ++i) { System.out.println(prob[i]); } System.out.println(""); }
@Test @Ignore public void computeJulianEasterMeanCorrections() { int[] prob = new int[50]; for (int i = 0; i < 2 * Utilities.CYCLE; ++i) { Day julianEaster = Utilities.julianEaster3(1583 + i, true); Day first = new Day(1583 + i, Month.April, 0); prob[julianEaster.difference(first)]++; } double[] march = new double[30], april = new double[30], may = new double[30]; for (int l = 1; l <= 30; ++l) { for (int ie = 0; ie < prob.length; ++ie) { double p = prob[ie]; if (p > 0) { int d0 = ie - l, d1 = ie; int n0 = -d0; if (n0 > 0) { march[l - 1] +=p * n0; }else{ n0=0; } int n1=Math.min(d1, 30)-Math.max(0, d0); if (n1 > 0) { april[l - 1] += p * n1; }else n1=0; int n2=l-n1-n0; if (n2 > 0) { may[l - 1] += p * n2; } } } } for (int i = 0; i < march.length; ++i) { System.out.print(march[i]); System.out.print('\t'); } System.out.println(""); for (int i = 0; i < april.length; ++i) { System.out.print(april[i]); System.out.print('\t'); } System.out.println(""); for (int i = 0; i < may.length; ++i) { System.out.print(may[i]); System.out.print('\t'); } System.out.println(""); }