Class TransDistanceModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--TransDistanceModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class TransDistanceModel
extends javax.swing.table.AbstractTableModel

This class is used to display the transform distance table in the NJ algorithm.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TransDistanceModel(int numOfNodes, Node[] nodes, double[][] inTransDistance, int random_m, int random_n)
          Construct the object with the specified values.
 
Method Summary
 int getColumnCount()
          Overrides the method in the TableModel class and returns the column count of the table.
 java.lang.String getColumnName(int columnIndex)
          Overrides the method in the TableModel class and returns the column names of the table.
 int getRowCount()
          Overrides the method in the TableModel class and returns the row count of the table.
 java.lang.Object getValueAt(int row, int col)
          Overrides the method in the TableModel class and returns the value of each table cell.
 void update()
          Updates and resets the random question cell row and column.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransDistanceModel

public TransDistanceModel(int numOfNodes,
                          Node[] nodes,
                          double[][] inTransDistance,
                          int random_m,
                          int random_n)
Construct the object with the specified values.

Parameters:
numOfNodes - the number of nodes created so far
nodes - the nodes of the trees
inTransDistance - the transform distance matrix
random_m - the row index of the cell for pop up questions
random_n - the column index of the cell for pop up questions
Method Detail

getColumnCount

public int getColumnCount()
Overrides the method in the TableModel class and returns the column count of the table.

Returns:
the column count of the table

getRowCount

public int getRowCount()
Overrides the method in the TableModel class and returns the row count of the table.

Returns:
the row count of the table

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Overrides the method in the TableModel class and returns the value of each table cell.

Parameters:
row - the row whose value is to be queried
col - the column whose value is to be queried
Returns:
the value Object at the specified cell

getColumnName

public java.lang.String getColumnName(int columnIndex)
Overrides the method in the TableModel class and returns the column names of the table.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
columnIndex - the index of the column
Returns:
the name of the column

update

public void update()
Updates and resets the random question cell row and column.