java.lang.Object
org.hsqldb.lib.HsqlArrayHeap<E>
- All Implemented Interfaces:
HsqlHeap<E>
An HsqlHeap implementation backed by an array of objects and an
ObjectComparator. This implementation
is non-blocking, dynamically resizing and thread-safe.- Since:
- 1.7.2
- Author:
- Campbell Burnet (campbell-burnet@users dot sourceforge.net)
-
Constructor Summary
ConstructorsConstructorDescriptionHsqlArrayHeap(int capacity, Comparator<E> comparator) Creates a new HsqlArrayHeap with the given initial capacity, using the specified ObjectComparator to maintain the heap invariant. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds the specified element to this Heap.voidclear()Removes all elements from this Heap.booleanisEmpty()Retrieves whether this Heap is empty.booleanisFull()Retrieves whether this Heap is full.peek()Retrieves the least element from this Heap, without removing it.remove()Retrieves the least element from this Heap, removing it in the process.intsize()Retrieves the number of elements currently in this Heap.toString()
-
Constructor Details
-
HsqlArrayHeap
Creates a new HsqlArrayHeap with the given initial capacity, using the specified ObjectComparator to maintain the heap invariant.- Parameters:
capacity- intcomparator- Comparator- Throws:
IllegalArgumentException- if capacity less or equal to zero or comparator is null
-
-
Method Details
-
clear
public void clear()Description copied from interface:HsqlHeapRemoves all elements from this Heap. -
add
Description copied from interface:HsqlHeapAdds the specified element to this Heap. -
isEmpty
public boolean isEmpty()Description copied from interface:HsqlHeapRetrieves whether this Heap is empty. -
isFull
public boolean isFull()Description copied from interface:HsqlHeapRetrieves whether this Heap is full. -
peek
Description copied from interface:HsqlHeapRetrieves the least element from this Heap, without removing it. -
remove
Description copied from interface:HsqlHeapRetrieves the least element from this Heap, removing it in the process. -
size
public int size()Description copied from interface:HsqlHeapRetrieves the number of elements currently in this Heap. -
toString
-