mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-12 13:30:32 +00:00
display raw lines
This commit is contained in:
parent
86605c7ecb
commit
ba5ba04ddc
@ -22,8 +22,9 @@ public class VisicalcFile extends AbstractFile
|
||||
|
||||
text.append ("Visicalc : " + name + "\n");
|
||||
text.append ("Cells : " + sheet.size () + "\n\n");
|
||||
// sheet.getCells ();
|
||||
text.append (sheet.getCells ());
|
||||
text.append ("\n\n");
|
||||
text.append (sheet.getLines ());
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
@ -9,13 +9,9 @@ class Cell implements Comparable<Cell>, Value
|
||||
private final Sheet parent;
|
||||
|
||||
private String label;
|
||||
// private double value;
|
||||
// private String formulaText;
|
||||
|
||||
private char format = ' ';
|
||||
private char repeatingChar;
|
||||
private String repeat = "";
|
||||
// private boolean valid;
|
||||
|
||||
private String expressionText;
|
||||
private Expression expression;
|
||||
@ -125,23 +121,13 @@ class Cell implements Comparable<Cell>, Value
|
||||
{
|
||||
if (expressionText == null)
|
||||
{
|
||||
System.out.println ("null expression text");
|
||||
System.out.printf ("%s null expression text %n", address);
|
||||
return 0;
|
||||
}
|
||||
System.out.printf ("%s Instantiating [%s]%n", address, expressionText);
|
||||
// System.out.printf ("%s Instantiating [%s]%n", address, expressionText);
|
||||
expression = new Expression (parent, expressionText);
|
||||
}
|
||||
return expression.getValue ();
|
||||
|
||||
// [@IF(@ISERROR(BK24),0,BK24)]
|
||||
// [@IF(D4=0,0,1)]
|
||||
// [@IF(D4=0,0,B32+1)]
|
||||
// [@IF(D4=0,0,1+(D3/100/D4)^D4-1*100)]
|
||||
// [@SUM(C4...F4)]
|
||||
// [+C4-@SUM(C5...C12)]
|
||||
// [+D5/100/12]
|
||||
// [.3*(B4+B7+B8+B9)]
|
||||
// [+N12+(P12*(.2*K12+K9-O12))]
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,16 @@ public class Expression implements Value
|
||||
// parentheses. You must start an expression with a +, a digit (0-9), or one of
|
||||
// the symbols @-(. or #.
|
||||
|
||||
// [@IF(@ISERROR(BK24),0,BK24)]
|
||||
// [@IF(D4=0,0,1)]
|
||||
// [@IF(D4=0,0,B32+1)]
|
||||
// [@IF(D4=0,0,1+(D3/100/D4)^D4-1*100)]
|
||||
// [@SUM(C4...F4)]
|
||||
// [+C4-@SUM(C5...C12)]
|
||||
// [+D5/100/12]
|
||||
// [.3*(B4+B7+B8+B9)]
|
||||
// [+N12+(P12*(.2*K12+K9-O12))]
|
||||
|
||||
private final List<Value> values = new ArrayList<Value> ();
|
||||
private final List<String> operators = new ArrayList<String> ();
|
||||
private final List<String> signs = new ArrayList<String> ();
|
||||
@ -27,7 +37,7 @@ public class Expression implements Value
|
||||
{
|
||||
String line = input.trim ();
|
||||
|
||||
System.out.printf ("New expression [%s]%n", input);
|
||||
// System.out.printf ("New expression [%s]%n", input);
|
||||
|
||||
int leftBracket = 0;
|
||||
int rightBracket = 0;
|
||||
|
@ -21,6 +21,7 @@ public class Sheet implements Iterable<Cell>
|
||||
// private static final Pattern addressList = Pattern.compile ("\\(([^,]+(,[^,]+)*)\\)");
|
||||
|
||||
private final Map<Integer, Cell> sheet = new TreeMap<Integer, Cell> ();
|
||||
private final List<String> lines = new ArrayList<String> ();
|
||||
// private final Map<String, Double> functions = new HashMap<String, Double> ();
|
||||
|
||||
Cell currentCell = null;
|
||||
@ -146,7 +147,6 @@ public class Sheet implements Iterable<Cell>
|
||||
;
|
||||
|
||||
int ptr = 0;
|
||||
final List<String> lines = new ArrayList<String> ();
|
||||
while (ptr < last)
|
||||
{
|
||||
int length = getLineLength (buffer, ptr);
|
||||
@ -335,6 +335,22 @@ public class Sheet implements Iterable<Cell>
|
||||
return sheet.values ().iterator ();
|
||||
}
|
||||
|
||||
public String getLines ()
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
for (String line : lines)
|
||||
{
|
||||
text.append (line);
|
||||
text.append ("\n");
|
||||
}
|
||||
|
||||
if (text.length () > 0)
|
||||
text.deleteCharAt (text.length () - 1);
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
public String getCells ()
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
Loading…
x
Reference in New Issue
Block a user