Table of Contents

Class TriggerFireTimes

Namespace
Quartz.Extensibility
Assembly
Quartz.dll

Answers what a trigger would fire, without scheduling it.

public static class TriggerFireTimes
Inheritance
TriggerFireTimes
Inherited Members

Remarks

The primary overloads take an IOperableTrigger rather than an ITrigger because answering the question means advancing a copy of the trigger through its schedule, applying the calendar at each step — which is precisely what IOperableTrigger adds over ITrigger. That is why this lives here rather than in the Quartz namespace: it is a helper over the operable-trigger contract, not part of the scheduling API.

Each has an ITrigger twin that casts, because testing a schedule is the most mainstream thing anybody does with these and requiring the cast at every call site taught a Quartz.Extensibility type to people who wanted neither. The cast is the same one you would write: every trigger this library builds is an IOperableTrigger, and one that is not gets an ArgumentException naming the type rather than an InvalidCastException from inside.

Methods

Compute(IOperableTrigger, ICalendar?, int)

Returns a list of Dates that are the next fire times of a ITrigger. The input trigger will be cloned before any work is done, so you need not worry about its state being altered by this method.

public static List<DateTimeOffset> Compute(IOperableTrigger trigger, ICalendar? calendar, int numberOfTimes)

Parameters

trigger IOperableTrigger

The trigger upon which to do the work

calendar ICalendar

The calendar to apply to the trigger's schedule

numberOfTimes int

The number of next fire times to produce

Returns

List<DateTimeOffset>

Compute(ITrigger, ICalendar?, int)

Returns a list of Dates that are the next fire times of a ITrigger. The input trigger will be cloned before any work is done, so you need not worry about its state being altered by this method.

public static List<DateTimeOffset> Compute(ITrigger trigger, ICalendar? calendar, int numberOfTimes)

Parameters

trigger ITrigger

The trigger upon which to do the work

calendar ICalendar

The calendar to apply to the trigger's schedule

numberOfTimes int

The number of next fire times to produce

Returns

List<DateTimeOffset>

Exceptions

ArgumentException

trigger is not an IOperableTrigger, so its schedule cannot be advanced.

ComputeBetween(IOperableTrigger, ICalendar?, DateTimeOffset, DateTimeOffset)

Returns a list of Dates that are the next fire times of a ITrigger 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.

public static List<DateTimeOffset> ComputeBetween(IOperableTrigger trigger, ICalendar? calendar, DateTimeOffset from, DateTimeOffset to)

Parameters

trigger IOperableTrigger

The trigger upon which to do the work

calendar ICalendar

The calendar to apply to the trigger's schedule

from DateTimeOffset

The starting date at which to find fire times, inclusive

to DateTimeOffset

The ending date at which to stop finding fire times, inclusive: a fire time that lands exactly on it is listed. The window is handed to the trigger as its EndTimeUtc, which is inclusive for the same reason.

Returns

List<DateTimeOffset>

ComputeBetween(ITrigger, ICalendar?, DateTimeOffset, DateTimeOffset)

Returns a list of Dates that are the next fire times of a ITrigger 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.

public static List<DateTimeOffset> ComputeBetween(ITrigger trigger, ICalendar? calendar, DateTimeOffset from, DateTimeOffset to)

Parameters

trigger ITrigger

The trigger upon which to do the work

calendar ICalendar

The calendar to apply to the trigger's schedule

from DateTimeOffset

The starting date at which to find fire times, inclusive

to DateTimeOffset

The ending date at which to stop finding fire times, inclusive: a fire time that lands exactly on it is listed. The window is handed to the trigger as its EndTimeUtc, which is inclusive for the same reason.

Returns

List<DateTimeOffset>

Exceptions

ArgumentException

trigger is not an IOperableTrigger, so its schedule cannot be advanced.

ComputeEndTimeForCount(IOperableTrigger, ICalendar?, int)

Compute the DateTimeOffset that is 1 second after the Nth firing of the given ITrigger, taking the trigger's associated ICalendar into consideration.

public static DateTimeOffset? ComputeEndTimeForCount(IOperableTrigger trigger, ICalendar? calendar, int numberOfTimes)

Parameters

trigger IOperableTrigger

The trigger upon which to do the work

calendar ICalendar

The calendar to apply to the trigger's schedule

numberOfTimes int

The number of next fire times to produce

Returns

DateTimeOffset?

the computed Date, or null if the trigger (as configured) will not fire that many times

Remarks

The input trigger will be cloned before any work is done, so you need not worry about its state being altered by this method.

ComputeEndTimeForCount(ITrigger, ICalendar?, int)

Compute the DateTimeOffset that is 1 second after the Nth firing of the given ITrigger, taking the trigger's associated ICalendar into consideration.

public static DateTimeOffset? ComputeEndTimeForCount(ITrigger trigger, ICalendar? calendar, int numberOfTimes)

Parameters

trigger ITrigger

The trigger upon which to do the work

calendar ICalendar

The calendar to apply to the trigger's schedule

numberOfTimes int

The number of next fire times to produce

Returns

DateTimeOffset?

the computed Date, or null if the trigger (as configured) will not fire that many times

Remarks

The input trigger will be cloned before any work is done, so you need not worry about its state being altered by this method.

Exceptions

ArgumentException

trigger is not an IOperableTrigger, so its schedule cannot be advanced.

See Also