@@ -0,0 +1,2123 @@
+package org.uma.jmetal.util.comparator;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Comparator;%0Aimport java.util.List;%0A%0A/**%0A * @author Juanjo%0A * @version 1.0%0A * This class aims to implement an interface for MultiComparators. Multicomparators are%0A * comparators that underneath make use of a list of comparator to possibly break the ties between%0A * solutions%0A */%0Apublic class MultiComparator%3CT%3E implements Comparator%3CT%3E %7B%0A%0A  protected List%3CComparator%3CT%3E%3E comparatorList;%0A%0A  /**%0A   * Constructor%0A   * @param comparatorList%0A   */%0A  public MultiComparator(List%3CComparator%3CT%3E%3E comparatorList) %7B%0A    this.comparatorList = comparatorList ;%0A  %7D%0A%0A  public MultiComparator() %7B%0A    comparatorList = new ArrayList%3C%3E() ;%0A  %7D%0A%0A  public MultiComparator%3CT%3E add(Comparator%3CT%3E comparator) %7B%0A    comparatorList.add(comparator) ;%0A    return this ;%0A  %7D%0A%0A  /**%0A   * Compare two objects based on a list of comparators. It performs a lexicographical comparison as%0A   * follows:%0A   *%0A   * o1 is smaller than o2 if exist an index i, within the interval %5B0,comparatorList.size()) s.t.%0A   * comparatorList.get(i).compare(o1,o2)==-1 and for all j, s.t. j%3Ci, then%0A   * comparatorList.get(j).compare(o1,o2)==0.%0A   *%0A   * Conversely, o1 is bigger than o2 if exist an index i, within the interval%0A   * %5B0,comparatorList.size()) s.t. comparatorList.get(i).compare(o1,o2)==1 and for all j, s.t. j%3Ci,%0A   * then comparatorList.get(j).compare(o1,o2)==0.%0A   *%0A   * Finally o1 cannot be said smaller or bigger than o2 if none of the previous two cases are%0A   * true.%0A   *%0A   * @param o1 the first element to compare%0A   * @param o2 the second element to compare%0A   * @return -1 if o1 is smaller than o2, 1 if o2 is bigger than o2, and 0 otherwise%0A   */%0A  public int compare(T o1, T o2) %7B%0A    for (Comparator%3CT%3E comparator : comparatorList) %7B%0A      int flag = comparator.compare(o1, o2);%0A      switch (flag) %7B%0A        case 0:%0A          continue;%0A        default:%0A          return flag;%0A      %7D%0A    %7D%0A    return 0;%0A  %7D%0A%0A  /**%0A   * @return the list of comparators%0A   */%0A  public List%3C? extends Comparator%3CT%3E%3E getComparatorList() %7B%0A    return comparatorList ;%0A  %7D%0A%7D%0A

Add class MultiComparator