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 Details

  • Method Details

    • removeFirst

      public SimEventInterface<T> removeFirst()
      Specified by:
      removeFirst in interface EventListInterface<T extends SimTime<?,​?,​T>>
    • removeLast

      public SimEventInterface<T> removeLast()
      Specified by:
      removeLast in interface EventListInterface<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.
      Specified by:
      first in interface java.util.SortedSet<T extends SimTime<?,​?,​T>>
      Returns:
      the first SimEvent in the tree.
      See Also:
      TreeSet.first()
    • 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.
      Specified by:
      last in interface java.util.SortedSet<T extends SimTime<?,​?,​T>>
      Returns:
      the last SimEvent in the tree.
      See Also:
      TreeSet.last()
    • comparator

      public java.util.Comparator<? super SimEventInterface<T>> comparator()
      Specified by:
      comparator in interface java.util.SortedSet<T extends SimTime<?,​?,​T>>
    • subSet

      public java.util.SortedSet<SimEventInterface<T>> subSet​(SimEventInterface<T> fromElement, SimEventInterface<T> toElement)
      Specified by:
      subSet in interface java.util.SortedSet<T extends SimTime<?,​?,​T>>
    • headSet

      public java.util.SortedSet<SimEventInterface<T>> headSet​(SimEventInterface<T> toElement)
      Specified by:
      headSet in interface java.util.SortedSet<T extends SimTime<?,​?,​T>>
    • tailSet

      public java.util.SortedSet<SimEventInterface<T>> tailSet​(SimEventInterface<T> fromElement)
      Specified by:
      tailSet in interface java.util.SortedSet<T extends SimTime<?,​?,​T>>
    • size

      public int size()
      Specified by:
      size in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      size in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      isEmpty in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • contains

      public boolean contains​(java.lang.Object o)
      Specified by:
      contains in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      contains in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • iterator

      public java.util.Iterator<SimEventInterface<T>> iterator()
      Specified by:
      iterator in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      iterator in interface java.lang.Iterable<T extends SimTime<?,​?,​T>>
      Specified by:
      iterator in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • toArray

      public java.lang.Object[] toArray()
      Specified by:
      toArray in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      toArray in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • toArray

      public <X> X[] toArray​(X[] a)
      Specified by:
      toArray in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      toArray in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • add

      public boolean add​(SimEventInterface<T> e)
      Specified by:
      add in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      add in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • remove

      public boolean remove​(java.lang.Object o)
      Specified by:
      remove in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      remove in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • containsAll

      public boolean containsAll​(java.util.Collection<?> c)
      Specified by:
      containsAll in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      containsAll in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • addAll

      public boolean addAll​(java.util.Collection<? extends SimEventInterface<T>> c)
      Specified by:
      addAll in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      addAll in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • retainAll

      public boolean retainAll​(java.util.Collection<?> c)
      Specified by:
      retainAll in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      retainAll in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • removeAll

      public boolean removeAll​(java.util.Collection<?> c)
      Specified by:
      removeAll in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      removeAll in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • clear

      public void clear()
      Specified by:
      clear in interface java.util.Collection<T extends SimTime<?,​?,​T>>
      Specified by:
      clear in interface java.util.Set<T extends SimTime<?,​?,​T>>
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object