# Class Sorter.GraphicSorter

public class GraphicSorter
extends Sorter.ASorter

##

aSorter
  The decoree to which all calls are delegated
statusLabel
  A status label upon which the "split" or "join" is flashed during the wait time to indicate that the respective operation is taking place
waitTime
  The number of milliseconds that the thread will sleep so that the user can see the color changes

##

GraphicSorter (ASorter, JLabel, int)
  Constructor for this class

##

join (Object[], int, int, int)
  Delegates to the decoree, then recursively recolors the joined sections and pauses
pause ()
  Pauses (sleeps) the thread for waitTime milliseconds
resetLabel ()
  Clears the status label
setLabel (String)
  Accessor method for the status label
setOrder (AOrder)
  Accessor method for aOrder
split (Object[], int, int)
  Delegates to the decoree, then recursively recolors the split sections and pauses

##

aSorter

    protected ASorter aSorter

  The decoree to which all calls are delegated.

waitTime

    private int waitTime = 500

  The number of milliseconds that the thread will sleep so that the user can see the color changes.

statusLabel

    private JLabel statusLabel

  A status label upon which the "split" or "join" is flashed during the wait time to indicate that the respective operation is taking place.

##

GraphicSorter

    public  GraphicSorter(ASorter aSorter, JLabel statusLabel, int waitTime)

  Constructor for this class.

  Parameters:
    aSorter - The decoree.
    statusLabel - The JLabel to send status messages to.
    waitTime - The number of milliseconds to pause (sleep).

##

split

    protected int split(Object[] A, int lo, int hi)

  Delegates to the decoree, then recursively recolors the split sections and pauses.

  Parameters:
    A - The array whose sub-array is to be sorted
    lo - The low index of the sub-array
    hi - The high index of the sub-array.
  Returns:
    the split index.

join

    protected void join(Object[] A, int lo, int s, int hi)

  Delegates to the decoree, then recursively recolors the joined sections and pauses.

  Parameters:
    A - The array with the adjacent subarrays to be joined.
    lo - The low index of the lower sub-array
    s - The split index between the sub-arrays
    hi - The high index of the upper sub-array.

setLabel

    protected void setLabel(String s)

  Accessor method for the status label.

  Parameters:
    s - String to set as the label's text

resetLabel

    protected void resetLabel()

  Clears the status label.

pause

    protected void pause()

  Pauses (sleeps) the thread for waitTime milliseconds.

setOrder

    public void setOrder(AOrder aOrder)

  Accessor method for aOrder.

  Parameters:
    aOrder -