mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-27 14:49:25 +00:00
check for NaN
This commit is contained in:
parent
58d1804a97
commit
a76861f3ae
@ -119,18 +119,19 @@ class Cell implements Comparable<Cell>, Value
|
||||
case VALUE:
|
||||
if (hasValue ())
|
||||
{
|
||||
Double value = getValue ();
|
||||
if (Double.isNaN (value))
|
||||
return justify ("", colWidth);
|
||||
|
||||
char format = cellFormat != ' ' ? cellFormat : defaultFormat;
|
||||
if (format == 'I')
|
||||
{
|
||||
String integerFormat = String.format ("%%%d.0f", colWidth);
|
||||
return String.format (integerFormat, getValue ());
|
||||
return String.format (integerFormat, value);
|
||||
}
|
||||
else if (format == '$')
|
||||
{
|
||||
String currencyFormat = String.format ("%%%d.%ds", colWidth, colWidth);
|
||||
Double value = getValue ();
|
||||
if (Double.isNaN (value))
|
||||
return justify ("", colWidth);
|
||||
return String.format (currencyFormat, nf.format (value));
|
||||
}
|
||||
else if (format == '*')
|
||||
@ -143,7 +144,7 @@ class Cell implements Comparable<Cell>, Value
|
||||
{
|
||||
// this could be improved
|
||||
String numberFormat = String.format ("%%%d.3f", colWidth + 4);
|
||||
String val = String.format (numberFormat, getValue ());
|
||||
String val = String.format (numberFormat, value);
|
||||
while (val.endsWith ("0"))
|
||||
val = ' ' + val.substring (0, val.length () - 1);
|
||||
if (val.endsWith ("."))
|
||||
|
@ -183,7 +183,7 @@ public class Sheet implements Iterable<Cell>
|
||||
switch (line.charAt (1))
|
||||
{
|
||||
case 'W':
|
||||
System.out.printf ("Skipping [%s]%n", line);
|
||||
// System.out.printf ("Skipping [%s]%n", line);
|
||||
break;
|
||||
case 'G':
|
||||
switch (line.charAt (2))
|
||||
@ -195,7 +195,7 @@ public class Sheet implements Iterable<Cell>
|
||||
recalculationOrder = line.charAt (3);
|
||||
break;
|
||||
case 'P':
|
||||
System.out.printf ("Skipping [%s]%n", line);
|
||||
// System.out.printf ("Skipping [%s]%n", line);
|
||||
break;
|
||||
case 'C':
|
||||
columnWidth = Integer.parseInt (line.substring (3));
|
||||
@ -209,7 +209,7 @@ public class Sheet implements Iterable<Cell>
|
||||
}
|
||||
break;
|
||||
case 'X':
|
||||
System.out.printf ("Skipping [%s]%n", line);
|
||||
// System.out.printf ("Skipping [%s]%n", line);
|
||||
break;
|
||||
default:
|
||||
System.out.printf ("Skipping [%s]%n", line);
|
||||
@ -342,7 +342,7 @@ public class Sheet implements Iterable<Cell>
|
||||
String underline = "---------------------------------------------------------"
|
||||
+ "-----------------------------------------------------------------";
|
||||
|
||||
int lastRow = -1;
|
||||
int lastRow = 0;
|
||||
int lastColumn = 0;
|
||||
|
||||
StringBuilder heading = new StringBuilder (" ");
|
||||
@ -365,7 +365,10 @@ public class Sheet implements Iterable<Cell>
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
text.append (heading);
|
||||
text.append ("\n001:");
|
||||
}
|
||||
|
||||
for (Cell cell : sheet.values ())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user