# Class Sorter.Heapifier

public class Heapifier
extends Object

Maintains the heap structure of a given array.

    An array A[lo:hi] is said to satisfy the "heap property" if for i = 0, 1, .., hi - lo:
    A[lo + i] <= A[lo + 2 * i + 1]  and
    A[lo + i] < = A[lo + 2 * i + 2], whenever these indices are in the range [lo..hi].

##

instance

##

Heapifier ()

##

Singleton ()
heapify (AOrder, Object[], int, int)
siftDown (AOrder, Object[], int, int, int)
  "Sifts" the value at A[cur] down the array A to maintain the heap property
siftUp (AOrder, Object[], int, int)
  "Sifts" A[cur] up the array A to maintain the heap property

##

instance

    private static final Heapifier instance = new Heapifier ()

##

Heapifier

    private  Heapifier()

##

Singleton

    public static Heapifier Singleton()

siftUp

    public void siftUp(AOrder iCompareOp, Object[] A, int lo, int cur)

  "Sifts" A[cur] up the array A to maintain the heap property.

  Parameters:
    A - A[lo:cur-1] is a heap.
    lo - the low index of A.
    cur - lo <= cur <= the high index of A.

siftDown

    public void siftDown(AOrder iCompareOp, Object[] A, int lo, int cur, int hi)

  "Sifts" the value at A[cur] down the array A to maintain the heap property.

  Parameters:
    A - A[cur + 1:hi] satisfies the heap property.
    lo - the low index of A.
    cur - lo <= cur <= hi.
    hi - the high index of a.

heapify

    public void heapify(AOrder iCompareOp, Object[] A, int lo, int hi)