Top Description Fields Constructors Methods
org.hsqldb.lib

public Class HsqlArrayHeap<E>

extends Object
implements HsqlHeap<E>
Class Inheritance
All Implemented Interfaces
org.hsqldb.lib.HsqlHeap
Known Direct Subclasses
org.hsqldb.lib.HsqlTimer.TaskQueue
Imports
java.util.Comparator

An HsqlHeap implementation backed by an array of objects and an ObjectComparator. This implementation is non-blocking, dynamically resizing and thread-safe.
Author
Campbell Burnet (campbell-burnet@users dot sourceforge.net)
Since
1.7.2
Version
2.7.3

Field Summary

Modifier and TypeField and Description
protected int
protected Object[]
protected Comparator<E>

Constructor Summary

AccessConstructor and Description
public
HsqlArrayHeap(int
int
capacity
,
Comparator<E>
Comparator
comparator
)

Creates a new HsqlArrayHeap with the given initial capacity, using the specified ObjectComparator to maintain the heap invariant.

Method Summary

Modifier and TypeMethod and Description
public synchronized boolean
add(E o)

Implements org.hsqldb.lib.HsqlHeap.add.

Adds the specified element to this Heap.

public synchronized void
clear()

Implements org.hsqldb.lib.HsqlHeap.clear.

Removes all elements from this Heap.

private void
public synchronized boolean
isEmpty()

Implements org.hsqldb.lib.HsqlHeap.isEmpty.

Retrieves whether this Heap is empty.

public synchronized boolean
isFull()

Implements org.hsqldb.lib.HsqlHeap.isFull.

Retrieves whether this Heap is full.

public synchronized E
peek()

Implements org.hsqldb.lib.HsqlHeap.peek.

Retrieves the least element from this Heap, without removing it.

public synchronized E
remove()

Implements org.hsqldb.lib.HsqlHeap.remove.

Retrieves the least element from this Heap, removing it in the process.

public synchronized int
size()

Implements org.hsqldb.lib.HsqlHeap.size.

Retrieves the number of elements currently in this Heap.

public synchronized String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

countback to summary
protected int count
heapback to summary
protected Object[] heap
ocback to summary
protected Comparator<E> oc

Constructor Detail

HsqlArrayHeapback to summary
public HsqlArrayHeap(int capacity, Comparator<E> comparator) throws IllegalArgumentException

Creates a new HsqlArrayHeap with the given initial capacity, using the specified ObjectComparator to maintain the heap invariant.

Parameters
capacity:int

int

comparator:Comparator<E>

Comparator

Exceptions
IllegalArgumentException:
if capacity less or equal to zero or comparator is null

Method Detail

addback to summary
public synchronized boolean add(E o)

Implements org.hsqldb.lib.HsqlHeap.add.

Doc from org.hsqldb.lib.HsqlHeap.add.

Adds the specified element to this Heap.

clearback to summary
public synchronized void clear()

Implements org.hsqldb.lib.HsqlHeap.clear.

Doc from org.hsqldb.lib.HsqlHeap.clear.

Removes all elements from this Heap.

increaseCapacityback to summary
private void increaseCapacity()
isEmptyback to summary
public synchronized boolean isEmpty()

Implements org.hsqldb.lib.HsqlHeap.isEmpty.

Doc from org.hsqldb.lib.HsqlHeap.isEmpty.

Retrieves whether this Heap is empty.

isFullback to summary
public synchronized boolean isFull()

Implements org.hsqldb.lib.HsqlHeap.isFull.

Doc from org.hsqldb.lib.HsqlHeap.isFull.

Retrieves whether this Heap is full.

peekback to summary
public synchronized E peek()

Implements org.hsqldb.lib.HsqlHeap.peek.

Doc from org.hsqldb.lib.HsqlHeap.peek.

Retrieves the least element from this Heap, without removing it.

removeback to summary
public synchronized E remove()

Implements org.hsqldb.lib.HsqlHeap.remove.

Doc from org.hsqldb.lib.HsqlHeap.remove.

Retrieves the least element from this Heap, removing it in the process.

sizeback to summary
public synchronized int size()

Implements org.hsqldb.lib.HsqlHeap.size.

Doc from org.hsqldb.lib.HsqlHeap.size.

Retrieves the number of elements currently in this Heap.

toStringback to summary
public synchronized String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.