CalendarIfc

interface CalendarIfc(source)

The interface defines behavior for holding, adding and retrieving events. The executive uses one calendar, supplied to the model, to find the next event to run.

Canceling is lazy, in every shipped calendar. Setting KSLEvent.cancel to true only marks the event, and the event stays in the calendar until its time comes, when the executive drops it. This avoids rebuilding the underlying structure, and it costs nothing unless a model cancels very many events far in the future, which then stay in memory. A model that does so can supply a calendar that purges them.

A calendar must:

  • be used by one model only, since it holds that model's events;

  • return events in their natural order, by time, then priority, then order of scheduling;

  • keep returning canceled events, or remove them itself, since it isn't told about a cancellation and has to read KSLEvent.cancel;

  • remove everything in clear(), which the executive calls to reset the calendar.

Inheritors

Properties

Link copied to clipboard
abstract val isEmpty: Boolean

Checks to see if the calendar is empty

Link copied to clipboard

Checks to see if the calendar is not empty

Functions

Link copied to clipboard
abstract fun add(event: KSLEvent<*>)

The add method will place the provided JSLEvent into the underlying data structure ensuring the ordering of the events to be processed

Link copied to clipboard
open fun cancel(event: KSLEvent<*>)

Cancels the supplied JSLEvent in the calendar. Canceling does not remove the event from the data structure. It simply indicates that the scheduled event must not be executed.

Link copied to clipboard
abstract fun clear()

Clears or cancels every event in the data structure. Removes all JSLEvents from the data structure.

Link copied to clipboard
abstract fun nextEvent(): KSLEvent<*>?

Returns the next JSLEvent to be executed. The event is removed from the calendar if it exists

Link copied to clipboard
abstract fun peekNext(): KSLEvent<*>?

Peeks at the next event without removing it

Link copied to clipboard
abstract fun size(): Int

Returns the number of events in the calendar