/** * Return true if the given Date is on the same day as Easter */ @Override public boolean isOn(Date date) { synchronized(calendar) { calendar.setTime(date); int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); calendar.setTime(computeInYear(calendar.getTime(), calendar)); return calendar.get(Calendar.DAY_OF_YEAR) == dayOfYear; } }
gregorianCutoverYear = cal.get(EXTENDED_YEAR);
cal.setTime(date); int year = cal.get(Calendar.YEAR); int g = year % 19; // "Golden Number" of year - 1 int i = 0; // # of days from 3/21 to the Paschal full moon
private Date doFirstBetween(Date start, Date end) { //System.out.println("doFirstBetween: start = " + start.toString()); //System.out.println("doFirstBetween: end = " + end.toString()); synchronized(calendar) { // Figure out when this holiday lands in the given year Date result = computeInYear(start, calendar); //System.out.println(" result = " + result.toString()); // We might have gotten a date that's in the same year as "start", but // earlier in the year. If so, go to next year if (result.before(start)) { calendar.setTime(start); calendar.get(Calendar.YEAR); // JDK 1.1.2 bug workaround calendar.add(Calendar.YEAR, 1); //System.out.println(" Result before start, going to next year: " // + calendar.getTime().toString()); result = computeInYear(calendar.getTime(), calendar); //System.out.println(" result = " + result.toString()); } if (end != null && !result.before(end)) { //System.out.println("Result after end, returning null"); return null; } return result; } }