From 576bdc882198f06fb69dbf7b03aa613ecab46931 Mon Sep 17 00:00:00 2001 From: emelie Date: Mon, 8 Jan 2024 21:52:47 +0100 Subject: [PATCH] //implemented readCsv --- .../informatik/spreadsheet/Spreadsheet.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java index d76c893..6f118ac 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java @@ -95,44 +95,44 @@ public class Spreadsheet { ArrayList fileRows = new ArrayList<>(); Scanner sc = new Scanner(new File(filePath)); -/* while (sc.hasNextLine()) { + while (sc.hasNextLine()) { fileRows.add(sc.nextLine()); } ArrayList formulas = new ArrayList<>(); - for (int rowI = 0; rowI < fileRows.size(); rowI++) { - String row = fileRows.get(rowI); + for (int r = 0; r < fileRows.size(); r++) { + String row = fileRows.get(r); String[] cells = row.split(separator); - for (int colI = 0; colI < cells.length; colI++) { - String cellContent = cells[colI].toUpperCase(); + for (int c = 0; c < cells.length; c++) { + String cellFill = cells[c].toUpperCase(); - if (cellContent.startsWith("=")){ - formulas.add(new int[]{rowI, colI}); + if (cellFill.startsWith("=")){ + formulas.add(new int[]{r, c}); } else { - put(rowI, colI, cellContent); + put(r, c, cellFill); } } } - for (int[] formulaPos : formulas){ - int rowI = formulaPos[0]; - int colI = formulaPos[1]; - System.out.printf("Formula at %d-%d %n", rowI, colI); + for (int[] formulaAt : formulas){ + int r = formulaAt[0]; + int c = formulaAt[1]; + System.out.printf("Formula at %d-%d %n", r, c); - String row = fileRows.get(rowI); - String formulaToFill = row.split(separator)[colI]; + String row = fileRows.get(r); + String formulaToFill = row.split(separator)[c]; - put(rowI, colI, formulaToFill); + put(r, c, formulaToFill); } sc.close(); - */ + } @@ -306,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 ofODO the rectangle. + * @param endCellName The name of the cell in the lower right corner of the rectangle. * @return The minimum. */ @@ -345,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 ofODO the rectangle. + * @param endCellName The name of the cell in the lower right corner of the the rectangle. * @return The maximum. */ @@ -382,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 ofODO the rectangle. + * @param endCellName The name of the cell in the lower right corner of the the rectangle. * @return The standard deviation calculated. */