001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.kfs.gl.businessobject.options; 017 018 import java.util.Comparator; 019 020 import org.kuali.kfs.gl.businessobject.OriginEntryGroup; 021 022 /** 023 * A comparator for origin entry groups, based on their group IDs 024 */ 025 public class OEGIdComparator implements Comparator { 026 027 /** 028 * Constructs a OEGIdComparator 029 */ 030 public OEGIdComparator() { 031 } 032 033 /** 034 * Compares two origin entry groups based on their group ids 035 * 036 * @param c1 the first origin entry group to compare 037 * @param c2 the second origin entry group to comare 038 * @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 039 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) 040 */ 041 public int compare(Object c1, Object c2) { 042 043 OriginEntryGroup oeg1 = (OriginEntryGroup) c1; 044 OriginEntryGroup oeg2 = (OriginEntryGroup) c2; 045 046 return oeg2.getId().compareTo(oeg1.getId()); 047 } 048 049 }