View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package org.kuali.mobility.academics.util;
6   
7   import java.util.Comparator;
8   import org.kuali.mobility.academics.entity.Section;
9   
10  /**
11   *
12   * @author xinfeng
13   */
14  public class SortSections implements Comparator<Section> {
15  
16      @Override
17      public int compare(Section s1, Section s2) {
18          int comp;
19          comp = s1.getSubjectId().compareTo(s2.getSubjectId());
20          
21          if (comp==0) {
22              comp = s1.getCatalogNumber().compareTo(s2.getCatalogNumber());
23              
24              if (comp==0) {
25                  comp = s1.getNumber().compareTo(s2.getNumber());
26              }
27          }
28          
29          return comp;
30      }
31      
32  }