Class FutureQueue
java.lang.Object
org.cloudbus.cloudsim.core.events.FutureQueue
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new event to the queue.void
addEventFirst
(SimEvent newEvent) Adds a new event to the head of the queue.void
clear()
Clears the queue.first()
Gets the first element of the queue.long
Maximum number of events that have ever existed at the same time inside the queue.long
Gets an incremental number used forSimEvent.getSerial()
event attribute.boolean
isEmpty()
Checks if the queue is empty.iterator()
Returns an iterator to the elements into the queue.boolean
Removes the event from the queue.boolean
removeAll
(Collection<SimEvent> events) Removes all the events from the queue.boolean
int
size()
Returns the size of this event queue.stream()
Returns a stream to the elements into the queue.
-
Constructor Details
-
FutureQueue
public FutureQueue()
-
-
Method Details
-
addEvent
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 interfaceEventQueue
- Parameters:
newEvent
- The event to be put in the queue.
-
addEventFirst
Adds a new event to the head of the queue.- Parameters:
newEvent
- The event to be put in the queue.
-
iterator
Description copied from interface:EventQueue
Returns an iterator to the elements into the queue.- Specified by:
iterator
in interfaceEventQueue
- Returns:
- the iterator
-
stream
Description copied from interface:EventQueue
Returns a stream to the elements into the queue.- Specified by:
stream
in interfaceEventQueue
- Returns:
- the stream
-
size
public int size()Description copied from interface:EventQueue
Returns the size of this event queue.- Specified by:
size
in interfaceEventQueue
- Returns:
- the size
-
isEmpty
public boolean isEmpty()Description copied from interface:EventQueue
Checks if the queue is empty.- Specified by:
isEmpty
in interfaceEventQueue
- Returns:
- true if the queue is empty, false otherwise
-
remove
Removes the event from the queue.- Parameters:
event
- the event- Returns:
- true if successful; false if not event was removed
-
removeAll
Removes all the events from the queue.- Parameters:
events
- the events- Returns:
- true if successful; false if not event was removed
-
removeIf
-
first
Description copied from interface:EventQueue
Gets the first element of the queue.- Specified by:
first
in interfaceEventQueue
- 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 forSimEvent.getSerial()
event attribute. -
getMaxEventsNumber
public long getMaxEventsNumber()Maximum number of events that have ever existed at the same time inside the queue.
-