laur.dm.ar
Class DBReader

java.lang.Object
  |
  +--laur.dm.ar.DBReader

public class DBReader
extends java.lang.Object

A DBReader is used to read data from a database.


Constructor Summary
DBReader(java.lang.String fileName)
          Create a new DBReader according to the input file name.
 
Method Summary
 boolean checkIntegrity()
          Check the integrity of the database.
 void close()
          Close the I/O stream.
 java.lang.String getColumnName(int i)
          Get the i-th column name from database.
 java.util.ArrayList getColumnNames()
          Get all the column names for database.
 java.lang.String getDescription()
          Get the description of the database.
 Itemset getFirstRow()
          Get first row of the table from the data file.
 Itemset getNextRow()
          Get the next row of data since last reading.
 long getNumColumns()
          Get the number of the columns in database.
 long getNumRows()
          Get the number of the rows in database.
 java.lang.String getVersion()
          Get the file version number.
 boolean hasMoreRows()
          Tell whether there are more rows to be read from the database.
static void main(java.lang.String[] arg)
          sample usage and testing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBReader

public DBReader(java.lang.String fileName)
         throws java.io.IOException
Create a new DBReader according to the input file name.
Parameters:
fileName - the name of the file
Throws:
java.io.IOException - from library call
Method Detail

close

public void close()
           throws java.io.IOException
Close the I/O stream.

getVersion

public java.lang.String getVersion()
Get the file version number.
Returns:
a String containing the version (ex: 1.1.7)

getNumRows

public long getNumRows()
Get the number of the rows in database.
Returns:
number of rows in database

getNumColumns

public long getNumColumns()
Get the number of the columns in database.
Returns:
number of columns in database

getColumnNames

public java.util.ArrayList getColumnNames()
Get all the column names for database.
Returns:
a ArrayList containing the column names

getColumnName

public java.lang.String getColumnName(int i)
                               throws DBException
Get the i-th column name from database.
Parameters:
i - the index of the column requested
Returns:
name of column

getDescription

public java.lang.String getDescription()
Get the description of the database.

checkIntegrity

public boolean checkIntegrity()
                       throws java.io.IOException
Check the integrity of the database.
Returns:
true if test passed, false otherwise
Throws:
java.io.IOException - from library call

getFirstRow

public Itemset getFirstRow()
                    throws java.io.IOException,
                           DBException
Get first row of the table from the data file.
Returns:
first Itemset from database
Throws:
java.io.IOException - from library call
DBException - an invalid item has been met

getNextRow

public Itemset getNextRow()
                   throws java.io.IOException,
                          DBException
Get the next row of data since last reading.
Throws:
java.io.IOException - from library call
DBException - an invalid item has been met

hasMoreRows

public boolean hasMoreRows()
Tell whether there are more rows to be read from the database.
Returns:
true if there are more rows, false otherwise

main

public static void main(java.lang.String[] arg)
sample usage and testing