From 1c024fdbfc3d75d8a00ccd69b119e40911981410 Mon Sep 17 00:00:00 2001 From: ERANZER Date: Tue, 9 Jan 2024 13:40:01 +0100 Subject: [PATCH] das vorherige --- .../informatik/spreadsheet/Spreadsheet.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java index 121d67d..a37aec7 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java @@ -264,10 +264,10 @@ public class Spreadsheet { while (m.find()) { // m.find() must always be used before m.group() String s = m.group(); if(!s.isEmpty()) { - if((int)s.charAt(0)>=(int)'A'&&(int)s.charAt(0)<=(int)'Z' && cells[(Integer.parseInt(s.substring(1)))-1][(int)s.charAt(0)-(int)'A'].isEmpty()) + if((int)s.charAt(0)>=(int)'A'&&(int)s.charAt(0)<=(int)'Z' && get(s).isEmpty()) continue; if(first && (int)s.charAt(0)>=(int)'A'&&(int)s.charAt(0)<=(int)'Z') { - res=Integer.parseInt(cells[(Integer.parseInt(s.substring(1)))-1][(int)s.charAt(0)-(int)-'A'].getValue()); + res=Integer.parseInt(get(s)); first=false; }else if(first) { res=Integer.parseInt(s); @@ -283,16 +283,16 @@ public class Spreadsheet { }else if((int)s.charAt(0)>=(int)'A'&&(int)s.charAt(0)<=(int)'Z'){ switch(operation) { case("+"): - res+=Integer.parseInt(cells[(Integer.parseInt(s.substring(1)))-1][(int)s.charAt(0)-(int)'A'].getValue()); + res+=Integer.parseInt(get(s)); break; case("-"): - res-=Integer.parseInt(cells[(Integer.parseInt(s.substring(1)))-1][(int)s.charAt(0)-(int)'A'].getValue()); + res-=Integer.parseInt(get(s)); break; case("*"): - res*=Integer.parseInt(cells[(Integer.parseInt(s.substring(1)))-1][(int)s.charAt(0)-(int)'A'].getValue()); + res*=Integer.parseInt(get(s)); break; case("/"): - res/=Integer.parseInt(cells[(Integer.parseInt(s.substring(1)))-1][(int)s.charAt(0)-(int)'A'].getValue()); + res/=Integer.parseInt(get(s)); break; } }else {