databionics.io
Class CsvFile

java.lang.Object
  extended by databionics.io.BaseFile
      extended by databionics.io.Array2DFile
          extended by databionics.io.LrnFile
              extended by databionics.io.CsvFile

public class CsvFile
extends LrnFile

Comma seperated values So far only tested with loading data from finance.yahoo.com.


Field Summary
protected  java.util.Calendar calendar
          calendar for date calculations.
protected  java.text.DateFormat df
          date format.
protected static org.apache.log4j.Logger log
          Log4j logging.
 
Fields inherited from class databionics.io.LrnFile
classColumnIndex, classColumnName, classes, CLS_COLUMN, DAT_COLUMN, defines, KEY_COLUMN, keyColumnIndex, keyColumnName, keys, names, NUL_COLUMN, nullColumns
 
Fields inherited from class databionics.io.Array2DFile
data
 
Fields inherited from class databionics.io.BaseFile
allowEmptyLines, comment, commentPrefix, delimiter, delimiters, file, header, headerPrefix, loc, nf
 
Constructor Summary
CsvFile()
          Standard constructor
CsvFile(int rows, int cols)
          Constructor with size for an empty array.
CsvFile(LrnFile file)
          Clone constructor
CsvFile(java.lang.String filename)
          Constructor with a filename
 
Method Summary
protected  void buildHeader()
          Generate header.
protected  void checkHeader()
          Check consistency of header information.
static FileType getFileType()
          Get the type of file.
protected  void init()
          Init data fields.
protected  boolean isHeader(java.lang.String line)
          Determine if a line still contains header information or whether the data lines started
protected  void parseHeader()
          Parse the header.
protected  void parseLine(int row, java.lang.String line)
          Parse a line.
 
Methods inherited from class databionics.io.LrnFile
buildLine, getByIndex, getClassColumnIndex, getClassColumnName, getClasses, getDefines, getKeyColumnIndex, getKeyColumnName, getKeys, getNames, init, initTest, parseNames, removeColumn, setClassColumnName, setClasses, setClasses, setDefines, setDefines, setDefines, setKeyColumnName, setKeys, setKeys, setKeys, setNames, setNames
 
Methods inherited from class databionics.io.Array2DFile
get, getColumns, getData, getRows, getSize, set, setData, setData
 
Methods inherited from class databionics.io.BaseFile
checkHeaderAgainstSize, getComment, getFile, getFilename, getHeader, getLocale, getNumberFormat, isNaN, isNumber, load, load, parseError, save, save, setComment, setFilename, setLocale, writeStringList, writeStringList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log
Log4j logging.


df

protected java.text.DateFormat df
date format.


calendar

protected java.util.Calendar calendar
calendar for date calculations.

Constructor Detail

CsvFile

public CsvFile()
Standard constructor


CsvFile

public CsvFile(java.lang.String filename)
Constructor with a filename

Parameters:
filename - Name of the file

CsvFile

public CsvFile(int rows,
               int cols)
Constructor with size for an empty array.

Parameters:
rows - Rows of data array.
cols - Columns of data array.

CsvFile

public CsvFile(LrnFile file)
Clone constructor

Method Detail

init

protected void init()
Init data fields. Needed in several constructors.


isHeader

protected boolean isHeader(java.lang.String line)
Determine if a line still contains header information or whether the data lines started

Overrides:
isHeader in class BaseFile
Parameters:
line - Line to check

parseHeader

protected void parseHeader()
Parse the header.

Overrides:
parseHeader in class LrnFile

parseLine

protected void parseLine(int row,
                         java.lang.String line)
Parse a line.

Overrides:
parseLine in class LrnFile
Parameters:
row - Number of current line.
line - Current line.

checkHeader

protected void checkHeader()
Check consistency of header information.

Overrides:
checkHeader in class LrnFile

buildHeader

protected void buildHeader()
Generate header.

Overrides:
buildHeader in class LrnFile

getFileType

public static FileType getFileType()
Get the type of file.



Copyright © 2005-2006 Databionics Research Group. All Rights Reserved.