
public class BubbleSort extends SortingAlgorithm implements Runnable{

    public BubbleSort(Integer[] toBeSorted, VisualizerFrame frame) {
        super(toBeSorted, frame);
    }

    public void sort() { 
   for (int i = 0; i < getSize(); i++) {
   for (int y = 0; y < getSize() - 1; y++) {
        if(compare( y, y + 1) == 1) {
            swap(i, i + 1);
            swap(y + 1, y);
          }
        }
      }
    }
  }