- java.lang.Object
-
- org.hsqldb.lib.HsqlArrayHeap<E>
-
- All Implemented Interfaces:
HsqlHeap<E>
public class HsqlArrayHeap<E> extends java.lang.Object implements HsqlHeap<E>
An HsqlHeap implementation backed by an array of objects and anObjectComparator
. 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
Constructors Constructor Description HsqlArrayHeap(int capacity, java.util.Comparator<E> comparator)
Creates a new HsqlArrayHeap with the given initial capacity, using the specified ObjectComparator to maintain the heap invariant.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E o)
Adds the specified element to this Heap.void
clear()
Removes all elements from this Heap.boolean
isEmpty()
Retrieves whether this Heap is empty.boolean
isFull()
Retrieves whether this Heap is full.E
peek()
Retrieves the least element from this Heap, without removing it.E
remove()
Retrieves the least element from this Heap, removing it in the process.int
size()
Retrieves the number of elements currently in this Heap.java.lang.String
toString()
-
-
-
Constructor Detail
-
HsqlArrayHeap
public HsqlArrayHeap(int capacity, java.util.Comparator<E> comparator) throws java.lang.IllegalArgumentException
Creates a new HsqlArrayHeap with the given initial capacity, using the specified ObjectComparator to maintain the heap invariant.- Parameters:
capacity
- intcomparator
- Comparator- Throws:
java.lang.IllegalArgumentException
- if capacity less or equal to zero or comparator is null
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:HsqlHeap
Removes all elements from this Heap.
-
add
public boolean add(E o)
Description copied from interface:HsqlHeap
Adds the specified element to this Heap.
-
isEmpty
public boolean isEmpty()
Description copied from interface:HsqlHeap
Retrieves whether this Heap is empty.
-
isFull
public boolean isFull()
Description copied from interface:HsqlHeap
Retrieves whether this Heap is full.
-
peek
public E peek()
Description copied from interface:HsqlHeap
Retrieves the least element from this Heap, without removing it.
-
remove
public E remove()
Description copied from interface:HsqlHeap
Retrieves the least element from this Heap, removing it in the process.
-
size
public int size()
Description copied from interface:HsqlHeap
Retrieves the number of elements currently in this Heap.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-