Mp3dings 
20100427

de.mospace.swing.table
Class TableSorter

java.lang.Object
  extended by de.mospace.swing.table.TableSorter

public class TableSorter
extends Object

A Table sorter along the lines of the TableSorter from Sun's Swing Tutorial. For a given SortableTableModel its sort and randomize methods produce a one-to-one mapping between entries and row numbers.

Version:
$Revision: 12 $ ($Date: 2007-07-27 11:48:53 +0200 (Fr, 27 Jul 2007) $)
Author:
Moritz Ringler

Field Summary
static int FWD
          index of the row-for-entry mapping in the arrays returned by the sort and randomize methods.
static int INV
          index of the entry-for-row mapping in the arrays returned by the sort and randomize methods.
 
Constructor Summary
TableSorter()
          Constructs a new TableSorter.
 
Method Summary
 int[][] randomize(SortableTableModel m)
          Returns a random row-entry mapping for the specified SortableTableModel.
 int[][] sort(SortableTableModel m)
          Sorts the specified table model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FWD

public static final int FWD
index of the row-for-entry mapping in the arrays returned by the sort and randomize methods.

See Also:
Constant Field Values

INV

public static final int INV
index of the entry-for-row mapping in the arrays returned by the sort and randomize methods.

See Also:
Constant Field Values
Constructor Detail

TableSorter

public TableSorter()
Constructs a new TableSorter. The same table sorter can be used to sort multiple table models.

Method Detail

sort

public int[][] sort(SortableTableModel m)
Sorts the specified table model.

Parameters:
m - the data to sort
Returns:
a 2D array holding the new row-for-entry mapping at index FWD and the inverse mapping at index INV.

randomize

public int[][] randomize(SortableTableModel m)
Returns a random row-entry mapping for the specified SortableTableModel.

Parameters:
m - the data to randomize
Returns:
a 2D array holding the new row-for-entry mapping at index FWD and the inverse mapping at index INV.

Mp3dings 
20100427