View Javadoc

1   // %232093803:hoplugins.trainingExperience.ui%
2   /*
3    * Created on 20-mar-2005
4    *
5    * To change the template for this generated file go to
6    * Window>Preferences>Java>Code Generation>Code and Comments
7    */
8   package hoplugins.trainingExperience.ui;
9   
10  import java.util.Comparator;
11  import java.util.Vector;
12  
13  
14  /***
15   * DOCUMENT ME!
16   *
17   * @author Mirtillo To change the template for this generated type comment go to
18   *         Window>Preferences>Java>Code Generation>Code and Comments
19   */
20  public class TrainingComparator implements Comparator {
21      //~ Methods ------------------------------------------------------------------------------------
22  
23      /* (non-Javadoc)
24       * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
25       */
26      public int compare(Object arg0, Object arg1) {
27          Vector v1 = (Vector) arg0;
28          Vector v2 = (Vector) arg1;
29  
30          for (int i = 1; i < (TrainingRecapPanel.FUTURE_WEEKS + 1); i++) {
31              String s1 = "" + v1.get(i); //$NON-NLS-1$
32              String s2 = "" + v2.get(i); //$NON-NLS-1$
33  
34              if (!s1.equalsIgnoreCase("") && s2.equalsIgnoreCase("")) { //$NON-NLS-1$ //$NON-NLS-2$
35                  return -1;
36              } else if (s1.equalsIgnoreCase("") && !s2.equalsIgnoreCase("")) { //$NON-NLS-1$ //$NON-NLS-2$
37                  return 1;
38              }
39          }
40  
41          return 1;
42      }
43  }