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<SimEventInterface<T>>
,EventListInterface<T>
public class SynchronizedRedBlackTree<T extends Number & Comparable<T>> extends Object implements 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
- Version:
- $Revision: 1.2 $ $Date: 2010/08/10 11:36:45 $
- Author:
- Peter Jacobs
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SynchronizedRedBlackTree()
Constructs a newSynchronizedRedBlackTree
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(SimEventInterface<T> e)
void
clear()
boolean
contains(SimEventInterface<T> o)
SimEventInterface<T>
first()
we re-implemented the first method.boolean
isEmpty()
Iterator<SimEventInterface<T>>
iterator()
boolean
remove(SimEventInterface<T> o)
SimEventInterface<T>
removeFirst()
int
size()
String
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
-
-
-
-
Method Detail
-
removeFirst
public SimEventInterface<T> removeFirst()
- Specified by:
removeFirst
in interfaceEventListInterface<T extends Number & Comparable<T>>
-
first
public SimEventInterface<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 interfaceEventListInterface<T extends Number & Comparable<T>>
- Returns:
- the first SimEvent in the tree.
- See Also:
TreeSet.first()
-
size
public int size()
- Specified by:
size
in interfaceEventListInterface<T extends Number & Comparable<T>>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceEventListInterface<T extends Number & Comparable<T>>
-
contains
public boolean contains(SimEventInterface<T> o)
- Specified by:
contains
in interfaceEventListInterface<T extends Number & Comparable<T>>
-
iterator
public Iterator<SimEventInterface<T>> iterator()
- Specified by:
iterator
in interfaceEventListInterface<T extends Number & Comparable<T>>
- Specified by:
iterator
in interfaceIterable<T extends Number & Comparable<T>>
-
add
public void add(SimEventInterface<T> e)
- Specified by:
add
in interfaceEventListInterface<T extends Number & Comparable<T>>
-
remove
public boolean remove(SimEventInterface<T> o)
- Specified by:
remove
in interfaceEventListInterface<T extends Number & Comparable<T>>
-
clear
public void clear()
- Specified by:
clear
in interfaceEventListInterface<T extends Number & Comparable<T>>
-
-