JavaGrinders
Class DataFileParser

java.lang.Object
  extended by JavaGrinders.DataFileParser

public class DataFileParser
extends java.lang.Object

interfaces with disk-based files. A file is read and its content is parsed into * individual columns and rows. If no name is provided to its contructor, a getfile * dialog box allows the interactive selection of a file.


Field Summary
 java.lang.String[][] FileData
           
 
Constructor Summary
DataFileParser()
          constructor for the DataFileParser class if no text file name is provided
DataFileParser(java.lang.String filePath)
          standard constructor for the DataFileParser class
 
Method Summary
 int getNDataRows()
          returns the number of valid data rows that were read from the text file
 int getNRows()
          provides read access to private variable nRows
 int howManyColumns()
          provides read access to private variable nCols
 void listinFileInfo()
          report some info on the content read from the text file
 void listinFileInfo(int startLine, int endLine)
          report some info on the content read from the text file
 void readToInternalArray()
          nitty gritty of reading and parsing, it first steps thrpugh and gets the number * of rows and columns, then opens an array of that size to read into, then fills * it with the content of the file in a second pass
 void setDeliminators(java.lang.String delims)
          sets the deliminators for the fields in the text file as a regular expression
 void setrxcLimted(boolean limited)
          set whether the maximum number of rows and columns should be enforced
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FileData

public java.lang.String[][] FileData
Constructor Detail

DataFileParser

public DataFileParser(java.lang.String filePath)
               throws java.lang.Exception
standard constructor for the DataFileParser class

Parameters:
filePath - speficies the name and path of the text file to read from * @param firstLIneAsLabels speficies whether the first row of the text file contains column labels instead of data
Throws:
java.lang.Exception

DataFileParser

public DataFileParser()
               throws java.lang.Exception
constructor for the DataFileParser class if no text file name is provided

Throws:
java.lang.Exception
Method Detail

setDeliminators

public void setDeliminators(java.lang.String delims)
sets the deliminators for the fields in the text file as a regular expression

Parameters:
delims - specifies the deliminators, e.g. "//s" breaks on all white spaces

setrxcLimted

public void setrxcLimted(boolean limited)
set whether the maximum number of rows and columns should be enforced

Parameters:
limited - specifies whether it should be enforced

howManyColumns

public int howManyColumns()
provides read access to private variable nCols


getNRows

public int getNRows()
provides read access to private variable nRows


getNDataRows

public int getNDataRows()
returns the number of valid data rows that were read from the text file


readToInternalArray

public void readToInternalArray()
nitty gritty of reading and parsing, it first steps thrpugh and gets the number * of rows and columns, then opens an array of that size to read into, then fills * it with the content of the file in a second pass


listinFileInfo

public void listinFileInfo()
report some info on the content read from the text file


listinFileInfo

public void listinFileInfo(int startLine,
                           int endLine)
report some info on the content read from the text file

Parameters:
startLine - row at which to start
endLine - row at which to end