mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-12-23 17:30:36 +00:00
balance brackets
This commit is contained in:
parent
9e72f55cbf
commit
95d3930c53
@ -100,8 +100,6 @@ class Cell implements Comparable<Cell>, Value
|
||||
expressionText = "24";
|
||||
else if (address.sortValue == 259)
|
||||
expressionText = "11.9";
|
||||
else if (address.sortValue == 579)
|
||||
expressionText = "D9*G5/(1-((1+G5)^-D4))";
|
||||
}
|
||||
|
||||
String getText (int colWidth, char defaultFormat)
|
||||
@ -181,8 +179,12 @@ class Cell implements Comparable<Cell>, Value
|
||||
@Override
|
||||
public double getValue ()
|
||||
{
|
||||
if (type != CellType.VALUE)
|
||||
return 0;
|
||||
|
||||
if (value == null)
|
||||
createValue ();
|
||||
|
||||
return value.getValue ();
|
||||
}
|
||||
|
||||
|
@ -176,10 +176,20 @@ class Expression implements Value
|
||||
|
||||
if (leftBracket != rightBracket)
|
||||
{
|
||||
System.out.printf ("**** Unbalanced brackets: left:%d, right:%d ****%n",
|
||||
leftBracket, rightBracket);
|
||||
System.out.println (input);
|
||||
return "@ERROR()";
|
||||
if (rightBracket > leftBracket)
|
||||
{
|
||||
System.out.printf ("**** Unbalanced brackets: left:%d, right:%d ****%n",
|
||||
leftBracket, rightBracket);
|
||||
System.out.println (input);
|
||||
return "@ERROR()";
|
||||
}
|
||||
// System.out.printf ("Old expression:[%s]%n", line);
|
||||
while (rightBracket < leftBracket)
|
||||
{
|
||||
line = line + ")";
|
||||
rightBracket++;
|
||||
}
|
||||
// System.out.printf ("New expression:[%s]%n", line);
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user