edu.isi.karma.modeling.semantictypes.myutils
Class DBTable
java.lang.Object
edu.isi.karma.modeling.semantictypes.myutils.DBTable
public class DBTable
- extends java.lang.Object
This class simulated a normal rectangular table.
- Author:
- amangoel
Constructor Summary |
DBTable(int numColumns)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DBTable
public DBTable(int numColumns)
setColumnNames
public void setColumnNames(java.util.List<java.lang.String> columnNames)
addRow
public void addRow(java.util.List<java.lang.String> row)
- Parameters:
row
- - a list of strings that represent the values in a row
This method adds the supplied row at the end of the tableData list of rows.
It makes sure that the number of items in the list = numColumns
getValue
public java.lang.String getValue(int row,
int col)
- Parameters:
row
- Row Indexcol
- Col Index
- Returns:
- Value at row, col
getColumn
public void getColumn(int col,
java.util.List<java.lang.String> columnValues)
- Parameters:
col
- The column index for which the values are required.columnValues
- The list in which the values will be returned.
writeObjectToFile
public boolean writeObjectToFile(java.lang.String file)
throws java.lang.Exception
- Parameters:
file
- The file to which the object should be written
- Returns:
- True, if the operation was successful, False, otherwise.
- Throws:
java.lang.Exception
readDBTableFromFile
public static DBTable readDBTableFromFile(java.lang.String file)
throws java.lang.Exception
- Parameters:
file
- - the file from which the object would be created.
- Returns:
- The new created object that represents the table.
- Throws:
java.lang.Exception
numColumns
public int numColumns()
numRows
public int numRows()