|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.media.mn8.util.cron.BinaryHeap
Field Summary | |
static Comparator |
MAX_COMPARATOR
|
static Comparator |
MIN_COMPARATOR
|
Constructor Summary | |
BinaryHeap()
|
|
BinaryHeap(int capacity,
Comparator comparator)
|
Method Summary | |
void |
clear()
Clear all elements from queue. |
void |
insert(Object element)
Insert an element into queue. |
boolean |
isEmpty()
Test if queue is empty. |
boolean |
isFull()
Test if queue is full. |
Object |
peek()
Return element on top of heap but don't remove it. |
Object |
pop()
Return element on top of heap and remove it. |
int |
size()
Returns the number of elements currently on the heap. |
String |
toString()
Create a string representing heap and all elements in heap. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Comparator MIN_COMPARATOR
public static final Comparator MAX_COMPARATOR
Constructor Detail |
public BinaryHeap()
public BinaryHeap(int capacity, Comparator comparator)
Method Detail |
public void clear()
public boolean isEmpty()
public boolean isFull()
public int size()
public void insert(Object element)
element
- the element to be insertedpublic Object peek() throws NoSuchElementException
NoSuchElementException
- if isEmpty() == truepublic Object pop() throws NoSuchElementException
NoSuchElementException
- if isEmpty() == truepublic String toString()
toString
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |