edu.tufts.cs.geometry
Class NumericArrayParser
java.lang.Object
edu.tufts.cs.geometry.NumericArrayParser
public class NumericArrayParser
- extends java.lang.Object
A NumericArrayParser contains methods to read in
a double valued array from a string or a file. It handles only
numeric values, discarding all text. It creates an array in greedily
by choosing the longest contiguous set of lines with the same
dimensional data.
|
Method Summary |
static double[][] |
parse(java.io.File dataFile)
Parses a file containing a numeric data set and returns a
matrix representing that data set. |
static double[][] |
parse(java.lang.String data)
Parses a string containing a numeric data set and returns a
matrix representing that data set. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NumericArrayParser
public NumericArrayParser()
parse
public static double[][] parse(java.lang.String data)
- Parses a string containing a numeric data set and returns a
matrix representing that data set. If a string contains more than
just numbers, the largest dataset withing the string will be returned.
- Parameters:
data - the string value to be parsed. Data points must
be delimited by newlines.
- Returns:
- a two dimensional double array containing the matrix
representing the data set.
parse
public static double[][] parse(java.io.File dataFile)
- Parses a file containing a numeric data set and returns a
matrix representing that data set. If a file contains more than
just numbers, the largest dataset withing the file will be returned.
- Parameters:
data - the file containing the values to be parsed. Data points must
be delimited by newlines.
- Returns:
- a two dimensional double array containing the matrix
representing the data set.