|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.drools.util.BinaryHeapQueue
public class BinaryHeapQueue
Constructor Summary | |
---|---|
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. |
Queueable |
dequeue()
Returns the Queueable on top of heap and remove it. |
Queueable |
dequeue(int index)
|
void |
enqueue(Queueable element)
Inserts an Queueable into queue. |
Queueable[] |
getQueueable()
|
boolean |
isEmpty()
Tests if queue is empty. |
boolean |
isFull()
Tests if queue is full. |
int |
size()
Returns the number of elements in this heap. |
Object[] |
toArray()
|
Object[] |
toArray(Object[] a)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 orderpublic 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 clear()
public boolean isEmpty()
true
if queue is empty; false
otherwise.public boolean isFull()
true
if queue is full; false
otherwise.public int size()
public void enqueue(Queueable element)
element
- the Queueable to be insertedpublic Queueable dequeue() throws NoSuchElementException
NoSuchElementException
- if isEmpty() == true
public Queueable dequeue(int index)
public Queueable[] getQueueable()
public Object[] toArray()
public Object[] toArray(Object[] a)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |