com.ge.research.acuity.utils
Class TableSortComparator

java.lang.Object
  extended bycom.ge.research.acuity.utils.TableSortComparator
All Implemented Interfaces:
java.util.Comparator

public class TableSortComparator
extends java.lang.Object
implements java.util.Comparator

Comparator for TablePO objects that allows for rows of a table to be sorted based upon the values of specified columns

Version:
$Revision: 1.4 $ $Date: 2007/01/10 14:31:46 $
Author:
bruno

Constructor Summary
TableSortComparator(java.util.List colInfo, int sortCol)
          Creates a new TableSortComparator for a TablePO object with prioritized sort columns, and current sort column index and sort orientation flag
 
Method Summary
 int compare(java.lang.Object o1List, java.lang.Object o2List)
          Compares two rows within a TablePO data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

TableSortComparator

public TableSortComparator(java.util.List colInfo,
                           int sortCol)
Creates a new TableSortComparator for a TablePO object with prioritized sort columns, and current sort column index and sort orientation flag

Parameters:
colInfo - the list of TableColumnInfo objects representing the information about the columns of the table, including sort order, and sort method
sortCol - the current column info index to use
Method Detail

compare

public int compare(java.lang.Object o1List,
                   java.lang.Object o2List)
Compares two rows within a TablePO data. The comparator checks to make sure that each argument is a List containing the data for each column of the row. The item at the current sortCol position within both lists are extracted and compared. Depending on the type of data extracted and the value of the sortDescending flag, the values are compared and the method returns a -1 if o1List should come after o2List, 0 if o1List and o2List are equal, and 1 if o1List should come before o2List

Specified by:
compare in interface java.util.Comparator
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)