Class DeferredQueue
java.lang.Object
org.cloudsimplus.core.events.DeferredQueue
- All Implemented Interfaces:
EventQueue
An
EventQueue that orders SimEvents based on their time attribute.
Since the time of a new event is usually equal or higher than the previous event
in regular simulations, this class uses a LinkedList instead
of a SortedSet such as TreeSet
because the LinkedList provides constant O(1) complexity
to add elements to the end.- Since:
- CloudSim Plus 4.4.2
- Author:
- Marcos Dias de Assuncao, Manoel Campos da Silva Filho
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new event to the queue, preserving the temporal order of the events.voidclear()Clears the queue removing all elements.first()booleanisEmpty()Returns true if the queue is empty, false otherwise.iterator()booleanRemoves the event from the queue.booleanremoveAll(Collection<SimEvent> events) Removes all the given events from the queue.booleanRemoves events that match a givenPredicate.intsize()stream()
-
Constructor Details
-
DeferredQueue
public DeferredQueue()
-
-
Method Details
-
addEvent
Adds a new event to the queue, preserving the temporal order of the events.- Specified by:
addEventin interfaceEventQueue- Parameters:
newEvent- the event to be added
-
iterator
- Specified by:
iteratorin interfaceEventQueue- Returns:
- an iterator to the elements into the queue.
-
stream
- Specified by:
streamin interfaceEventQueue- Returns:
- a stream to the elements into the queue.
-
size
public int size()- Specified by:
sizein interfaceEventQueue- Returns:
- the size of this event queue.
-
isEmpty
public boolean isEmpty()Description copied from interface:EventQueueReturns true if the queue is empty, false otherwise.- Specified by:
isEmptyin 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 otherwise
-
removeAll
Removes all the given events from the queue.- Parameters:
events- the events to be removed- Returns:
- true if successful; false otherwise
-
removeIf
-
clear
public void clear()Clears the queue removing all elements. -
first
- Specified by:
firstin interfaceEventQueue- Returns:
- the first element of the queue.
- Throws:
NoSuchElementException- when the queue is empty
-