|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.tudelft.simulation.dsol.eventlists.RedBlackTree
public class RedBlackTree
A RedBlackTree 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.
Field Summary | |
---|---|
protected static boolean |
BLACK
BLACK |
protected int |
modCount
The number of structural modifications to the tree. |
protected static boolean |
RED
RED |
protected nl.tudelft.simulation.dsol.eventlists.RedBlackTree.Entry |
root
the root of the tree |
protected int |
size
The number of entries in the tree |
Constructor Summary | |
---|---|
RedBlackTree()
constructs a new RedBlackTree |
Method Summary | |
---|---|
boolean |
add(SimEventInterface event)
adds an event to the eventlist |
boolean |
addAll(Collection collection)
adds a collection of events to the tree |
void |
clear()
clears the eventlist by removing all its scheduled events. |
boolean |
contains(SimEventInterface event)
returns whether event is an entry of the eventlist |
boolean |
containsAll(Collection collection)
returns whether the collection is in the list. |
protected void |
deleteEntry(nl.tudelft.simulation.dsol.eventlists.RedBlackTree.Entry entry)
deletes entry , and then rebalance the tree. |
SimEventInterface |
first()
returns the first scheduled event |
protected nl.tudelft.simulation.dsol.eventlists.RedBlackTree.Entry |
firstEntry()
returns the first entry from the RedBlackTree |
boolean |
isEmpty()
returns whether the eventlist is empty |
Iterator |
iterator()
returns the iterator for this eventlist |
SimEventInterface |
last()
returns the last scheduled event |
boolean |
remove(SimEventInterface event)
removes the event from this tree |
boolean |
removeAll(Collection collection)
removes a collection of events from this tree |
SimEventInterface |
removeFirst()
removes the first event from the eventlist. |
SimEventInterface |
removeLast()
removes the last event from the eventlist. |
int |
size()
returns the number of scheduled events |
protected nl.tudelft.simulation.dsol.eventlists.RedBlackTree.Entry |
successor(nl.tudelft.simulation.dsol.eventlists.RedBlackTree.Entry entry)
Returns the successor of the specified Entry, or null if no such. |
SimEventInterface[] |
toArray()
returns the eventlist as array of simevents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final boolean RED
protected static final boolean BLACK
protected nl.tudelft.simulation.dsol.eventlists.RedBlackTree.Entry root
protected int size
protected int modCount
Constructor Detail |
---|
public RedBlackTree()
Method Detail |
---|
public boolean add(SimEventInterface event)
EventListInterface
add
in interface EventListInterface
event
- the event to add
#add(nl.tudelft.simulation.dsol.formalisms.devs.SimEventInterface)
public boolean addAll(Collection collection)
EventListInterface
addAll
in interface EventListInterface
collection
- the collection
#addAll(Collection)
public void clear()
EventListInterface
clear
in interface EventListInterface
EventListInterface.clear()
public boolean contains(SimEventInterface event)
EventListInterface
contains
in interface EventListInterface
event
- the event
#contains(nl.tudelft.simulation.dsol.formalisms.devs.SimEventInterface)
public boolean containsAll(Collection collection)
EventListInterface
containsAll
in interface EventListInterface
collection
- the collection to test
#containsAll(Collection)
public SimEventInterface first()
EventListInterface
first
in interface EventListInterface
#first()
public boolean isEmpty()
EventListInterface
isEmpty
in interface EventListInterface
EventListInterface.isEmpty()
public Iterator iterator()
EventListInterface
iterator
in interface EventListInterface
#iterator()
public SimEventInterface last()
EventListInterface
last
in interface EventListInterface
EventListInterface.last()
public boolean remove(SimEventInterface event)
EventListInterface
remove
in interface EventListInterface
event
- the event to be removed
#remove(nl.tudelft.simulation.dsol.formalisms.devs.SimEventInterface)
public boolean removeAll(Collection collection)
EventListInterface
removeAll
in interface EventListInterface
collection
- the colleciton
EventListInterface.removeAll(Collection)
public SimEventInterface removeFirst()
EventListInterface
removeFirst
in interface EventListInterface
#removeFirst()
public SimEventInterface removeLast()
EventListInterface
removeLast
in interface EventListInterface
EventListInterface.removeLast()
public int size()
EventListInterface
size
in interface EventListInterface
EventListInterface.size()
public SimEventInterface[] toArray()
EventListInterface
toArray
in interface EventListInterface
#toArray()
protected nl.tudelft.simulation.dsol.eventlists.RedBlackTree.Entry firstEntry()
protected void deleteEntry(nl.tudelft.simulation.dsol.eventlists.RedBlackTree.Entry entry)
entry
- entryprotected nl.tudelft.simulation.dsol.eventlists.RedBlackTree.Entry successor(nl.tudelft.simulation.dsol.eventlists.RedBlackTree.Entry entry)
entry
- the entry
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |