mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-30 12:29:54 +00:00
tidying
This commit is contained in:
parent
e3b6e56c20
commit
8286ff026f
|
@ -16,7 +16,7 @@ class Cell extends AbstractValue implements Comparable<Cell>
|
||||||
private String repeat = "";
|
private String repeat = "";
|
||||||
private String label;
|
private String label;
|
||||||
private Value value;
|
private Value value;
|
||||||
private boolean hasCalculated;
|
private boolean calculated;
|
||||||
|
|
||||||
enum CellType
|
enum CellType
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ class Cell extends AbstractValue implements Comparable<Cell>
|
||||||
|
|
||||||
void reset ()
|
void reset ()
|
||||||
{
|
{
|
||||||
hasCalculated = false;
|
calculated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cell getCell (Address address)
|
Cell getCell (Address address)
|
||||||
|
@ -183,7 +183,7 @@ class Cell extends AbstractValue implements Comparable<Cell>
|
||||||
}
|
}
|
||||||
|
|
||||||
// format cell value for output
|
// format cell value for output
|
||||||
String getText (int colWidth, char globalFormat)
|
String getFormattedText (int colWidth, char globalFormat)
|
||||||
{
|
{
|
||||||
char fmtChar = cellFormat != ' ' ? cellFormat : globalFormat;
|
char fmtChar = cellFormat != ' ' ? cellFormat : globalFormat;
|
||||||
|
|
||||||
|
@ -240,16 +240,10 @@ class Cell extends AbstractValue implements Comparable<Cell>
|
||||||
@Override
|
@Override
|
||||||
public String getText ()
|
public String getText ()
|
||||||
{
|
{
|
||||||
if (cellType == CellType.EMPTY)
|
// cell points to another cell which is ERROR or NA
|
||||||
return "MPT";
|
|
||||||
|
|
||||||
if (cellType == CellType.LABEL)
|
|
||||||
return "LBL";
|
|
||||||
|
|
||||||
if (cellType == CellType.REPEATING_CHARACTER)
|
|
||||||
return "RPT";
|
|
||||||
|
|
||||||
assert cellType == CellType.VALUE;
|
assert cellType == CellType.VALUE;
|
||||||
|
assert !value.isValueType (ValueType.VALUE);
|
||||||
|
|
||||||
return value.getText ();
|
return value.getText ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,24 +256,20 @@ class Cell extends AbstractValue implements Comparable<Cell>
|
||||||
@Override
|
@Override
|
||||||
public void calculate ()
|
public void calculate ()
|
||||||
{
|
{
|
||||||
if (cellType == CellType.VALUE)
|
if (cellType == CellType.VALUE && !calculated)
|
||||||
{
|
{
|
||||||
if (!hasCalculated)
|
value.calculate ();
|
||||||
{
|
calculated = true;
|
||||||
value.calculate ();
|
|
||||||
hasCalculated = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDebugText ()
|
public String getDebugText ()
|
||||||
{
|
{
|
||||||
boolean isVolatile = false;
|
|
||||||
StringBuilder text = new StringBuilder ();
|
StringBuilder text = new StringBuilder ();
|
||||||
text.append (line);
|
text.append (line);
|
||||||
text.append ("\n");
|
text.append ("\n");
|
||||||
text.append (String.format ("| %-11s %s Volatile: %1.1s Format: %s |%n",
|
text.append (String.format ("| %-11s %s Format: %s |%n",
|
||||||
address.getText (), address.getDetails (), isVolatile, cellFormat));
|
address.getText (), address.getDetails (), cellFormat));
|
||||||
text.append (line);
|
text.append (line);
|
||||||
text.append ("\n");
|
text.append ("\n");
|
||||||
|
|
||||||
|
|
|
@ -449,7 +449,7 @@ public class Sheet
|
||||||
if (columnWidths.containsKey (cellAddress.getColumn ()))
|
if (columnWidths.containsKey (cellAddress.getColumn ()))
|
||||||
colWidth = columnWidths.get (cellAddress.getColumn ());
|
colWidth = columnWidths.get (cellAddress.getColumn ());
|
||||||
|
|
||||||
text.append (cell.getText (colWidth, globalFormat));
|
text.append (cell.getFormattedText (colWidth, globalFormat));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user