Class HybridEventQueue
java.lang.Object
simEngine.HybridEventQueue
- All Implemented Interfaces:
Iterable<SimEvent>, EventQueue
Name: HybridEventQueue
Description: An hybrid implementation for the EventQueue interface. Future events are inserted and retrieved in a sorted binary heap with log(n) performances, while events for the current time interval are inserted and retrieved using an unbounded circular list.
Date: 12/mag/2009 Time: 18:40:26
- Version:
- 1.1
- Author:
- Bertoli Marco
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds an event to the queuevoidclear()Clears this queue, removing all pointersiterator()Returns an iterator that iterates over this queue elements in no special order.peek()Method peek.pop()Method pop.booleanRemoves given eventintsize()Method size.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
HybridEventQueue
public HybridEventQueue()
-
-
Method Details
-
add
Description copied from interface:EventQueueAdds an event to the queue- Specified by:
addin interfaceEventQueue- Parameters:
event- the event to add- Returns:
- true if element was added, false otherwise.
-
clear
public void clear()Description copied from interface:EventQueueClears this queue, removing all pointers- Specified by:
clearin interfaceEventQueue
-
iterator
Description copied from interface:EventQueueReturns an iterator that iterates over this queue elements in no special order. Iterator must implement remove() method.- Specified by:
iteratorin interfaceEventQueue- Specified by:
iteratorin interfaceIterable<SimEvent>- Returns:
- an iterator with no special order.
-
peek
Description copied from interface:EventQueueMethod peek.- Specified by:
peekin interfaceEventQueue- Returns:
- the first event of the queue, without removing it
-
pop
Description copied from interface:EventQueueMethod pop.- Specified by:
popin interfaceEventQueue- Returns:
- the first event of the queue, removing it from the queue
-
remove
Description copied from interface:EventQueueRemoves given event- Specified by:
removein interfaceEventQueue- Parameters:
event- the event to remove- Returns:
- true if event was found, false otherwise
-
size
public int size()Description copied from interface:EventQueueMethod size.- Specified by:
sizein interfaceEventQueue- Returns:
- the number of events in this queue
-