CorrectionGroupComparator.java :  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » web » optionfinder » Java Open Source

Java Open Source » ERP CRM Financial » Kuali Financial System 
Kuali Financial System » org » kuali » module » gl » web » optionfinder » CorrectionGroupComparator.java
/*
 * Copyright 2006 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.module.gl.web.optionfinder;

import java.util.Comparator;

import org.kuali.module.gl.bo.CorrectionChangeGroup;

/**
 * A comparator that compares to GLCP correction change groups based on their group line numbers
 * within the GLCP document
 */
public class CorrectionGroupComparator implements Comparator {

    /**
     * Constructs a CorrectionGroupComparator instance
     */
    public CorrectionGroupComparator() {
    }

    /**
     * Compares two CorrectionChangeGroups based on thier line numbers within a GLCP document
     *
     * @param c1 a correction change group to compare
     * @param c2 another correction change group to compare the first one to
     * @return a negative integer if c1 has a lower line number than c2, 0 if the two line numbers are equal, a positive number if c1 has a greater line number than c2 
     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
     */
    public int compare(Object c1, Object c2) {

        CorrectionChangeGroup ccg1 = (CorrectionChangeGroup) c1;
        CorrectionChangeGroup ccg2 = (CorrectionChangeGroup) c2;

        return ccg1.getCorrectionChangeGroupLineNumber().compareTo(ccg2.getCorrectionChangeGroupLineNumber());
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.