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<nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T>>, nl.tudelft.simulation.dsol.eventlists.EventListInterface<T>

public class SynchronizedRedBlackTree<T extends Number & Comparable<T>> extends Object implements nl.tudelft.simulation.dsol.eventlists.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
Author:
Peter Jacobs
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new SynchronizedRedBlackTree.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T> e)
    void
    boolean
    contains(nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T> o)
    nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T>
    we re-implemented the first method.
    boolean
    Iterator<nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T>>
    boolean
    remove(nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T> o)
    nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T>
    int

    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
  • Constructor Details

    • SynchronizedRedBlackTree

      public SynchronizedRedBlackTree()
      Constructs a new SynchronizedRedBlackTree.
  • Method Details

    • removeFirst

      public nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T> removeFirst()
      Specified by:
      removeFirst in interface nl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
    • first

      public nl.tudelft.simulation.dsol.formalisms.eventscheduling.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 nl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
      Returns:
      the first SimEvent in the tree.
      See Also:
    • size

      public int size()
      Specified by:
      size in interface nl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface nl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
    • contains

      public boolean contains(nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T> o)
      Specified by:
      contains in interface nl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
    • iterator

      public Iterator<nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T>> iterator()
      Specified by:
      iterator in interface nl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
      Specified by:
      iterator in interface Iterable<T extends Number & Comparable<T>>
    • add

      public void add(nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T> e)
      Specified by:
      add in interface nl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
    • remove

      public boolean remove(nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<T> o)
      Specified by:
      remove in interface nl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
    • clear

      public void clear()
      Specified by:
      clear in interface nl.tudelft.simulation.dsol.eventlists.EventListInterface<T extends Number & Comparable<T>>
    • toString

      public String toString()
      Overrides:
      toString in class Object