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<>();
|
||||
Scanner sc = new Scanner(new File(filePath));
|
||||
|
||||
while (sc.hasNextLine()) {
|
||||
/* while (sc.hasNextLine()) {
|
||||
fileRows.add(sc.nextLine());
|
||||
}
|
||||
|
||||
|
||||
ArrayList <int[]> formulas = new ArrayList<>();
|
||||
|
||||
for (int r = 0; r < fileRows.size(); r++) {
|
||||
String row = fileRows.get(r);
|
||||
for (int rowI = 0; rowI < fileRows.size(); rowI++) {
|
||||
String row = fileRows.get(rowI);
|
||||
String[] cells = row.split(separator);
|
||||
|
||||
for (int c = 0; c < cells.length; c++) {
|
||||
String cellFill = cells[c].toUpperCase();
|
||||
for (int colI = 0; colI < cells.length; colI++) {
|
||||
String cellContent = cells[colI].toUpperCase();
|
||||
|
||||
if (cellFill.startsWith("=")){
|
||||
formulas.add(new int[]{r, c});
|
||||
if (cellContent.startsWith("=")){
|
||||
formulas.add(new int[]{rowI, colI});
|
||||
}
|
||||
else {
|
||||
put(r, c, cellFill);
|
||||
put(rowI, colI, cellContent);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (int[] formulaAt : formulas){
|
||||
int r = formulaAt[0];
|
||||
int c = formulaAt[1];
|
||||
System.out.printf("Formula at %d-%d %n", r, c);
|
||||
for (int[] formulaPos : formulas){
|
||||
int rowI = formulaPos[0];
|
||||
int colI = formulaPos[1];
|
||||
System.out.printf("Formula at %d-%d %n", rowI, colI);
|
||||
|
||||
String row = fileRows.get(r);
|
||||
String formulaToFill = row.split(separator)[c];
|
||||
String row = fileRows.get(rowI);
|
||||
String formulaToFill = row.split(separator)[colI];
|
||||
|
||||
put(r, c, formulaToFill);
|
||||
put(rowI, colI, formulaToFill);
|
||||
}
|
||||
|
||||
sc.close();
|
||||
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -305,7 +306,7 @@ public class Spreadsheet {
|
|||
/**
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
|
@ -344,7 +345,7 @@ public class Spreadsheet {
|
|||
/**
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
|
@ -381,7 +382,7 @@ public class Spreadsheet {
|
|||
/**
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in New Issue