Class SPTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--SPTableModel

public class SPTableModel
extends javax.swing.table.AbstractTableModel

A model for a table of StringProbs, as seen in fertility, distortion, translation, and language model tables; keeps rows ordered.

Author:
Noah A. Smith, Mike Jahr
See Also:
StringProb, StringProbComparator, Serialized Form

Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
SPTableModel(java.lang.String t)
          Create a new SPTableModel with label 't'.
 
Method Summary
 void add(StringProb sp)
          Add a StringProb 'sp' to the table.
 void clear()
          Clear the SPTM.
 StringProb correct()
          Return the first correct StringProb element in the table.
 int getColumnCount()
          Return the number of columns.
 java.lang.String getColumnName(int column)
          Return the name of the column numbered 'column'.
 int getRowCount()
          Return the number of rows.
 java.lang.Object getValueAt(int row, int column)
          Return the actual table value at row 'row' and column 'column'.
 void makeAllBlack()
          Make all of the StringProbs in the table black.
 java.awt.Color rowColor(int row)
          Return the color of the row numbered 'row'.
 boolean rowIsCorrect(int row)
          Tell whether row numbered 'row' is correct.
 void setColor(java.lang.String text, java.awt.Color color)
          Set the color of the StringProb with text 'text' to color 'color'.
 void setColorStartsWith(java.lang.String text, java.awt.Color color)
          Set the color of the StringProb starting with text 'text' to color 'color'.
 void setSortMethod(int meth, boolean dir)
          Sort the list by the given method.
 int size()
          Return the number of rows in the table.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPTableModel

public SPTableModel(java.lang.String t)
Create a new SPTableModel with label 't'.
Method Detail

rowIsCorrect

public boolean rowIsCorrect(int row)
Tell whether row numbered 'row' is correct.

setSortMethod

public void setSortMethod(int meth,
                          boolean dir)
Sort the list by the given method.
See Also:
StringProbComparator

getRowCount

public int getRowCount()
Return the number of rows.
Overrides:
getRowCount in class javax.swing.table.AbstractTableModel

getColumnCount

public int getColumnCount()
Return the number of columns.
Overrides:
getColumnCount in class javax.swing.table.AbstractTableModel

rowColor

public java.awt.Color rowColor(int row)
Return the color of the row numbered 'row'.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Return the actual table value at row 'row' and column 'column'.
Overrides:
getValueAt in class javax.swing.table.AbstractTableModel

getColumnName

public java.lang.String getColumnName(int column)
Return the name of the column numbered 'column'.
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

add

public void add(StringProb sp)
Add a StringProb 'sp' to the table.

size

public int size()
Return the number of rows in the table.

correct

public StringProb correct()
Return the first correct StringProb element in the table.

setColor

public void setColor(java.lang.String text,
                     java.awt.Color color)
Set the color of the StringProb with text 'text' to color 'color'.

makeAllBlack

public void makeAllBlack()
Make all of the StringProbs in the table black.

setColorStartsWith

public void setColorStartsWith(java.lang.String text,
                               java.awt.Color color)
Set the color of the StringProb starting with text 'text' to color 'color'.

clear

public void clear()
Clear the SPTM.