computecolumn
Class TableAddFunctionColumn
java.lang.Object
javax.swing.table.AbstractTableModel
tableoperations.TableMap
computecolumn.TableAddFunctionColumn
- All Implemented Interfaces:
- EventListener, Serializable, TableModel, TableModelListener
- public class TableAddFunctionColumn
- extends TableMap
A Table to calculate a new column given a function and two column indexes. It
Extends TableMap so it can be saved in a file.
- Author:
- Julien Robert
- See Also:
- Serialized Form
Constructor Summary |
TableAddFunctionColumn(TableModel model,
int column1,
int column2,
String function)
Creates a new TableAddFunctionColumn given a model and two columns to compute with the function. |
Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fromColumn1
private int fromColumn1
fromColumn2
private int fromColumn2
fromFunction
private String fromFunction
TableAddFunctionColumn
public TableAddFunctionColumn(TableModel model,
int column1,
int column2,
String function)
- Creates a new
TableAddFunctionColumn
given a model and two columns to compute with the function.
- Parameters:
model
- the model TableModel
column1
- the index of the first column to compute from.column2
- the index of the second column to compute from.function
- the string specifying the function to use.
calculateWithFunction
public static double calculateWithFunction(String function,
double a,
double b)
- Computes the given function on both operands a and b.
- Parameters:
function
- the string which specifies the function to usea
- the first operandb
- the second operand
- Returns:
- the result of the function calculated with both operands
getColumnClass
public Class getColumnClass(int aColumn)
- Specified by:
getColumnClass
in interface TableModel
- Overrides:
getColumnClass
in class TableMap
- See Also:
TableModel.getColumnClass(int)
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interface TableModel
- Overrides:
getColumnCount
in class TableMap
- See Also:
TableModel.getColumnCount()
getColumnName
public String getColumnName(int aColumn)
- Specified by:
getColumnName
in interface TableModel
- Overrides:
getColumnName
in class TableMap
- See Also:
TableModel.getColumnName(int)
getValueAt
public Object getValueAt(int aRow,
int aColumn)
- Specified by:
getValueAt
in interface TableModel
- Overrides:
getValueAt
in class TableMap
- See Also:
TableModel.getValueAt(int, int)
isCellEditable
public boolean isCellEditable(int row,
int column)
- Specified by:
isCellEditable
in interface TableModel
- Overrides:
isCellEditable
in class TableMap
- See Also:
TableModel.isCellEditable(int, int)
setValueAt
public void setValueAt(Object aValue,
int aRow,
int aColumn)
- Specified by:
setValueAt
in interface TableModel
- Overrides:
setValueAt
in class TableMap
- See Also:
TableModel.setValueAt(java.lang.Object, int, int)