package experimentalcode.remigius.Visualizers;

import java.util.Comparator;

public class VisualizerComparator implements Comparator<Visualizer> {

  @Override
  public int compare(Visualizer o1, Visualizer o2) {
    if(o1.getLevel() < o2.getLevel()) {
      return -1;
    }
    else if(o1.getLevel() > o2.getLevel()) {
      return 1;
    }
    else {
      if(o1.equals(o2)) {
        return 0;
      }
      else {
        return 1;
      }
    }
  }
}

@@ -71,16 +71,181 @@
 rator;%0A%0A
+/**%0A * Compares Visualizers by level. %3Cbr%3E%0A * Note: this comparator imposes orderings that are inconsistent with equals.%0A * %0A * @author Remigius Wojdanowski%0A * %0A */%0A
 public c
@@ -401,34 +401,32 @@
 %3C o2.getLevel())
- %7B
 %0A      return -1
@@ -431,27 +431,16 @@
 -1;%0A    
-%7D%0A    else 
 if(o1.ge
@@ -464,18 +464,16 @@
 Level())
- %7B
 %0A      r
@@ -489,117 +489,17 @@
     
-%7D%0A    else %7B%0A      if(o1.equals(o2)) %7B%0A        return 0;%0A      %7D%0A      else %7B%0A        return 1;%0A      %7D%0A    %7D
+return 0;
 %0A  %7D

Fix sorting of Visualizers.