Package org.opentrafficsim.core.dsol
Class SynchronizedRedBlackTree<T extends Number & Comparable<T>>
java.lang.Object
org.opentrafficsim.core.dsol.SynchronizedRedBlackTree<T>
- Type Parameters:
T
- the type of simulation time, e.g. SimTimeCalendarLong or SimTimeDouble or SimTimeDoubleUnit.
- All Implemented Interfaces:
Serializable
,Iterable<nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T>>
,nl.tudelft.simulation.dsol.eventlists.EventListInterface<T>
public class SynchronizedRedBlackTree<T extends Number & Comparable<T>>
extends Object
implements nl.tudelft.simulation.dsol.eventlists.EventListInterface<T>, Serializable
A SynchronizedRedBlackTree implementation of the eventlistInterface. This implementation is based on Java's TreeSet.
(c) copyright 2002-2005 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.
- Since:
- 1.5
- Author:
- Peter Jacobs
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
clear()
boolean
nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T>
first()
we re-implemented the first method.boolean
isEmpty()
iterator()
boolean
nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T>
int
size()
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SynchronizedRedBlackTree
public SynchronizedRedBlackTree()Constructs a newSynchronizedRedBlackTree
.
-
-
Method Details
-
removeFirst
- Specified by:
removeFirst
in interfacenl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
-
first
we re-implemented the first method. Instead of throwing exceptions if the tree is empty, we return a null value.- Specified by:
first
in interfacenl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
- Returns:
- the first SimEvent in the tree.
- See Also:
-
size
public int size()- Specified by:
size
in interfacenl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfacenl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
-
contains
public boolean contains(nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T> o) - Specified by:
contains
in interfacenl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
-
iterator
public Iterator<nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T>> iterator()- Specified by:
iterator
in interfacenl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
- Specified by:
iterator
in interfaceIterable<T extends Number & Comparable<T>>
-
add
- Specified by:
add
in interfacenl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
-
remove
- Specified by:
remove
in interfacenl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
-
clear
public void clear()- Specified by:
clear
in interfacenl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
-
toString
-