weka.gui
Class CostMatrixEditor.CostMatrixTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byweka.gui.CostMatrixEditor.CostMatrixTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Enclosing class:
CostMatrixEditor

private class CostMatrixEditor.CostMatrixTableModel
extends javax.swing.table.AbstractTableModel

This class wraps around the cost matrix presenting it as a TableModel so that it can be displayed and edited in a JTable.


Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
private CostMatrixEditor.CostMatrixTableModel()
           
 
Method Summary
 java.lang.Class getColumnClass(int columnIndex)
          Indicates the class of the objects within a column of the table.
 int getColumnCount()
          Gets the number of columns in the matrix.
 int getRowCount()
          Gets the number of rows in the matrix.
 java.lang.Object getValueAt(int row, int column)
          Returns a value at the specified position in the cost matrix.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Indicates whether a cell in the table is editable.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
          Sets a value at a specified position in the cost matrix.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnName, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CostMatrixEditor.CostMatrixTableModel

private CostMatrixEditor.CostMatrixTableModel()
Method Detail

getRowCount

public int getRowCount()
Gets the number of rows in the matrix. Cost matrices are square so it is the same as the column count, i.e. the size of the matrix.

Returns:
the row count

getColumnCount

public int getColumnCount()
Gets the number of columns in the matrix. Cost matrices are square so it is the same as the row count, i.e. the size of the matrix.

Returns:
the row count

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Returns a value at the specified position in the cost matrix.

Parameters:
row - the row position
column - the column position
Returns:
the value

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Sets a value at a specified position in the cost matrix.

Parameters:
aValue - the new value (should be of type Double).
rowIndex - the row position
columnIndex - the column position

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Indicates whether a cell in the table is editable. In this case all cells are editable so true is always returned.

Parameters:
rowIndex - the row position
columnIndex - the column position
Returns:
true

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Indicates the class of the objects within a column of the table. In this case all columns in the cost matrix consist of double values so Double.class is always returned.

Parameters:
columnIndex - the column position
Returns:
Double.class