package org.studiorailgun.schedule;

import java.util.PriorityQueue;

/**
 * Maintains the schedule of events
 */
public class EventScheduler {
    
    /**
     * The queue of events
     */
    PriorityQueue<Event> queue = new PriorityQueue<Event>();


    /**
     * Adds an event to the scheduler
     * @param event The event
     */
    public void add(Event event){
        queue.add(event);
    }

    /**
     * Peeks at the next event in the queue
     * @return The next event
     */
    public Event peek(){
        return queue.peek();
    }

    /**
     * Gets the next scheduled event
     * @return The next scheduled event
     */
    public Event get(){
        return queue.poll();
    }

    /**
     * Removes the event from the schedule
     * @param event The event
     */
    public void remove(Event event){
        queue.remove(event);
    }

    /**
     * Gets the queue of events
     * @return The queue of events
     */
    public PriorityQueue<Event> getQueue(){
        return queue;
    }

}
