Interface EventListInterface<T extends Number & Comparable<T>>
- Type Parameters:
T
- The time type, e.g., Double, Long, Duration
- All Superinterfaces:
Iterable<SimEventInterface<T>>
,Serializable
- All Known Implementing Classes:
EventListPriorityQueue
,RedBlackTree
,TableModelEventList
public interface EventListInterface<T extends Number & Comparable<T>>
extends Serializable, Iterable<SimEventInterface<T>>
The EventListInterface defines the required methods for discrete event lists. A number of competitive algoritms can be used
to implement such eventlist. Among these implementations are the Red-Black, the SplayTree, and others.
Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.
- Since:
- 1.5
- Author:
- Peter Jacobs
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(SimEventInterface<T> event) Add an event to the event list.void
clear()
Clear the event list.boolean
contains
(SimEventInterface<T> event) Return whether this event list contains the given event.first()
Returns the first event (lowest time / priority) of the event list.boolean
isEmpty()
Return whether the event list is empty.iterator()
Provide an iterator to loop over the event list.boolean
remove
(SimEventInterface<T> event) Remove the given event from the event list.Returns and removes the first event (lowest time / priority) of the event list.int
size()
Return the number of events on the event list.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
add
Add an event to the event list.- Parameters:
event
- SimEventInterface<T>; the event to add
-
contains
Return whether this event list contains the given event.- Parameters:
event
- SimEventInterface<T>; the event to search for- Returns:
- boolean; whether the event list contains the given event
-
clear
void clear()Clear the event list. -
isEmpty
boolean isEmpty()Return whether the event list is empty.- Returns:
- boolean; whether the event list is empty
-
iterator
Iterator<SimEventInterface<T>> iterator()Provide an iterator to loop over the event list. -
remove
Remove the given event from the event list.- Parameters:
event
- SimEventInterface<T>; the event to remove- Returns:
- boolean to indicate success of the removal operation
-
size
int size()Return the number of events on the event list.- Returns:
- int; the number of events on the event list
-
first
SimEventInterface<T> first()Returns the first event (lowest time / priority) of the event list. The method returns null when the event list is empty.- Returns:
- SimEventInterface<T>; the first element currently in this event list, or null when the list is empty
-
removeFirst
SimEventInterface<T> removeFirst()Returns and removes the first event (lowest time / priority) of the event list. The method returns null when the event list is empty.- Returns:
- SimEventInterface<T>; the first element in this event list before removal, or null when the list is empty
-