Class FutureQueue
- java.lang.Object
-
- org.cloudbus.cloudsim.core.events.FutureQueue
-
- All Implemented Interfaces:
EventQueue
public class FutureQueue extends Object implements EventQueue
This class implements the future event queue used byCloudSim
. The event queue uses aTreeSet
in order to store the events.- Since:
- CloudSim Toolkit 1.0
- Author:
- Marcos Dias de Assuncao
- See Also:
TreeSet
-
-
Constructor Summary
Constructors Constructor Description FutureQueue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEvent(SimEvent newEvent)
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.SimEvent
first()
Gets the first element of the queue.boolean
isEmpty()
Checks if the queue is empty.Iterator<SimEvent>
iterator()
Returns an iterator to the elements into the queue.boolean
remove(SimEvent event)
Removes the event from the queue.boolean
removeAll(Collection<SimEvent> events)
Removes all the events from the queue.boolean
removeIf(Predicate predicate)
int
size()
Returns the size of this event queue.Stream<SimEvent>
stream()
Returns a stream to the elements into the queue.
-
-
-
Method Detail
-
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 interfaceEventQueue
- 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 interfaceEventQueue
- 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 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
public boolean remove(SimEvent event)
Removes the event from the queue.- Parameters:
event
- the event- Returns:
- true, if successful
-
removeAll
public boolean removeAll(Collection<SimEvent> events)
Removes all the events from the queue.- Parameters:
events
- the events- Returns:
- true, if successful
-
removeIf
public boolean removeIf(Predicate predicate)
-
first
public SimEvent first() throws NoSuchElementException
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.
-
-