Plotting
Class PlotFileReader
java.lang.Object
Plotting.PlotFileReader
public class PlotFileReader
- extends java.lang.Object
File reader class for plot files.
This class contains static functions for parsing plot data files.
The methods of his class parse the files and return an object
containing the parsed data. The class of the returned object depends
on the plot type: for two-D graphs and histograms, it is
PlotData
- Since:
- 1.0
- See Also:
PlotData
Method Summary |
static int |
ParseFloats(java.lang.String line,
java.lang.Float[] arr,
int maxFloats)
|
static int |
ParseSeparatorFloats(java.lang.String line,
java.lang.Float[] arr,
int beginIndex,
int maxFloats,
java.lang.String separator)
|
static PlotData<java.lang.Float> |
Read2DPlotDataFile(java.lang.String fileName)
Parses a two dimensional plot file and returns PlotData. |
static PlotData<java.lang.Float> |
ReadFinanceFile(java.lang.String fileName)
Parse a finance data file saved from Yahoo finance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mErrorDescription
public static java.lang.String mErrorDescription
PlotFileReader
public PlotFileReader()
ParseFloats
public static int ParseFloats(java.lang.String line,
java.lang.Float[] arr,
int maxFloats)
throws java.lang.NumberFormatException,
java.io.IOException
- Throws:
java.lang.NumberFormatException
java.io.IOException
ParseSeparatorFloats
public static int ParseSeparatorFloats(java.lang.String line,
java.lang.Float[] arr,
int beginIndex,
int maxFloats,
java.lang.String separator)
throws java.lang.NumberFormatException,
java.io.IOException
- Throws:
java.lang.NumberFormatException
java.io.IOException
Read2DPlotDataFile
public static PlotData<java.lang.Float> Read2DPlotDataFile(java.lang.String fileName)
Parses a two dimensional plot file and returns PlotData.
File format is:
- Every line contains two floating point numbers, first X
and second Y coordinate.
- Every point defines a new point on the plot, joined to the
previous point.
- To break a plot, use break on a line.
Eg:
0 0
1 1
Defines a two point plot.
- Parameters:
fileName
- Name of file to be read.
- Returns:
- PlotData
ReadFinanceFile
public static PlotData<java.lang.Float> ReadFinanceFile(java.lang.String fileName)
- Parse a finance data file saved from Yahoo finance.
The file looks like:
Date,Open,High,Low,Close,Volume,Adj Close
2008-08-26,11383.56,11483.62,11284.47,11412.87,3587570000,11412.87
- Parameters:
fileName
- Name of the file
- Returns:
- PlotData if file read operation was successful. All
errors are recorded in mErrorDescription