Source of StaticAlgoFactory.java


  1: public class StaticAlgoFactory 
  2:     implements SortAlgorithmFactory {
  3:   public SortAlgorithm makeSortAlgorithm(String algName) {
  4:     if ("BubbleSort".equals(algName))
  5:       return new BubbleSortAlgorithm(animator);       
  6:     else if ("QuickSort".equals(algName)) 
  7:       return new QuickSortAlgorithm(animator); 
  8:     else
  9:       return new BubbleSortAlgorithm(animator); 
 10:   }
 11: 
 12:   protected AlgorithmAnimator animator; 
 13:   public StaticAlgoFactory(AlgorithmAnimator animator) {
 14:     this.animator = animator; 
 15:   }
 16: }