Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.encog.app.analyst.csv.basic
Class BasicFile

    java.lang.Object
      org.encog.app.analyst.csv.basic.BasicFile

All Implemented Interfaces:
  QuantTask

Direct Known Subclasses:
  AnalystClusterCSV, AnalystEvaluateCSV, AnalystEvaluateRawCSV, AnalystNormalizeCSV, BalanceCSV, BasicCachedFile, FilterCSV, SegregateCSV, ShuffleCSV, SortCSV

    public class BasicFile

extends Object
implements QuantTask

Many of the Encog quant CSV processors are based upon this class. This class is not useful on its own. However, it does form the foundation for most Encog CSV file processing.

Field Summary
`static int` | `REPORT_INTERVAL` The default report interval.

Constructor Summary
`BasicFile()` Construct the object, and set the defaults.

Method Summary
`static void` | `appendSeparator(StringBuilder line, CSVFormat format)` Append a separator.
`int` | `getColumnCount()`
`CSVFormat` | `getFormat()`
`File` | `getInputFilename()`
`String[]` | `getInputHeadings()`
`int` | `getPrecision()`
`int` | `getRecordCount()`
`StatusReportable` | `getReport()`
`int` | `getReportInterval()`
`AnalystScript` | `getScript()`
`boolean` | `isAnalyzed()`
`boolean` | `isExpectInputHeaders()`
`boolean` | `isProduceOutputHeaders()`
`void` | `performBasicCounts()` Perform a basic analyze of the file.
`PrintWriter` | `prepareOutputFile(File outputFile)` Prepare the output file, write headers if needed.
`void` | `readHeaders(ReadCSV csv)` Read the headers from a CSV file.
`void` | `reportDone(boolean isAnalyzing)` Report that we are done.
`void` | `reportDone(String task)` Report that we are done.
`void` | `requestStop()` Request a stop.
`void` | `resetStatus()` Reset the reporting stats.
`void` | `setAnalyzed(boolean theAnalyzed)` Set to true, if the file has been analyzed.
`void` | `setColumnCount(int theColumnCount)` Set the column count.
`void` | `setExpectInputHeaders(boolean theExpectInputHeaders)` Set the flag to determine if we are expecting input headers.
`void` | `setInputFilename(File theInputFilename)` Set the input filename.
`void` | `setInputFormat(CSVFormat theInputFormat)` Set the input format.
`void` | `setInputHeadings(String[] theInputHeadings)` Set the input headings.
`void` | `setPrecision(int thePrecision)` Set the precision to use.
`void` | `setProduceOutputHeaders(boolean theProduceOutputHeaders)`
`void` | `setRecordCount(int v)` Set the record count.
`void` | `setReport(StatusReportable theReport)` Set the status reporting object.
`void` | `setReportInterval(int theReportInterval)` Set the reporting interval.
`void` | `setScript(AnalystScript theScript)`
`boolean` | `shouldStop()`
`String` | `toString()`
`void` | `updateStatus(boolean isAnalyzing)` Update the status.
`void` | `updateStatus(String task)` Report the current status.
`void` | `validateAnalyzed()` Validate that the file has been analyzed.
`void` | `writeRow(PrintWriter tw, LoadedRow row)` Write a row to the output file.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### REPORT_INTERVAL

    public static final int REPORT_INTERVAL

  The default report interval.

  See Also:
    Constant Field Values

Constructor Detail

### BasicFile

    public BasicFile()

  Construct the object, and set the defaults.

Method Detail

### appendSeparator

    public static void appendSeparator(StringBuilder line,
                                       CSVFormat format)

  Append a separator. The separator will only be appended if the line is not empty. This is used to build comma(or other) separated lists.

  Parameters:
    `line` - The line to append to.
    `format` - The format to use.

### getColumnCount

    public final int getColumnCount()

  Returns:
    The column count.

### getInputFilename

    public final File getInputFilename()

  Returns:
    The input filename.

### getFormat

    public final CSVFormat getFormat()

  Returns:
    THe input format.

### getInputHeadings

    public final String[] getInputHeadings()

  Returns:
    The input headings.

### getPrecision

    public final int getPrecision()

  Returns:
    The precision to use.

### getRecordCount

    public final int getRecordCount()

  Returns:
    Get the record count. File must have been analyzed first to read the record count.

### getReport

    public final StatusReportable getReport()

  Returns:
    The status reporting object.

### getReportInterval

    public final int getReportInterval()

  Returns:
    The reporting interval, an update will be sent for every block of rows that matches the size of this property.

### isAnalyzed

    public final boolean isAnalyzed()

  Returns:
    Has the file been analyzed.

### isExpectInputHeaders

    public final boolean isExpectInputHeaders()

  Returns:
    True if we are expecting input headers.

### isProduceOutputHeaders

    public final boolean isProduceOutputHeaders()

  Returns:
    the produceOutputHeaders

### performBasicCounts

    public final void performBasicCounts()

  Perform a basic analyze of the file. This method is used mostly internally.

### prepareOutputFile

    public final PrintWriter prepareOutputFile(File outputFile)

  Prepare the output file, write headers if needed.

  Parameters:
    `outputFile` - The name of the output file.
  Returns:
    The output stream for the text file.

### readHeaders

    public final void readHeaders(ReadCSV csv)

  Read the headers from a CSV file. Used mostly internally.

  Parameters:
    `csv` - The CSV file to read from.

### reportDone

    public final void reportDone(boolean isAnalyzing)

  Report that we are done. Used internally.

  Parameters:
    `isAnalyzing` - True if we are analyzing.

### reportDone

    public final void reportDone(String task)

  Report that we are done. Used internally.

  Parameters:
    `task` - The message.

### requestStop

    public final void requestStop()

  Request a stop.

  Specified by:
    `requestStop` in interface `QuantTask`

### resetStatus

    public final void resetStatus()

  Reset the reporting stats. Used internally.

### setAnalyzed

    public final void setAnalyzed(boolean theAnalyzed)

  Set to true, if the file has been analyzed.

  Parameters:
    `theAnalyzed` - True, if the file has been analyzed.

### setColumnCount

    public final void setColumnCount(int theColumnCount)

  Set the column count.

  Parameters:
    `theColumnCount` - The new column count.

### setExpectInputHeaders

    public final void setExpectInputHeaders(boolean theExpectInputHeaders)

  Set the flag to determine if we are expecting input headers.

  Parameters:
    `theExpectInputHeaders` - Are input headers expected?

### setInputFilename

    public final void setInputFilename(File theInputFilename)

  Set the input filename.

  Parameters:
    `theInputFilename` - The input filename.

### setInputFormat

    public final void setInputFormat(CSVFormat theInputFormat)

  Set the input format.

  Parameters:
    `theInputFormat` - The new inputFormat format.

### setInputHeadings

    public final void setInputHeadings(String[] theInputHeadings)

  Set the input headings.

  Parameters:
    `theInputHeadings` - The new input headings.

### setPrecision

    public final void setPrecision(int thePrecision)

  Set the precision to use.

  Parameters:
    `thePrecision` - The precision to use.

### setProduceOutputHeaders

    public final void setProduceOutputHeaders(boolean theProduceOutputHeaders)

  Parameters:
    `theProduceOutputHeaders` - the produceOutputHeaders to set

### setRecordCount

    public final void setRecordCount(int v)

  Set the record count.

  Parameters:
    `v` - The record count.

### setReport

    public final void setReport(StatusReportable theReport)

  Set the status reporting object.

  Parameters:
    `theReport` - The status reporting object.

### setReportInterval

    public final void setReportInterval(int theReportInterval)

  Set the reporting interval.

  Parameters:
    `theReportInterval` - The new reporting interval.

### shouldStop

    public final boolean shouldStop()

  Specified by:
    `shouldStop` in interface `QuantTask`
  Returns:
    Should we stop?

### toString

    public final String toString()

  Overrides:
    `toString` in class `Object`

### updateStatus

    public final void updateStatus(boolean isAnalyzing)

  Update the status. Used internally.

  Parameters:
    `isAnalyzing` - True if we are in the process of analyzing.

### updateStatus

    public final void updateStatus(String task)

  Report the current status.

  Parameters:
    `task` - The string to report.

### validateAnalyzed

    public final void validateAnalyzed()

  Validate that the file has been analyzed. Throw an error, if it has not.

### writeRow

    public final void writeRow(PrintWriter tw,
                               LoadedRow row)

  Write a row to the output file.

  Parameters:
    `tw` - The output stream.
    `row` - The row to write out.

### getScript

    public final AnalystScript getScript()

  Returns:
    the script

### setScript

    public final void setScript(AnalystScript theScript)

  Parameters:
    `theScript` - the script to set

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.