|
Drools :: Core 6.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.drools.core.util.BinaryHeapQueue
public class BinaryHeapQueue
| Field Summary | |
|---|---|
protected static org.slf4j.Logger |
log
|
| Constructor Summary | |
|---|---|
BinaryHeapQueue()
|
|
BinaryHeapQueue(Comparator comparator)
Constructs a new BinaryHeap that will use the given
comparator to order its elements. |
|
BinaryHeapQueue(Comparator comparator,
int capacity)
Constructs a new BinaryHeap. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears all elements from queue. |
Activation |
dequeue()
Returns the Queueable on top of heap and remove it. |
Activation |
dequeue(int index)
|
void |
enqueue(Activation element)
Inserts an Queueable into queue. |
Activation[] |
getAndClear()
|
boolean |
isEmpty()
Tests if queue is empty. |
boolean |
isFull()
Tests if queue is full. |
Activation |
peek()
|
protected void |
percolateDownMaxHeap(int index)
Percolates element down heap from the position given by the index. |
protected void |
percolateUpMaxHeap(Activation element)
Percolates a new element up heap from the bottom. |
protected void |
percolateUpMaxHeap(int index)
Percolates element up heap from from the position given by the index. |
void |
readExternal(ObjectInput in)
|
int |
size()
Returns the number of elements in this heap. |
Object[] |
toArray(Object[] a)
|
void |
writeExternal(ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static transient org.slf4j.Logger log
| Constructor Detail |
|---|
public BinaryHeapQueue()
public BinaryHeapQueue(Comparator comparator)
BinaryHeap that will use the given
comparator to order its elements.
comparator - the comparator used to order the elements, null
means use natural order
public BinaryHeapQueue(Comparator comparator,
int capacity)
BinaryHeap.
comparator - the comparator used to order the elements, null
means use natural ordercapacity - the initial capacity for the heap
IllegalArgumentException - if capacity is <= 0| Method Detail |
|---|
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundException
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void clear()
public Activation[] getAndClear()
public boolean isEmpty()
isEmpty in interface Queuetrue if queue is empty; false
otherwise.public boolean isFull()
true if queue is full; false
otherwise.public int size()
public Activation peek()
public void enqueue(Activation element)
enqueue in interface Queueelement - the Queueable to be inserted
public Activation dequeue()
throws NoSuchElementException
dequeue in interface QueueNoSuchElementException - if isEmpty() == truepublic Activation dequeue(int index)
dequeue in interface Queueindex - protected void percolateDownMaxHeap(int index)
Assumes it is a maximum heap.
index - the index of the elementprotected void percolateUpMaxHeap(int index)
Assume it is a maximum heap.
index - the index of the element to be percolated upprotected void percolateUpMaxHeap(Activation element)
Assume it is a maximum heap.
element - the elementpublic Object[] toArray(Object[] a)
|
Drools :: Core 6.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||