Class FutureQueue

java.lang.Object
org.cloudbus.cloudsim.core.events.FutureQueue
All Implemented Interfaces:
EventQueue

public class FutureQueue extends Object implements EventQueue
An EventQueue that stores future simulation events. It uses a TreeSet in order ensure the events are stored ordered. Using a LinkedList as defined by DeferredQueue to improve performance doesn't work for this queue.
Since:
CloudSim Toolkit 1.0
Author:
Marcos Dias de Assuncao, Manoel Campos da Silva Filho
See Also:
  • Constructor Details

    • FutureQueue

      public FutureQueue()
  • Method Details

    • addEvent

      public void addEvent(SimEvent newEvent)
      Description copied from interface: EventQueue
      Adds a new event to the queue. Adding a new event to the queue preserves the temporal order of the events in the queue.
      Specified by:
      addEvent in interface EventQueue
      Parameters:
      newEvent - The event to be put in the queue.
    • addEventFirst

      public void addEventFirst(SimEvent newEvent)
      Adds a new event to the head of the queue.
      Parameters:
      newEvent - The event to be put in the queue.
    • iterator

      public Iterator<SimEvent> iterator()
      Description copied from interface: EventQueue
      Returns an iterator to the elements into the queue.
      Specified by:
      iterator in interface EventQueue
      Returns:
      the iterator
    • stream

      public Stream<SimEvent> stream()
      Description copied from interface: EventQueue
      Returns a stream to the elements into the queue.
      Specified by:
      stream in interface EventQueue
      Returns:
      the stream
    • size

      public int size()
      Description copied from interface: EventQueue
      Returns the size of this event queue.
      Specified by:
      size in interface EventQueue
      Returns:
      the size
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: EventQueue
      Checks if the queue is empty.
      Specified by:
      isEmpty in interface EventQueue
      Returns:
      true if the queue is empty, false otherwise
    • remove

      public boolean remove(SimEvent event)
      Removes the event from the queue.
      Parameters:
      event - the event
      Returns:
      true if successful; false if not event was removed
    • removeAll

      public boolean removeAll(Collection<SimEvent> events)
      Removes all the events from the queue.
      Parameters:
      events - the events
      Returns:
      true if successful; false if not event was removed
    • removeIf

      public boolean removeIf(Predicate<SimEvent> predicate)
    • first

      public SimEvent first() throws NoSuchElementException
      Description copied from interface: EventQueue
      Gets the first element of the queue.
      Specified by:
      first in interface EventQueue
      Returns:
      the first element
      Throws:
      NoSuchElementException - when the queue is empty
    • clear

      public void clear()
      Clears the queue.
    • getSerial

      public long getSerial()
      Gets an incremental number used for SimEvent.getSerial() event attribute.
    • getMaxEventsNumber

      public long getMaxEventsNumber()
      Maximum number of events that have ever existed at the same time inside the queue.