Package org.drools.core.util
Class TreeSetQueue<T extends Queue.QueueEntry>
- java.lang.Object
-
- org.drools.core.util.TreeSetQueue<T>
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,Queue<T>
public class TreeSetQueue<T extends Queue.QueueEntry> extends java.lang.Object implements Queue<T>, java.io.Externalizable
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.drools.core.util.Queue
Queue.QueueEntry
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description TreeSetQueue()TreeSetQueue(java.util.Comparator<T> comparator)Constructs a newBinaryHeap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears all elements from queue.Tdequeue()Returns the Queueable on top of heap and remove it.voiddequeue(T activation)voidenqueue(T element)Inserts an Queueable into queue.java.util.Collection<T>getAll()booleanisEmpty()Tests if queue is empty.Tpeek()voidreadExternal(java.io.ObjectInput in)intsize()Returns the number of elements in this heap.java.lang.StringtoString()voidwriteExternal(java.io.ObjectOutput out)
-
-
-
Constructor Detail
-
TreeSetQueue
public TreeSetQueue()
-
TreeSetQueue
public TreeSetQueue(java.util.Comparator<T> comparator)
Constructs a newBinaryHeap.- Parameters:
comparator- the comparator used to order the elements, null means use natural order
-
-
Method Detail
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
clear
public void clear()
Clears all elements from queue.- Specified by:
clearin interfaceQueue<T extends Queue.QueueEntry>
-
getAll
public java.util.Collection<T> getAll()
- Specified by:
getAllin interfaceQueue<T extends Queue.QueueEntry>
-
isEmpty
public boolean isEmpty()
Tests if queue is empty.- Specified by:
isEmptyin interfaceQueue<T extends Queue.QueueEntry>- Returns:
trueif queue is empty;falseotherwise.
-
size
public int size()
Returns the number of elements in this heap.- Specified by:
sizein interfaceQueue<T extends Queue.QueueEntry>- Returns:
- the number of elements in this heap
-
peek
public T peek()
- Specified by:
peekin interfaceQueue<T extends Queue.QueueEntry>
-
enqueue
public void enqueue(T element)
Inserts an Queueable into queue.- Specified by:
enqueuein interfaceQueue<T extends Queue.QueueEntry>- Parameters:
element- the Queueable to be inserted
-
dequeue
public T dequeue()
Returns the Queueable on top of heap and remove it.- Specified by:
dequeuein interfaceQueue<T extends Queue.QueueEntry>- Returns:
- the Queueable at top of heap
-
dequeue
public void dequeue(T activation)
- Specified by:
dequeuein interfaceQueue<T extends Queue.QueueEntry>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-