Class MergeSortVis

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--javax.swing.JApplet
                                |
                                +--MergeSortVis

public class MergeSortVis
extends javax.swing.JApplet
implements java.lang.Runnable

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Field Summary
 int[] b
          The temp-array for the merge-process
 int[] sa
          The array to sort
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
MergeSortVis()
           
 
Method Summary
 void init()
           
 void merge(int lo, int hi)
          The Merge-function.
 void mergeSort(int lo, int hi)
          This is the actual MergeSort Algorithm It does all the steps used for sorting and visualizes the results.
 void run()
          The run-method of the thread.
 void startSortProcess()
          This function is called to start the sort-process.
 void stopSortProcess()
          Stops the sort-process
 int[] str2intArray(java.lang.String s)
          This function converts a String object into an int-Array
 void vis(int line)
          This function is used to visualize the code panel and to sleep a while so the user can see what is going on
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sa

public int[] sa
The array to sort

b

public int[] b
The temp-array for the merge-process
Constructor Detail

MergeSortVis

public MergeSortVis()
Method Detail

str2intArray

public int[] str2intArray(java.lang.String s)
This function converts a String object into an int-Array

vis

public void vis(int line)
This function is used to visualize the code panel and to sleep a while so the user can see what is going on

mergeSort

public void mergeSort(int lo,
                      int hi)
This is the actual MergeSort Algorithm It does all the steps used for sorting and visualizes the results.

merge

public void merge(int lo,
                  int hi)
The Merge-function. This one merges the sorted smaller files into one large file
Parameters:
lo - The lower boundary
hi - The higher boundary

run

public void run()
The run-method of the thread. Starts the sort-process.
Specified by:
run in interface java.lang.Runnable

startSortProcess

public void startSortProcess()
This function is called to start the sort-process. Looks, if a sort-process is already running, else it starts a new one.

stopSortProcess

public void stopSortProcess()
Stops the sort-process

init

public void init()
Overrides:
init in class java.applet.Applet