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:
java.io.Serializable
,java.lang.Iterable<SimEventInterface<T>>
,java.util.Collection<SimEventInterface<T>>
,java.util.Set<SimEventInterface<T>>
,java.util.SortedSet<SimEventInterface<T>>
,EventListInterface<T>
public class SynchronizedRedBlackTree<T extends SimTime<?,?,T>> extends java.lang.Object implements EventListInterface<T>, java.io.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 boolean
add(SimEventInterface<T> e)
boolean
addAll(java.util.Collection<? extends SimEventInterface<T>> c)
void
clear()
java.util.Comparator<? super SimEventInterface<T>>
comparator()
boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
SimEventInterface<T>
first()
we re-implemented the first method.java.util.SortedSet<SimEventInterface<T>>
headSet(SimEventInterface<T> toElement)
boolean
isEmpty()
java.util.Iterator<SimEventInterface<T>>
iterator()
SimEventInterface<T>
last()
we re-implemented the last method.boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
SimEventInterface<T>
removeFirst()
SimEventInterface<T>
removeLast()
boolean
retainAll(java.util.Collection<?> c)
int
size()
java.util.SortedSet<SimEventInterface<T>>
subSet(SimEventInterface<T> fromElement, SimEventInterface<T> toElement)
java.util.SortedSet<SimEventInterface<T>>
tailSet(SimEventInterface<T> fromElement)
java.lang.Object[]
toArray()
<X> X[]
toArray(X[] a)
java.lang.String
toString()
-
-
-
Method Detail
-
removeFirst
public SimEventInterface<T> removeFirst()
- Specified by:
removeFirst
in interfaceEventListInterface<T extends SimTime<?,?,T>>
-
removeLast
public SimEventInterface<T> removeLast()
- Specified by:
removeLast
in 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 java.util.Comparator<? super SimEventInterface<T>> comparator()
-
subSet
public java.util.SortedSet<SimEventInterface<T>> subSet(SimEventInterface<T> fromElement, SimEventInterface<T> toElement)
-
headSet
public java.util.SortedSet<SimEventInterface<T>> headSet(SimEventInterface<T> toElement)
-
tailSet
public java.util.SortedSet<SimEventInterface<T>> tailSet(SimEventInterface<T> fromElement)
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(java.lang.Object o)
-
iterator
public java.util.Iterator<SimEventInterface<T>> iterator()
-
toArray
public java.lang.Object[] toArray()
-
toArray
public <X> X[] toArray(X[] a)
-
add
public boolean add(SimEventInterface<T> e)
-
remove
public boolean remove(java.lang.Object o)
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
-
addAll
public boolean addAll(java.util.Collection<? extends SimEventInterface<T>> c)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
clear
public void clear()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-