The Meta-Environment API

nl.cwi.sen1.visplugin.table.model
Class TableSorter

java.lang.Object
  extended by nl.cwi.sen1.visplugin.table.model.TableSorter

public class TableSorter
extends java.lang.Object

Table sorter. Sorts a table using comparators

Author:
Anton Gerdessen

Field Summary
(package private)  SortableTableModel model
           
 
Constructor Summary
TableSorter(SortableTableModel model)
          Constructor.
 
Method Summary
private  int compare(int column, int row1, int row2)
          Compare two values in one column, these two values are the values at (column, row1) and (column, row2).
private  int compare(java.lang.Number num1, java.lang.Number num2)
          Number comparator based on doubles.
 void sort(int column, boolean isAscent)
          Sort the table on a given column and an order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

SortableTableModel model
Constructor Detail

TableSorter

public TableSorter(SortableTableModel model)
Constructor.

Parameters:
model - The model to sort
Method Detail

sort

public void sort(int column,
                 boolean isAscent)
Sort the table on a given column and an order.

Parameters:
column - the column to sort on
isAscent - ascending (true) or or decending (false) order

compare

private int compare(int column,
                    int row1,
                    int row2)
Compare two values in one column, these two values are the values at (column, row1) and (column, row2).

Parameters:
column - the column to sort on
row1 - The numbers to compare
row2 - The numbers to compare

compare

private int compare(java.lang.Number num1,
                    java.lang.Number num2)
Number comparator based on doubles. Return -1 if num2 is greater, 1 if num1 is greater, else 0.

Parameters:
num1 - The numbers to compare
num2 - The numbers to compare

The Meta-Environment API