|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectHeap
public class Heap
A class implementing a binary heap.
Nested Class Summary | |
---|---|
static class |
Heap.HeapElement
Helper class for implementing an object priority pair. |
Constructor Summary | |
---|---|
Heap()
Creates an empty heap. |
|
Heap(Object[] objs,
double[] scores)
Creates a heap consisting made up of the objects, with corresponding priorities. |
Method Summary | |
---|---|
Heap.HeapElement |
extractMax()
Removes the highest priority element and returns it along with its priority. |
void |
insert(Object obj,
double score)
Adds element to heap. |
boolean |
isEmpty()
Returns whether or not the heap is empty. |
double |
maxScore()
Returns the maximum score in the heap. |
void |
setValue(Object obj,
double score)
Modifies the priority of one of the heap elements. |
int |
size()
Returns the number of elements currently in the heap. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Heap()
public Heap(Object[] objs, double[] scores)
Method Detail |
---|
public void insert(Object obj, double score)
public void setValue(Object obj, double score)
public boolean isEmpty()
public int size()
public Heap.HeapElement extractMax()
public double maxScore()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |