|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.util.ZPriorityQueue
ZPriorityQueue is a heap based PriorityQueue that stores objects of type java.lang.Comparable. The default ordering is by maximum value.
Field Summary | |
static int |
QUEUE_MAXIMUM_ORDERING
|
static int |
QUEUE_MINIMUM_ORDERING
|
Constructor Summary | |
ZPriorityQueue()
Construct a new priority queue, ordering by maximum value. |
|
ZPriorityQueue(int aOrdering)
Construct a new priority queue. |
Method Summary | |
protected void |
contract()
|
protected java.util.ArrayList |
elements()
|
protected void |
exchange(int a,
int b)
|
protected void |
expand()
|
java.lang.Object |
extractFirst()
Return the first object in the queue. |
java.lang.Object |
first()
Return the first object in the queue. |
protected java.lang.Comparable |
get(int index)
|
protected void |
heapify(int index)
|
void |
insert(java.lang.Comparable aComparable)
Insert a new item into the queue. |
boolean |
isEmpty()
Return true if the queue is empty. |
protected boolean |
isProposedOrderCorrect(java.lang.Comparable aProposedFirst,
java.lang.Comparable aProposedSecond)
|
protected int |
left(int index)
|
protected int |
parent(int index)
|
protected int |
right(int index)
|
protected void |
set(int index,
java.lang.Comparable aComparable)
|
int |
size()
Return the number of items currently in the queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int QUEUE_MAXIMUM_ORDERING
public static final int QUEUE_MINIMUM_ORDERING
Constructor Detail |
public ZPriorityQueue()
public ZPriorityQueue(int aOrdering)
aOrdering
- determines the ordering of items stored in the queue.
use ZPriorityQueue.QUEUE_MAXIMUM_ORDERING or ZPriorityQueue.QUEUE_MINIMUM_ORDERINGMethod Detail |
public void insert(java.lang.Comparable aComparable)
public java.lang.Object first()
public java.lang.Object extractFirst()
public int size()
public boolean isEmpty()
protected java.util.ArrayList elements()
protected int parent(int index)
protected int left(int index)
protected int right(int index)
protected void heapify(int index)
protected void exchange(int a, int b)
protected java.lang.Comparable get(int index)
protected void set(int index, java.lang.Comparable aComparable)
protected void expand()
protected void contract()
protected boolean isProposedOrderCorrect(java.lang.Comparable aProposedFirst, java.lang.Comparable aProposedSecond)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |