View Javadoc
1   /*
2    * Copyright 2007 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.gl.businessobject.options;
17  
18  import java.util.Comparator;
19  
20  import org.kuali.ole.gl.businessobject.OriginEntryGroup;
21  
22  /**
23   * A comparator for origin entry groups, based on their group IDs
24   */
25  public class OEGIdComparator implements Comparator {
26  
27      /**
28       * Constructs a OEGIdComparator
29       */
30      public OEGIdComparator() {
31      }
32  
33      /**
34       * Compares two origin entry groups based on their group ids
35       * 
36       * @param c1 the first origin entry group to compare
37       * @param c2 the second origin entry group to comare
38       * @return a negative if c1's group ID is less than c2's; a zero if the group IDs are equal; a positive number otherwise
39       * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
40       */
41      public int compare(Object c1, Object c2) {
42  
43          OriginEntryGroup oeg1 = (OriginEntryGroup) c1;
44          OriginEntryGroup oeg2 = (OriginEntryGroup) c2;
45  
46          return oeg2.getId().compareTo(oeg1.getId());
47      }
48  
49  }