forked from hummel/PR1-Spreadsheet
ganz kleiner bug in pro gefixxt
parent
f44dee0651
commit
33f60b0b8b
|
@ -194,7 +194,7 @@ public class Spreadsheet {
|
||||||
String result = "";
|
String result = "";
|
||||||
|
|
||||||
if (formula.startsWith("SUMME(")) // e.g. SUMME(A3:A8)
|
if (formula.startsWith("SUMME(")) // e.g. SUMME(A3:A8)
|
||||||
result = "" + sum(formula.substring(6, 8), formula.substring(9, 11)); // TODO adapt to cells with two digits
|
result = "" + sum(formula.substring(6, 8), formula.substring(9, 11)); // adapt to cells with two digits
|
||||||
else if (formula.startsWith("PRODUKT(")) // e.g. PRODUKT(A3:B9)
|
else if (formula.startsWith("PRODUKT(")) // e.g. PRODUKT(A3:B9)
|
||||||
result = "" + pro(formula.substring(8, 10), formula.substring(11, 13));
|
result = "" + pro(formula.substring(8, 10), formula.substring(11, 13));
|
||||||
else if (formula.startsWith("MITTELWERT(")) // e.g. MITTELWERT(A3:A5)
|
else if (formula.startsWith("MITTELWERT(")) // e.g. MITTELWERT(A3:A5)
|
||||||
|
@ -292,15 +292,11 @@ public class Spreadsheet {
|
||||||
int endCellRow = getRow(endCellName);
|
int endCellRow = getRow(endCellName);
|
||||||
int endCellCol = getCol(endCellName);
|
int endCellCol = getCol(endCellName);
|
||||||
|
|
||||||
long res = 0;
|
long res = 1;
|
||||||
|
|
||||||
for (int i = startCellRow; i <= endCellRow; i++) {
|
for (int i = startCellRow; i <= endCellRow; i++) {
|
||||||
for (int j = startCellCol; j <= endCellCol; j++) {
|
for (int j = startCellCol; j <= endCellCol; j++) {
|
||||||
if (res == 0) {
|
res = res * (Integer.parseInt(cells[i][j].getValue()));
|
||||||
res = Integer.parseInt(cells[i][j].getValue());
|
|
||||||
} else {
|
|
||||||
res = res * (Integer.parseInt(cells[i][j].getValue()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +407,7 @@ 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()) {
|
||||||
System.out.println(s);
|
//System.out.println(s);
|
||||||
zaehler++;
|
zaehler++;
|
||||||
|
|
||||||
switch (zaehler){
|
switch (zaehler){
|
||||||
|
|
Loading…
Reference in New Issue