|
|
|
|
@ -12,18 +12,16 @@ import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Responsible for parsing a polar data file, and creating a polar data object.
|
|
|
|
|
* Responsible for parsing a polar data file, and creating a Polar data object.
|
|
|
|
|
*/
|
|
|
|
|
public class PolarParser {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Given a filename, this function parses it and generates a PolarTable object, which can be queried for polar information.
|
|
|
|
|
* @param filename
|
|
|
|
|
* @return
|
|
|
|
|
* Given a filename, this function parses it and generates a Polar object, which can be queried for polar information.
|
|
|
|
|
* @param filename The filename to load and read data from (loaded as a resource).
|
|
|
|
|
* @return A Polar table containing data from the given file.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
///TEMP PolarTable = ArrayList<Polar>
|
|
|
|
|
public static Polars parse(String filename) throws InvalidPolarFileException {
|
|
|
|
|
//Temporary table to return later.
|
|
|
|
|
Polars polarTable = new Polars();
|
|
|
|
|
@ -87,8 +85,7 @@ public class PolarParser {
|
|
|
|
|
try {
|
|
|
|
|
//Add the polar value to the polar table
|
|
|
|
|
polarTable.addEstimate( Double.parseDouble(row[0]), Double.parseDouble(row[i]), Double.parseDouble(row[i + 1]));
|
|
|
|
|
}
|
|
|
|
|
catch (NumberFormatException e) {
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
throw new InvalidPolarFileException("Could not convert (Row,Col): (" + rowNumber + "," + i +") = " + row[i] + " to a double.", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|