Package jsl.calendar

Class PriorityQueueEventCalendar

  • All Implemented Interfaces:
    CalendarIfc

    public class PriorityQueueEventCalendar
    extends java.lang.Object
    implements CalendarIfc
    This class provides an event calendar by using a priority queue to hold the underlying events.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(JSLEvent event)
      The add method will place the provided JSLEvent into the underlying data structure ensuring the ordering of the events to be processed
      void cancel​(JSLEvent event)
      Cancels the supplied JSLEvent in the calendar.
      void clear()
      Clears or cancels every event in the data structure.
      boolean isEmpty()
      Checks to see if the calendar is empty
      JSLEvent nextEvent()
      Returns the next JSLEvent to be executed.
      JSLEvent peekNext()
      Peeks at the next event without removing it
      int size()
      Returns the number of events in the calendar
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PriorityQueueEventCalendar

        public PriorityQueueEventCalendar()
    • Method Detail

      • add

        public final void add​(JSLEvent event)
        Description copied from interface: CalendarIfc
        The add method will place the provided JSLEvent into the underlying data structure ensuring the ordering of the events to be processed
        Specified by:
        add in interface CalendarIfc
        Parameters:
        event - The JSLEvent to be added to the calendar
      • nextEvent

        public final JSLEvent nextEvent()
        Description copied from interface: CalendarIfc
        Returns the next JSLEvent to be executed. The event is removed from the calendar if it exists
        Specified by:
        nextEvent in interface CalendarIfc
        Returns:
        The JSLEvent to be executed next
      • peekNext

        public final JSLEvent peekNext()
        Description copied from interface: CalendarIfc
        Peeks at the next event without removing it
        Specified by:
        peekNext in interface CalendarIfc
        Returns:
      • isEmpty

        public final boolean isEmpty()
        Description copied from interface: CalendarIfc
        Checks to see if the calendar is empty
        Specified by:
        isEmpty in interface CalendarIfc
        Returns:
        true is empty, false is not empty
      • clear

        public final void clear()
        Description copied from interface: CalendarIfc
        Clears or cancels every event in the data structure. Removes all JSLEvents from the data structure.
        Specified by:
        clear in interface CalendarIfc
      • cancel

        public final void cancel​(JSLEvent event)
        Description copied from interface: CalendarIfc
        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.
        Specified by:
        cancel in interface CalendarIfc
        Parameters:
        event - The JSLEvent to be canceled
      • size

        public int size()
        Description copied from interface: CalendarIfc
        Returns the number of events in the calendar
        Specified by:
        size in interface CalendarIfc
        Returns:
        An int representing the number of events.