Documentation of 'org.hsqldb.lib.HsqlArrayHeap' Java class
HsqlArrayHeap
org.hsqldb.lib

Class HsqlArrayHeap

  • All Implemented Interfaces:
    HsqlHeap


    public class HsqlArrayHeap
    extends java.lang.Object
    implements HsqlHeap
    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
    • 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
      void add(java.lang.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.
      java.lang.Object peek()
      Retrieves the least element from this Heap, without removing it.
      java.lang.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.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HsqlArrayHeap

        public HsqlArrayHeap(int capacity,
                             java.util.Comparator comparator)
                      throws java.lang.IllegalArgumentException
        Creates 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: HsqlHeap
        Removes all of the elements from this Heap.
        Specified by:
        clear in interface HsqlHeap
      • add

        public void add(java.lang.Object o)
                 throws java.lang.IllegalArgumentException,
                        java.lang.RuntimeException
        Description copied from interface: HsqlHeap
        Adds the specified element to this Heap.
        Specified by:
        add in interface HsqlHeap
        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: HsqlHeap
        Retrieves whether this Heap is empty.
        Specified by:
        isEmpty in interface HsqlHeap
      • isFull

        public boolean isFull()
        Description copied from interface: HsqlHeap
        Retrieves whether this Heap is full.
        Specified by:
        isFull in interface HsqlHeap
      • peek

        public java.lang.Object peek()
        Description copied from interface: HsqlHeap
        Retrieves the least element from this Heap, without removing it.
        Specified by:
        peek in interface HsqlHeap
        Returns:
        the least element from this Heap
      • remove

        public java.lang.Object remove()
        Description copied from interface: HsqlHeap
        Retrieves the least element from this Heap, removing it in the process.
        Specified by:
        remove in interface HsqlHeap
        Returns:
        the least element from this Heap
      • size

        public int size()
        Description copied from interface: HsqlHeap
        Retrieves the number of elements currently in this Heap.
        Specified by:
        size in interface HsqlHeap
        Returns:
        the number of elements currently in this Heap
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.