@Test public void testVaryingNumberOfDailyPeriods() { RollingCalendar rc = new RollingCalendar("yyyy-MM-dd"); final long MILLIS_IN_DAY = 24 * 3600 * 1000; for (int p = 20; p > -100; p--) { long now = 1223325293589L; Date nowDate = new Date(now); Date result = rc.getEndOfNextNthPeriod(nowDate, p); long offset = rc.getTimeZone().getRawOffset() + rc.getTimeZone().getDSTSavings(); long origin = now - ((now + offset) % (MILLIS_IN_DAY)); long expected = origin + p * MILLIS_IN_DAY; assertEquals("p=" + p, expected, result.getTime()); } }
public Date getEndOfNextNthPeriod(Date now, int periods) { return innerGetEndOfNextNthPeriod(this, this.periodicityType, now, periods); }
RollingCalendar extends GregorianCalendar { public Date getEndOfNextNthPeriod(Date now, int periods) { return innerGetEndOfNextNthPeriod(this, this.periodicityType, now, periods); } }
RollingCalendar extends GregorianCalendar { public Date getEndOfNextNthPeriod(Date now, int periods) { return innerGetEndOfNextNthPeriod(this, this.periodicityType, now, periods); } RollingCalendar(String datePattern);  RollingCalendar(String datePattern, TimeZone tz, Locale locale); }
RollingCalendar extends GregorianCalendar { public Date getEndOfNextNthPeriod(Date now, int periods) { return innerGetEndOfNextNthPeriod(this, this.periodicityType, now, periods); } RollingCalendar(String datePattern);  RollingCalendar(String datePattern, TimeZone tz, Locale locale); PeriodicityType getPeriodicityType(); PeriodicityType computePeriodicityType(); boolean isCollisionFree(); void printPeriodicity(ContextAwareBase cab); long periodBarriersCrossed(long start, long end); static int diffInMonths(long startTime, long endTime); Date getEndOfNextNthPeriod(Date now, int periods); Date getNextTriggeringDate(Date now); long getStartOfCurrentPeriodWithGMTOffsetCorrection(long now, TimeZone timezone); }
RollingCalendar extends GregorianCalendar { public Date getEndOfNextNthPeriod(Date now, int periods) { return innerGetEndOfNextNthPeriod(this, this.periodicityType, now, periods); } RollingCalendar(String datePattern);  RollingCalendar(String datePattern, TimeZone tz, Locale locale); PeriodicityType getPeriodicityType(); PeriodicityType computePeriodicityType(); boolean isCollisionFree(); void printPeriodicity(ContextAwareBase cab); long periodBarriersCrossed(long start, long end); static int diffInMonths(long startTime, long endTime); Date getEndOfNextNthPeriod(Date now, int periods); Date getNextTriggeringDate(Date now); long getStartOfCurrentPeriodWithGMTOffsetCorrection(long now, TimeZone timezone);  }