com.croftsoft.core.gui.table
Class RowSortComparator

java.lang.Object
  extended by com.croftsoft.core.gui.table.RowSortComparator
All Implemented Interfaces:
Comparator

public final class RowSortComparator
extends Object
implements Comparator

Sorts rows based upon comparison of elements within a column.

Since:
2001-08-07
Version:
2001-08-08
Author:
David Wallace Croft

Constructor Summary
RowSortComparator()
          Convenience constructor.
RowSortComparator(int index, boolean reverse)
          Main constructor.
 
Method Summary
 int compare(Object o1, Object o2)
          Compares two rows based upon column values.
 void setIndex(int index)
          The column index on which the rows are to be sorted.
 void setReverse(boolean reverse)
          Reverses the sort order.
 
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

RowSortComparator

public RowSortComparator(int index,
                         boolean reverse)
Main constructor.


RowSortComparator

public RowSortComparator()
Convenience constructor.
 this ( 0, false );
 

Method Detail

setIndex

public void setIndex(int index)
The column index on which the rows are to be sorted.


setReverse

public void setReverse(boolean reverse)
Reverses the sort order.


compare

public int compare(Object o1,
                   Object o2)
Compares two rows based upon column values.

The row arguments should implement the java.util.List interface. Row elements must implement the java.util.Comparable interface.

Specified by:
compare in interface Comparator

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)