edu.isi.karma.modeling.semantictypes.myutils
Class DBTable

java.lang.Object
  extended by 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)
           
 
Method Summary
 void addRow(java.util.List<java.lang.String> row)
           
 void getColumn(int col, java.util.List<java.lang.String> columnValues)
           
 java.lang.String getValue(int row, int col)
           
 int numColumns()
           
 int numRows()
           
static DBTable readDBTableFromFile(java.lang.String file)
           
 void setColumnNames(java.util.List<java.lang.String> columnNames)
           
 boolean writeObjectToFile(java.lang.String file)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBTable

public DBTable(int numColumns)
Method Detail

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 Index
col - 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()