Source of SortAlgorithm.java


  1: public abstract class SortAlgorithm {
  2: 
  3:   abstract void sort(int a[]); 
  4: 
  5:   private AlgorithmAnimator animator; 
  6: 
  7:   protected SortAlgorithm(AlgorithmAnimator animator) {
  8:     this.animator = animator; 
  9:   }
 10: 
 11:   protected void pause() {
 12:     if (animator != null) 
 13:       animator.pause();
 14:   }
 15: 
 16:   protected static void swap(int a[], int i, int j) {
 17:     int T;
 18:     T = a[i]; a[i] = a[j]; a[j] = T;
 19:   }
 20: }