diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java index 63e20ee..a123873 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java @@ -76,7 +76,6 @@ public class Spreadsheet { * @param path The file to read. * @param separator The char used to split up the input, e.g. a comma or a semicolon. * @param startCellName The upper left cell where data from the CSV file should be inserted. - * @return Nothing. * @exception IOException If path does not exist. */ public void readCsv(String path, char separator, String startCellName) throws FileNotFoundException { @@ -86,7 +85,6 @@ public class Spreadsheet { /** * A method for saving data to a CSV file. * @param path The file to write. - * @return Nothing. * @exception IOException If path does not exist. */ public void saveCsv(String path) throws FileNotFoundException { @@ -112,7 +110,6 @@ public class Spreadsheet { * This method does the actual evaluation/calcluation of a specific cell * @param row the row of the cell to be evaluated * @param col the col of the cell to be evaluated - * @return Nothing. */ private void evaluateCell(int row, int col) { String formula = cells[row][col].getFormula(); @@ -150,8 +147,21 @@ public class Spreadsheet { * @return The sum calculated. */ private long sum(String startCellName, String endCellName) { + long result = 0; - return 0; + for(char col = startCellName.charAt(0); col <= endCellName.charAt(0); col++){ + + for(int row = Integer.parseInt(startCellName.substring(1)); row <= Integer.parseInt(endCellName.substring(1)); row++) { + + String value = get((row - 1), (col - 'A')); + System.out.println(value); + + if(!value.isEmpty()){ + result += Long.parseLong(value); + } + } + } + return result; } /**