Compare commits
No commits in common. "aac8541abed7a11b2ae486876acafef84f2dc615" and "701302e3cdbb1e448c5b69ecace81d99a1b15f87" have entirely different histories.
aac8541abe
...
701302e3cd
|
@ -95,43 +95,44 @@ public class Spreadsheet {
|
||||||
ArrayList<String> fileRows = new ArrayList<>();
|
ArrayList<String> fileRows = new ArrayList<>();
|
||||||
Scanner sc = new Scanner(new File(filePath));
|
Scanner sc = new Scanner(new File(filePath));
|
||||||
|
|
||||||
while (sc.hasNextLine()) {
|
/* while (sc.hasNextLine()) {
|
||||||
fileRows.add(sc.nextLine());
|
fileRows.add(sc.nextLine());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ArrayList <int[]> formulas = new ArrayList<>();
|
ArrayList <int[]> formulas = new ArrayList<>();
|
||||||
|
|
||||||
for (int r = 0; r < fileRows.size(); r++) {
|
for (int rowI = 0; rowI < fileRows.size(); rowI++) {
|
||||||
String row = fileRows.get(r);
|
String row = fileRows.get(rowI);
|
||||||
String[] cells = row.split(separator);
|
String[] cells = row.split(separator);
|
||||||
|
|
||||||
for (int c = 0; c < cells.length; c++) {
|
for (int colI = 0; colI < cells.length; colI++) {
|
||||||
String cellFill = cells[c].toUpperCase();
|
String cellContent = cells[colI].toUpperCase();
|
||||||
|
|
||||||
if (cellFill.startsWith("=")){
|
if (cellContent.startsWith("=")){
|
||||||
formulas.add(new int[]{r, c});
|
formulas.add(new int[]{rowI, colI});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
put(r, c, cellFill);
|
put(rowI, colI, cellContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int[] formulaAt : formulas){
|
for (int[] formulaPos : formulas){
|
||||||
int r = formulaAt[0];
|
int rowI = formulaPos[0];
|
||||||
int c = formulaAt[1];
|
int colI = formulaPos[1];
|
||||||
System.out.printf("Formula at %d-%d %n", r, c);
|
System.out.printf("Formula at %d-%d %n", rowI, colI);
|
||||||
|
|
||||||
String row = fileRows.get(r);
|
String row = fileRows.get(rowI);
|
||||||
String formulaToFill = row.split(separator)[c];
|
String formulaToFill = row.split(separator)[colI];
|
||||||
|
|
||||||
put(r, c, formulaToFill);
|
put(rowI, colI, formulaToFill);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc.close();
|
sc.close();
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +306,7 @@ public class Spreadsheet {
|
||||||
/**
|
/**
|
||||||
* Method for calculating the minimum of a rectangular block of cells
|
* Method for calculating the minimum of a rectangular block of cells
|
||||||
* @param startCellName The name of the cell in the upper left corner of the rectangle.
|
* @param startCellName The name of the cell in the upper left corner of the rectangle.
|
||||||
* @param endCellName The name of the cell in the lower right corner of the rectangle.
|
* @param endCellName The name of the cell in the lower right corner ofODO the rectangle.
|
||||||
* @return The minimum.
|
* @return The minimum.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -344,7 +345,7 @@ public class Spreadsheet {
|
||||||
/**
|
/**
|
||||||
* Method for calculating the maximum of a rectangular block of cells
|
* Method for calculating the maximum of a rectangular block of cells
|
||||||
* @param startCellName The name of the cell in the upper left corner of the rectangle.
|
* @param startCellName The name of the cell in the upper left corner of the rectangle.
|
||||||
* @param endCellName The name of the cell in the lower right corner of the the rectangle.
|
* @param endCellName The name of the cell in the lower right corner ofODO the rectangle.
|
||||||
* @return The maximum.
|
* @return The maximum.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -381,7 +382,7 @@ public class Spreadsheet {
|
||||||
/**
|
/**
|
||||||
* Method for calculating the standard deviation of a rectangular block of cells
|
* Method for calculating the standard deviation of a rectangular block of cells
|
||||||
* @param startCellName The name of the cell in the upper left corner of the rectangle.
|
* @param startCellName The name of the cell in the upper left corner of the rectangle.
|
||||||
* @param endCellName The name of the cell in the lower right corner of the the rectangle.
|
* @param endCellName The name of the cell in the lower right corner ofODO the rectangle.
|
||||||
* @return The standard deviation calculated.
|
* @return The standard deviation calculated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue