mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-01-11 19:29:47 +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";
|
expressionText = "24";
|
||||||
else if (address.sortValue == 259)
|
else if (address.sortValue == 259)
|
||||||
expressionText = "11.9";
|
expressionText = "11.9";
|
||||||
else if (address.sortValue == 579)
|
|
||||||
expressionText = "D9*G5/(1-((1+G5)^-D4))";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getText (int colWidth, char defaultFormat)
|
String getText (int colWidth, char defaultFormat)
|
||||||
@ -181,8 +179,12 @@ class Cell implements Comparable<Cell>, Value
|
|||||||
@Override
|
@Override
|
||||||
public double getValue ()
|
public double getValue ()
|
||||||
{
|
{
|
||||||
|
if (type != CellType.VALUE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (value == null)
|
if (value == null)
|
||||||
createValue ();
|
createValue ();
|
||||||
|
|
||||||
return value.getValue ();
|
return value.getValue ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,10 +176,20 @@ class Expression implements Value
|
|||||||
|
|
||||||
if (leftBracket != rightBracket)
|
if (leftBracket != rightBracket)
|
||||||
{
|
{
|
||||||
System.out.printf ("**** Unbalanced brackets: left:%d, right:%d ****%n",
|
if (rightBracket > leftBracket)
|
||||||
leftBracket, rightBracket);
|
{
|
||||||
System.out.println (input);
|
System.out.printf ("**** Unbalanced brackets: left:%d, right:%d ****%n",
|
||||||
return "@ERROR()";
|
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;
|
return line;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user