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
All Methods Instance Methods Concrete Methods 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()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.SortedSet
spliterator
-
-
-
-
Method Detail
-
removeFirst
public SimEventInterface<T> removeFirst()
- Specified by:
removeFirstin interfaceEventListInterface<T extends SimTime<?,?,T>>
-
removeLast
public SimEventInterface<T> removeLast()
- Specified by:
removeLastin interfaceEventListInterface<T extends SimTime<?,?,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.
-
last
public SimEventInterface<T> last()
we re-implemented the last method. Instead of throwing exceptions if the tree is empty, we return a null value.
-
comparator
public Comparator<? super SimEventInterface<T>> comparator()
- Specified by:
comparatorin interfaceSortedSet<T extends SimTime<?,?,T>>
-
subSet
public SortedSet<SimEventInterface<T>> subSet(SimEventInterface<T> fromElement, SimEventInterface<T> toElement)
-
headSet
public SortedSet<SimEventInterface<T>> headSet(SimEventInterface<T> toElement)
-
tailSet
public SortedSet<SimEventInterface<T>> tailSet(SimEventInterface<T> fromElement)
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(Object o)
-
iterator
public Iterator<SimEventInterface<T>> iterator()
-
toArray
public Object[] toArray()
-
toArray
public <X> X[] toArray(X[] a)
-
add
public boolean add(SimEventInterface<T> e)
-
remove
public boolean remove(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<T extends SimTime<?,?,T>>- Specified by:
containsAllin interfaceSet<T extends SimTime<?,?,T>>
-
addAll
public boolean addAll(Collection<? extends SimEventInterface<T>> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
removeAll
public boolean removeAll(Collection<?> c)
-
clear
public void clear()
-
-