Package org.opentrafficsim.core.dsol
Class SynchronizedRedBlackTree<T extends SimTime<?,?,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>>,Collection<SimEventInterface<T>>,Set<SimEventInterface<T>>,SortedSet<SimEventInterface<T>>,EventListInterface<T>
public class SynchronizedRedBlackTree<T extends SimTime<?,?,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
Modifier and Type Method Description booleanadd(SimEventInterface<T> e)booleanaddAll(Collection<? extends SimEventInterface<T>> c)voidclear()Comparator<? super SimEventInterface<T>>comparator()booleancontains(Object o)booleancontainsAll(Collection<?> c)SimEventInterface<T>first()we re-implemented the first method.SortedSet<SimEventInterface<T>>headSet(SimEventInterface<T> toElement)booleanisEmpty()Iterator<SimEventInterface<T>>iterator()SimEventInterface<T>last()we re-implemented the last method.booleanremove(Object o)booleanremoveAll(Collection<?> c)SimEventInterface<T>removeFirst()SimEventInterface<T>removeLast()booleanretainAll(Collection<?> c)intsize()SortedSet<SimEventInterface<T>>subSet(SimEventInterface<T> fromElement, SimEventInterface<T> toElement)SortedSet<SimEventInterface<T>>tailSet(SimEventInterface<T> fromElement)Object[]toArray()<X> X[]toArray(X[] a)StringtoString()
-
Constructor Details
-
SynchronizedRedBlackTree
public SynchronizedRedBlackTree()Constructs a newSynchronizedRedBlackTree.
-
-
Method Details
-
removeFirst
- Specified by:
removeFirstin interfaceEventListInterface<T extends SimTime<?,?,T>>
-
removeLast
- Specified by:
removeLastin interfaceEventListInterface<T extends SimTime<?,?,T>>
-
first
we re-implemented the first method. Instead of throwing exceptions if the tree is empty, we return a null value. -
last
we re-implemented the last method. Instead of throwing exceptions if the tree is empty, we return a null value. -
comparator
- Specified by:
comparatorin interfaceSortedSet<T extends SimTime<?,?,T>>
-
subSet
public SortedSet<SimEventInterface<T>> subSet(SimEventInterface<T> fromElement, SimEventInterface<T> toElement) -
headSet
-
tailSet
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <X> X[] toArray(X[] a) -
add
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<T extends SimTime<?,?,T>>- Specified by:
containsAllin interfaceSet<T extends SimTime<?,?,T>>
-
addAll
-
retainAll
-
removeAll
-
clear
public void clear() -
toString
-