das vorherige
parent
f3af3f39e0
commit
1c024fdbfc
|
@ -264,10 +264,10 @@ public class Spreadsheet {
|
||||||
while (m.find()) { // m.find() must always be used before m.group()
|
while (m.find()) { // m.find() must always be used before m.group()
|
||||||
String s = m.group();
|
String s = m.group();
|
||||||
if(!s.isEmpty()) {
|
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;
|
continue;
|
||||||
if(first && (int)s.charAt(0)>=(int)'A'&&(int)s.charAt(0)<=(int)'Z') {
|
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;
|
first=false;
|
||||||
}else if(first) {
|
}else if(first) {
|
||||||
res=Integer.parseInt(s);
|
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'){
|
}else if((int)s.charAt(0)>=(int)'A'&&(int)s.charAt(0)<=(int)'Z'){
|
||||||
switch(operation) {
|
switch(operation) {
|
||||||
case("+"):
|
case("+"):
|
||||||
res+=Integer.parseInt(cells[(Integer.parseInt(s.substring(1)))-1][(int)s.charAt(0)-(int)'A'].getValue());
|
res+=Integer.parseInt(get(s));
|
||||||
break;
|
break;
|
||||||
case("-"):
|
case("-"):
|
||||||
res-=Integer.parseInt(cells[(Integer.parseInt(s.substring(1)))-1][(int)s.charAt(0)-(int)'A'].getValue());
|
res-=Integer.parseInt(get(s));
|
||||||
break;
|
break;
|
||||||
case("*"):
|
case("*"):
|
||||||
res*=Integer.parseInt(cells[(Integer.parseInt(s.substring(1)))-1][(int)s.charAt(0)-(int)'A'].getValue());
|
res*=Integer.parseInt(get(s));
|
||||||
break;
|
break;
|
||||||
case("/"):
|
case("/"):
|
||||||
res/=Integer.parseInt(cells[(Integer.parseInt(s.substring(1)))-1][(int)s.charAt(0)-(int)'A'].getValue());
|
res/=Integer.parseInt(get(s));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
|
|
Loading…
Reference in New Issue