00001
00012 package sorting;
00013
00014 import java.awt.*;
00015
00022 public class BubbleSort extends Sort
00023 {
00024
00030 protected void doSort()
00031 {
00032 boolean sortiert;
00033 do
00034 {
00035 sortiert = true;
00036 for (int i = 1; i < theArray.length; i++)
00037 {
00038 if (theArray[i - 1] > theArray[i])
00039 {
00040 int tmp = theArray[i - 1];
00041 theArray[i - 1] = theArray[i];
00042 theArray[i] = tmp;
00043 sortiert = false;
00044 }
00045 }
00046 this.showArray();
00047 this.theLabel.setText(this.calcRuntime()+"ms");
00048 this.theLabel.validate();
00049 } while (!sortiert);
00050 }
00051
00052 }
00053