|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 nullMethod Detail |
public void clear()
HsqlHeap
clear
in interface HsqlHeap
public void add(Object o) throws IllegalArgumentException, RuntimeException
HsqlHeap
add
in interface HsqlHeap
o
- 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)
RuntimeException
public boolean isEmpty()
HsqlHeap
isEmpty
in interface HsqlHeap
public boolean isFull()
HsqlHeap
isFull
in interface HsqlHeap
public Object peek()
HsqlHeap
peek
in interface HsqlHeap
public Object remove()
HsqlHeap
remove
in interface HsqlHeap
public int size()
HsqlHeap
size
in interface HsqlHeap
public String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |