Class TabDataFile

java.lang.Object
  |
  +--DataSource
        |
        +--TabDataSource
              |
              +--TabDataFile

public class TabDataFile
extends TabDataSource
implements Constants

Datafile implementation


Fields inherited from interface Constants
DEBUG, T_BOOLEAN, T_CLASS, T_DOUBLE, T_INTEGER, T_SELECT, T_UNSELECT
 
Constructor Summary
TabDataFile()
           
 
Method Summary
 void close()
          closes datafile
 boolean fetchFirst()
          Reads first line (row) from datafile
 boolean fetchNext()
          Reads next line (row) from datafile.
 boolean getColAsBoolean(int ix)
           
 int getColAsClass(int ix)
           
 java.lang.String getColAsClassString(int ix)
           
 double getColAsDouble(int ix)
           
 int getColAsInt(int ix)
           
 long getColAsLong(int ix)
           
 java.lang.String getColAsString(int ix)
           
 java.lang.String getColumnMeasurement(int ix)
           
 java.lang.String getColumnName(int ix)
           
 int getColumnType(int ix)
           
 java.lang.String getFileDesc()
           
 int getNumberOfClasses(int ix)
           
 int getNumberOfCols()
           
 int getNumberOfRows()
           
 java.lang.String getValueOfClass(int ix, int n)
           
 void open()
          Opens datafile and reads header
 boolean setFilename(java.lang.String filename)
          Sets filename for following open() -method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TabDataFile

public TabDataFile()
Method Detail

setFilename

public boolean setFilename(java.lang.String filename)
Sets filename for following open() -method
Parameters:
Complete - filename of datafile
Returns:
true if filename set successfully

open

public void open()
          throws java.io.IOException
Opens datafile and reads header

close

public void close()
           throws java.io.IOException
closes datafile

getFileDesc

public java.lang.String getFileDesc()
Returns:
Description of datafile.

getNumberOfRows

public int getNumberOfRows()
Returns:
Number of rows in datafile.

getNumberOfCols

public int getNumberOfCols()
Returns:
Number of columns in datafile.

getColumnName

public java.lang.String getColumnName(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Name of attribute

getColumnType

public int getColumnType(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Type of attribute (0==integer,1==double,2==class)

fetchFirst

public boolean fetchFirst()
                   throws java.io.IOException
Reads first line (row) from datafile

fetchNext

public boolean fetchNext()
                  throws java.io.IOException
Reads next line (row) from datafile.

getColumnMeasurement

public java.lang.String getColumnMeasurement(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Unit of measurement of attribute (if available)

getNumberOfClasses

public int getNumberOfClasses(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Number of classes in classified attribute (0==not classified)

getValueOfClass

public java.lang.String getValueOfClass(int ix,
                                        int n)
Parameters:
ix - Index to attribute-table.
n - Index to to list of class-descriptions in attribute-table
Returns:
Name of class in a classified-attribute

getColAsClassString

public java.lang.String getColAsClassString(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Value of class-attribute as String

getColAsString

public java.lang.String getColAsString(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Value of attribute as in datafile without type-conversion

getColAsInt

public int getColAsInt(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Value of attribute as integer

getColAsBoolean

public boolean getColAsBoolean(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Value of attribute as integer

getColAsLong

public long getColAsLong(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Value of attribute as long integer

getColAsClass

public int getColAsClass(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Value of classified attribute as integer

getColAsDouble

public double getColAsDouble(int ix)
Parameters:
ix - Index to attribute-table
Returns:
Value of attribute as double