@Test public void cronScheduleEmpty() { Schedule sch = makeCronSchedule("0 0 12 * * ?"); ScheduledTime t = new ScheduledTime("2013-11-25T20:00Z"); Set<ScheduledTime> times = sch.getScheduledTimes(null, t, t); Assert.assertEquals(0, times.size()); }
@Override public SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end) { SortedSet<ScheduledTime> scheduledTimes = new TreeSet<ScheduledTime>(); DateTime startDT = start.getDateTime(); DateTime endDT = end.getDateTime(); if (!startDT.isBefore(endDT)) { return scheduledTimes; } if (cronExpression.isSatisfiedBy(startDT.toDate())) { scheduledTimes.add(start); } DateTime candidate = startDT; while((candidate = getNextDateTime(candidate)) != null && candidate.isBefore(endDT)) { scheduledTimes.add(new ScheduledTime(candidate)); } return scheduledTimes; }
CronSchedule implements Schedule { @Override public SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end) { SortedSet<ScheduledTime> scheduledTimes = new TreeSet<ScheduledTime>(); DateTime startDT = start.getDateTime(); DateTime endDT = end.getDateTime(); if (!startDT.isBefore(endDT)) { return scheduledTimes; } if (cronExpression.isSatisfiedBy(startDT.toDate())) { scheduledTimes.add(start); } DateTime candidate = startDT; while((candidate = getNextDateTime(candidate)) != null && candidate.isBefore(endDT)) { scheduledTimes.add(new ScheduledTime(candidate)); } return scheduledTimes; } }
CronSchedule implements Schedule { @Override public SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end) { SortedSet<ScheduledTime> scheduledTimes = new TreeSet<ScheduledTime>(); DateTime startDT = start.getDateTime(); DateTime endDT = end.getDateTime(); if (!startDT.isBefore(endDT)) { return scheduledTimes; } if (cronExpression.isSatisfiedBy(startDT.toDate())) { scheduledTimes.add(start); } DateTime candidate = startDT; while((candidate = getNextDateTime(candidate)) != null && candidate.isBefore(endDT)) { scheduledTimes.add(new ScheduledTime(candidate)); } return scheduledTimes; } CronSchedule(String cronConfig); }
CronSchedule implements Schedule { @Override public SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end) { SortedSet<ScheduledTime> scheduledTimes = new TreeSet<ScheduledTime>(); DateTime startDT = start.getDateTime(); DateTime endDT = end.getDateTime(); if (!startDT.isBefore(endDT)) { return scheduledTimes; } if (cronExpression.isSatisfiedBy(startDT.toDate())) { scheduledTimes.add(start); } DateTime candidate = startDT; while((candidate = getNextDateTime(candidate)) != null && candidate.isBefore(endDT)) { scheduledTimes.add(new ScheduledTime(candidate)); } return scheduledTimes; } CronSchedule(String cronConfig); String getCronExpression(); @Override SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end); }
CronSchedule implements Schedule { @Override public SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end) { SortedSet<ScheduledTime> scheduledTimes = new TreeSet<ScheduledTime>(); DateTime startDT = start.getDateTime(); DateTime endDT = end.getDateTime(); if (!startDT.isBefore(endDT)) { return scheduledTimes; } if (cronExpression.isSatisfiedBy(startDT.toDate())) { scheduledTimes.add(start); } DateTime candidate = startDT; while((candidate = getNextDateTime(candidate)) != null && candidate.isBefore(endDT)) { scheduledTimes.add(new ScheduledTime(candidate)); } return scheduledTimes; } CronSchedule(String cronConfig); String getCronExpression(); @Override SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end);  }