org.quartz
Class TriggerUtils

java.lang.Object
  extended by org.quartz.TriggerUtils

public class TriggerUtils
extends Object

Convenience and utility methods for working with Triggers.

Author:
James House
See Also:
CronTrigger, SimpleTrigger, DateBuilder

Method Summary
static Date computeEndTimeToAllowParticularNumberOfFirings(OperableTrigger trigg, Calendar cal, int numTimes)
          Compute the Date that is 1 second after the Nth firing of the given Trigger, taking the triger's associated Calendar into consideration.
static List<Date> computeFireTimes(OperableTrigger trigg, Calendar cal, int numTimes)
          Returns a list of Dates that are the next fire times of a Trigger.
static List<Date> computeFireTimesBetween(OperableTrigger trigg, Calendar cal, Date from, Date to)
          Returns a list of Dates that are the next fire times of a Trigger that fall within the given date range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

computeFireTimes

public static List<Date> computeFireTimes(OperableTrigger trigg,
                                          Calendar cal,
                                          int numTimes)
Returns a list of Dates that are the next fire times of a Trigger. The input trigger will be cloned before any work is done, so you need not worry about its state being altered by this method.

Parameters:
trigg - The trigger upon which to do the work
cal - The calendar to apply to the trigger's schedule
numTimes - The number of next fire times to produce
Returns:
List of java.util.Date objects

computeEndTimeToAllowParticularNumberOfFirings

public static Date computeEndTimeToAllowParticularNumberOfFirings(OperableTrigger trigg,
                                                                  Calendar cal,
                                                                  int numTimes)
Compute the Date that is 1 second after the Nth firing of the given Trigger, taking the triger's associated Calendar into consideration. The input trigger will be cloned before any work is done, so you need not worry about its state being altered by this method.

Parameters:
trigg - The trigger upon which to do the work
cal - The calendar to apply to the trigger's schedule
numTimes - The number of next fire times to produce
Returns:
the computed Date, or null if the trigger (as configured) will not fire that many times.

computeFireTimesBetween

public static List<Date> computeFireTimesBetween(OperableTrigger trigg,
                                                 Calendar cal,
                                                 Date from,
                                                 Date to)
Returns a list of Dates that are the next fire times of a Trigger that fall within the given date range. The input trigger will be cloned before any work is done, so you need not worry about its state being altered by this method.

NOTE: if this is a trigger that has previously fired within the given date range, then firings which have already occurred will not be listed in the output List.

Parameters:
trigg - The trigger upon which to do the work
cal - The calendar to apply to the trigger's schedule
from - The starting date at which to find fire times
to - The ending date at which to stop finding fire times
Returns:
List of java.util.Date objects


Copyright 2001-2019, Terracotta, Inc.