|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.hsqldb.lib.HsqlArrayHeap
An HsqlHeap implementation backed by an array of objects and an
ObjectComparator. This implementation
is non-blocking, dynamically resizing and thread-safe.
| Field Summary | |
protected int |
count
|
protected Object[] |
heap
|
protected ObjectComparator |
oc
|
| Constructor Summary | |
HsqlArrayHeap(int capacity,
ObjectComparator comparator)
Creates a new HsqlArrayHeap with the given initial capacity, using the specified ObjectComparator to maintain the heap invariant. |
|
| Method Summary | |
void |
add(Object o)
Adds the specified element to this Heap. |
void |
clear()
Removes all of the elements from this Heap. |
boolean |
isEmpty()
Retrieves whether this Heap is empty. |
boolean |
isFull()
Retrieves whether this Heap is full. |
Object |
peek()
Retrieves the least element from this Heap, without removing it. |
Object |
remove()
Retrieves the least element from this Heap, removing it in the process. |
int |
size()
Retrieves the number of elements currently in this Heap. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected ObjectComparator oc
protected int count
protected Object[] heap
| Constructor Detail |
public HsqlArrayHeap(int capacity,
ObjectComparator comparator)
throws IllegalArgumentException
IllegalArgumentException - if capacity less or equal to zero
or comparator is null| Method Detail |
public void clear()
HsqlHeap
clear in interface HsqlHeap
public void add(Object o)
throws IllegalArgumentException,
RuntimeException
HsqlHeap
add in interface HsqlHeapo - The element to add
IllegalArgumentException - if the implementation does
not accept elements of the supplied type (optional)
throws HsqlUnsupportedOperationException if the implementation
dictates that this Heap is not currently accepting additions
or that this Heap is currently full (optional)
RuntimeExceptionpublic boolean isEmpty()
HsqlHeap
isEmpty in interface HsqlHeappublic boolean isFull()
HsqlHeap
isFull in interface HsqlHeappublic Object peek()
HsqlHeap
peek in interface HsqlHeappublic Object remove()
HsqlHeap
remove in interface HsqlHeappublic int size()
HsqlHeap
size in interface HsqlHeappublic String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||