org.hsqldb.lib
Class HsqlArrayHeap
- java.lang.Object
-
- org.hsqldb.lib.HsqlArrayHeap
-
- All Implemented Interfaces:
- HsqlHeap
public class HsqlArrayHeap extends java.lang.Object implements HsqlHeap
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
-
-
Constructor Summary
Constructors Constructor and Description HsqlArrayHeap(int capacity, java.util.Comparator 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 and Description voidadd(java.lang.Object o)Adds the specified element to this Heap.voidclear()Removes all of the elements from this Heap.booleanisEmpty()Retrieves whether this Heap is empty.booleanisFull()Retrieves whether this Heap is full.java.lang.Objectpeek()Retrieves the least element from this Heap, without removing it.java.lang.Objectremove()Retrieves the least element from this Heap, removing it in the process.intsize()Retrieves the number of elements currently in this Heap.java.lang.StringtoString()
-
-
-
Constructor Detail
-
HsqlArrayHeap
public HsqlArrayHeap(int capacity, java.util.Comparator comparator) throws java.lang.IllegalArgumentExceptionCreates a new HsqlArrayHeap with the given initial capacity, using the specified ObjectComparator to maintain the heap invariant.- 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:HsqlHeapRemoves all of the elements from this Heap.
-
add
public void add(java.lang.Object o) throws java.lang.IllegalArgumentException, java.lang.RuntimeExceptionDescription copied from interface:HsqlHeapAdds the specified element to this Heap.- Specified by:
addin interfaceHsqlHeap- Parameters:
o- The element to add- Throws:
java.lang.IllegalArgumentException- if the implementation does not accept elements of the supplied type (optional) throws RuntimeException if the implementation dictates that this Heap is not currently accepting additions or that this Heap is currently full (optional)java.lang.RuntimeException
-
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
public java.lang.Object peek()
Description copied from interface:HsqlHeapRetrieves the least element from this Heap, without removing it.
-
remove
public java.lang.Object 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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG