站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 3.0.6 API 英文版文档

BinaryHeapFifoQueue - JBoss RULES 3.0.6 API 英文版文档


org.drools.util
Class BinaryHeapFifoQueue

java.lang.Object
  extended by org.drools.util.BinaryHeapFifoQueue
All Implemented Interfaces:
java.io.Serializable, Queue

public class BinaryHeapFifoQueue
extends java.lang.Object
implements Queue, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
BinaryHeapFifoQueue(java.util.Comparator comparator)
          Constructs a new BinaryHeap that will use the given comparator to order its elements.
BinaryHeapFifoQueue(java.util.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.
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryHeapFifoQueue

public BinaryHeapFifoQueue(java.util.Comparator comparator)
Constructs a new BinaryHeap that will use the given comparator to order its elements.

Parameters:
comparator - the comparator used to order the elements, null means use natural order

BinaryHeapFifoQueue

public BinaryHeapFifoQueue(java.util.Comparator comparator,
                           int capacity)
Constructs a new BinaryHeap.

Parameters:
comparator - the comparator used to order the elements, null means use natural order
capacity - the initial capacity for the heap
Throws:
java.lang.IllegalArgumentException - if capacity is <= 0
Method Detail

clear

public void clear()
Clears all elements from queue.


isEmpty

public boolean isEmpty()
Tests if queue is empty.

Specified by:
isEmpty in interface Queue
Returns:
true if queue is empty; false otherwise.

isFull

public boolean isFull()
Tests if queue is full.

Returns:
true if queue is full; false otherwise.

size

public int size()
Returns the number of elements in this heap.

Returns:
the number of elements in this heap

enqueue

public void enqueue(Queueable element)
Inserts an Queueable into queue.

Specified by:
enqueue in interface Queue
Parameters:
element - the Queueable to be inserted

dequeue

public Queueable dequeue()
                  throws java.util.NoSuchElementException
Returns the Queueable on top of heap and remove it.

Specified by:
dequeue in interface Queue
Returns:
the Queueable at top of heap
Throws:
java.util.NoSuchElementException - if isEmpty() == true

dequeue

public Queueable dequeue(int index)
Specified by:
dequeue in interface Queue
Parameters:
index -

getQueueable

public Queueable[] getQueueable()

toArray

public java.lang.Object[] toArray()

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)