mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-23 08:29:30 +00:00
refactoring
This commit is contained in:
parent
cf8d3729d4
commit
be3a8c650d
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Abs extends Function
|
public class Abs extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Abs (Cell cell, String text)
|
Abs (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@ABS(") : text;
|
assert text.startsWith ("@ABS(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Acos extends Function
|
public class Acos extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Acos (Cell cell, String text)
|
Acos (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@ACOS(") : text;
|
assert text.startsWith ("@ACOS(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Asin extends Function
|
public class Asin extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Asin (Cell cell, String text)
|
Asin (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@ASIN(") : text;
|
assert text.startsWith ("@ASIN(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Atan extends Function
|
public class Atan extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Atan (Cell cell, String text)
|
Atan (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@ATAN(") : text;
|
assert text.startsWith ("@ATAN(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.bytezone.diskbrowser.visicalc.Cell.CellType;
|
||||||
|
|
||||||
public class Average extends Function
|
public class Average extends Function
|
||||||
{
|
{
|
||||||
private final ValueList list;
|
|
||||||
private final boolean isRange; // may affect how the count is done
|
private final boolean isRange; // may affect how the count is done
|
||||||
|
|
||||||
public Average (Cell cell, String text)
|
public Average (Cell cell, String text)
|
||||||
|
|
|
@ -33,6 +33,16 @@ class Cell extends AbstractValue implements Comparable<Cell>
|
||||||
isVolatile = false;
|
isVolatile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function getFunction (String text)
|
||||||
|
{
|
||||||
|
return parent.getFunction (this, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
Value getExpressionValue (String text)
|
||||||
|
{
|
||||||
|
return new Expression (this, text).reduce ();
|
||||||
|
}
|
||||||
|
|
||||||
boolean isCellType (CellType cellType)
|
boolean isCellType (CellType cellType)
|
||||||
{
|
{
|
||||||
return this.cellType == cellType;
|
return this.cellType == cellType;
|
||||||
|
@ -106,7 +116,7 @@ class Cell extends AbstractValue implements Comparable<Cell>
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
expressionText = command;
|
expressionText = command;
|
||||||
value = new Expression (parent, this, expressionText).reduce ();
|
value = new Expression (this, expressionText).reduce ();
|
||||||
cellType = CellType.VALUE;
|
cellType = CellType.VALUE;
|
||||||
isVolatile = true;
|
isVolatile = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,23 +2,17 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Choose extends Function
|
public class Choose extends Function
|
||||||
{
|
{
|
||||||
private final String sourceText;
|
|
||||||
private final String rangeText;
|
|
||||||
|
|
||||||
private final Value source;
|
|
||||||
private final Range range;
|
|
||||||
|
|
||||||
Choose (Cell cell, String text)
|
Choose (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@CHOOSE(") : text;
|
assert text.startsWith ("@CHOOSE(") : text;
|
||||||
|
|
||||||
sourceText = Expression.getParameter (functionText);
|
String sourceText = Expression.getParameter (functionText);
|
||||||
source = new Expression (parent, cell, sourceText).reduce ();
|
source = cell.getExpressionValue (sourceText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
|
|
||||||
rangeText = functionText.substring (sourceText.length () + 1);
|
String rangeText = functionText.substring (sourceText.length () + 1);
|
||||||
range = new Range (parent, cell, rangeText);
|
range = new Range (parent, cell, rangeText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,13 @@ class Condition extends AbstractValue implements Iterable<Value>
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
{
|
{
|
||||||
conditionText = text.substring (0, pos);
|
conditionText = text.substring (0, pos);
|
||||||
conditionExpression = new Expression (parent, cell, conditionText);
|
conditionExpression = new Expression (cell, conditionText);
|
||||||
values.add (conditionExpression);
|
values.add (conditionExpression);
|
||||||
|
|
||||||
comparator = comp;
|
comparator = comp;
|
||||||
|
|
||||||
valueText = text.substring (pos + comp.length ());
|
valueText = text.substring (pos + comp.length ());
|
||||||
valueExpression = new Expression (parent, cell, valueText);
|
valueExpression = new Expression (cell, valueText);
|
||||||
values.add (valueExpression);
|
values.add (valueExpression);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -46,13 +46,13 @@ class Condition extends AbstractValue implements Iterable<Value>
|
||||||
if (text.startsWith ("@"))
|
if (text.startsWith ("@"))
|
||||||
{
|
{
|
||||||
conditionText = text;
|
conditionText = text;
|
||||||
conditionExpression = new Expression (parent, cell, text);
|
conditionExpression = new Expression (cell, text);
|
||||||
values.add (conditionExpression);
|
values.add (conditionExpression);
|
||||||
|
|
||||||
comparator = "=";
|
comparator = "=";
|
||||||
|
|
||||||
valueText = "1";
|
valueText = "1";
|
||||||
valueExpression = new Expression (parent, cell, valueText);
|
valueExpression = new Expression (cell, valueText);
|
||||||
values.add (valueExpression);
|
values.add (valueExpression);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Cos extends Function
|
public class Cos extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Cos (Cell cell, String text)
|
Cos (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@COS(") : text;
|
assert text.startsWith ("@COS(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.bytezone.diskbrowser.visicalc.Cell.CellType;
|
||||||
|
|
||||||
class Count extends Function
|
class Count extends Function
|
||||||
{
|
{
|
||||||
private final ValueList list;
|
|
||||||
private final boolean isRange;
|
private final boolean isRange;
|
||||||
|
|
||||||
public Count (Cell cell, String text)
|
public Count (Cell cell, String text)
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Exp extends Function
|
public class Exp extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Exp (Cell cell, String text)
|
Exp (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@EXP(") : text;
|
assert text.startsWith ("@EXP(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,12 @@ class Expression extends AbstractValue implements Iterable<Value>
|
||||||
|
|
||||||
private final String text;
|
private final String text;
|
||||||
|
|
||||||
public Expression (Sheet parent, Cell cell, String text)
|
public Expression (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super ("Exp");
|
super ("Exp");
|
||||||
this.cell = cell;
|
this.cell = cell;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
|
Sheet parent = cell.getParent ();
|
||||||
|
|
||||||
String line = balanceBrackets (text); // add trailing right brackets if necessary
|
String line = balanceBrackets (text); // add trailing right brackets if necessary
|
||||||
|
|
||||||
|
@ -66,13 +67,13 @@ class Expression extends AbstractValue implements Iterable<Value>
|
||||||
case '@': // function
|
case '@': // function
|
||||||
String functionText = getFunctionCall (line.substring (ptr));
|
String functionText = getFunctionCall (line.substring (ptr));
|
||||||
ptr += functionText.length ();
|
ptr += functionText.length ();
|
||||||
values.add (parent.getFunction (cell, functionText));
|
values.add (cell.getFunction (functionText));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '(': // parentheses block
|
case '(': // parentheses block
|
||||||
String bracketText = getBalancedText (line.substring (ptr));
|
String bracketText = getBalancedText (line.substring (ptr));
|
||||||
ptr += bracketText.length ();
|
ptr += bracketText.length ();
|
||||||
values.add (new Expression (parent, cell,
|
values.add (new Expression (cell,
|
||||||
bracketText.substring (1, bracketText.length () - 1)));
|
bracketText.substring (1, bracketText.length () - 1)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,14 @@ abstract class Function extends AbstractValue implements Iterable<Value>
|
||||||
protected String functionText;
|
protected String functionText;
|
||||||
protected String fullText;
|
protected String fullText;
|
||||||
|
|
||||||
|
protected Value source;
|
||||||
|
protected ValueList list;
|
||||||
|
protected Range range;
|
||||||
|
|
||||||
Function (Cell cell, String text)
|
Function (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super ("Function");
|
super ("Function");
|
||||||
|
|
||||||
this.parent = cell.getParent ();
|
this.parent = cell.getParent ();
|
||||||
this.cell = cell;
|
this.cell = cell;
|
||||||
fullText = text;
|
fullText = text;
|
||||||
|
|
|
@ -25,10 +25,10 @@ class If extends Function
|
||||||
condition = new Condition (parent, cell, conditionText);
|
condition = new Condition (parent, cell, conditionText);
|
||||||
values.add (condition);
|
values.add (condition);
|
||||||
|
|
||||||
expTrue = new Expression (parent, cell, textTrue);
|
expTrue = new Expression (cell, textTrue);
|
||||||
values.add (expTrue);
|
values.add (expTrue);
|
||||||
|
|
||||||
expFalse = new Expression (parent, cell, textFalse);
|
expFalse = new Expression (cell, textFalse);
|
||||||
values.add (expFalse);
|
values.add (expFalse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Int extends Function
|
public class Int extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Int (Cell cell, String text)
|
Int (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@INT(") : text;
|
assert text.startsWith ("@INT(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
class IsError extends Function
|
class IsError extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
public IsError (Cell cell, String text)
|
public IsError (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@ISERROR(") : text;
|
assert text.startsWith ("@ISERROR(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class IsNa extends Function
|
public class IsNa extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
IsNa (Cell cell, String text)
|
IsNa (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@ISNA(") : text;
|
assert text.startsWith ("@ISNA(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Ln extends Function
|
public class Ln extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Ln (Cell cell, String text)
|
Ln (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@LN(") : text;
|
assert text.startsWith ("@LN(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Log10 extends Function
|
public class Log10 extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Log10 (Cell cell, String text)
|
Log10 (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@LOG10(") : text;
|
assert text.startsWith ("@LOG10(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,23 +2,17 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
class Lookup extends Function
|
class Lookup extends Function
|
||||||
{
|
{
|
||||||
private final String sourceText;
|
|
||||||
private final String rangeText;
|
|
||||||
|
|
||||||
private final Value source;
|
|
||||||
private final Range range;
|
|
||||||
|
|
||||||
public Lookup (Cell cell, String text)
|
public Lookup (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@LOOKUP(") : text;
|
assert text.startsWith ("@LOOKUP(") : text;
|
||||||
|
|
||||||
sourceText = Expression.getParameter (functionText);
|
String sourceText = Expression.getParameter (functionText);
|
||||||
source = new Expression (parent, cell, sourceText).reduce ();
|
source = cell.getExpressionValue (sourceText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
|
|
||||||
rangeText = functionText.substring (sourceText.length () + 1);
|
String rangeText = functionText.substring (sourceText.length () + 1);
|
||||||
range = new Range (parent, cell, rangeText);
|
range = new Range (parent, cell, rangeText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +66,4 @@ class Lookup extends Function
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @LOOKUP(B8,F3...F16)
|
|
||||||
// @LOOKUP(.2*K8+K7,F3...F16)
|
|
||||||
}
|
}
|
|
@ -2,8 +2,6 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
class Max extends Function
|
class Max extends Function
|
||||||
{
|
{
|
||||||
private final ValueList list;
|
|
||||||
|
|
||||||
public Max (Cell cell, String text)
|
public Max (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
|
@ -2,8 +2,6 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
class Min extends Function
|
class Min extends Function
|
||||||
{
|
{
|
||||||
private final ValueList list;
|
|
||||||
|
|
||||||
public Min (Cell cell, String text)
|
public Min (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
|
@ -4,23 +4,17 @@ import com.bytezone.diskbrowser.visicalc.Cell.CellType;
|
||||||
|
|
||||||
public class Npv extends Function
|
public class Npv extends Function
|
||||||
{
|
{
|
||||||
private final String sourceText;
|
|
||||||
private final String rangeText;
|
|
||||||
|
|
||||||
private final Value source;
|
|
||||||
private final Range range;
|
|
||||||
|
|
||||||
Npv (Cell cell, String text)
|
Npv (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@NPV(") : text;
|
assert text.startsWith ("@NPV(") : text;
|
||||||
|
|
||||||
sourceText = Expression.getParameter (functionText);
|
String sourceText = Expression.getParameter (functionText);
|
||||||
source = new Expression (parent, cell, sourceText).reduce ();
|
source = cell.getExpressionValue (sourceText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
|
|
||||||
rangeText = functionText.substring (sourceText.length () + 1);
|
String rangeText = functionText.substring (sourceText.length () + 1);
|
||||||
range = new Range (parent, cell, rangeText);
|
range = new Range (parent, cell, rangeText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -493,24 +493,16 @@ public class Sheet
|
||||||
|
|
||||||
Function getFunction (Cell cell, String text)
|
Function getFunction (Cell cell, String text)
|
||||||
{
|
{
|
||||||
if (text.charAt (0) != '@')
|
|
||||||
{
|
|
||||||
System.out.printf ("Unknown function: [%s]%n", text);
|
|
||||||
return new Error (cell, "@ERROR");
|
|
||||||
}
|
|
||||||
|
|
||||||
String functionName = "";
|
|
||||||
int functionId = -1;
|
int functionId = -1;
|
||||||
for (int i = 0; i < Function.functionList.length; i++)
|
for (int i = 0; i < Function.functionList.length; i++)
|
||||||
if (text.startsWith (Function.functionList[i]))
|
if (text.startsWith (Function.functionList[i]))
|
||||||
{
|
{
|
||||||
functionId = i;
|
functionId = i;
|
||||||
functionTotals[i]++;
|
functionTotals[i]++;
|
||||||
functionName = Function.functionList[i];
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (functionName.isEmpty ())
|
if (functionId < 0)
|
||||||
{
|
{
|
||||||
System.out.printf ("Unknown function: [%s]%n", text);
|
System.out.printf ("Unknown function: [%s]%n", text);
|
||||||
return new Error (cell, "@ERROR");
|
return new Error (cell, "@ERROR");
|
||||||
|
@ -609,7 +601,7 @@ public class Sheet
|
||||||
return new True (cell, text);
|
return new True (cell, text);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
System.out.printf ("Unknown function: [%s]%n", text);
|
System.out.printf ("Unknown function ID: %d%n", functionId);
|
||||||
return new Error (cell, "@ERROR");
|
return new Error (cell, "@ERROR");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Sin extends Function
|
public class Sin extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Sin (Cell cell, String text)
|
Sin (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@SIN(") : text;
|
assert text.startsWith ("@SIN(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Sqrt extends Function
|
public class Sqrt extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Sqrt (Cell cell, String text)
|
Sqrt (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@SQRT(") : text;
|
assert text.startsWith ("@SQRT(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
class Sum extends Function
|
class Sum extends Function
|
||||||
{
|
{
|
||||||
private final ValueList list;
|
|
||||||
|
|
||||||
public Sum (Cell cell, String text)
|
public Sum (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
|
@ -2,15 +2,13 @@ package com.bytezone.diskbrowser.visicalc;
|
||||||
|
|
||||||
public class Tan extends Function
|
public class Tan extends Function
|
||||||
{
|
{
|
||||||
private final Value source;
|
|
||||||
|
|
||||||
Tan (Cell cell, String text)
|
Tan (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super (cell, text);
|
super (cell, text);
|
||||||
|
|
||||||
assert text.startsWith ("@TAN(") : text;
|
assert text.startsWith ("@TAN(") : text;
|
||||||
|
|
||||||
source = new Expression (parent, cell, functionText).reduce ();
|
source = cell.getExpressionValue (functionText);
|
||||||
values.add (source);
|
values.add (source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class ValueList implements Iterable<Value>
|
||||||
for (Address address : new Range (parent, cell, parameter))
|
for (Address address : new Range (parent, cell, parameter))
|
||||||
values.add (parent.getCell (address));
|
values.add (parent.getCell (address));
|
||||||
else
|
else
|
||||||
values.add (new Expression (parent, cell, parameter).reduce ());
|
values.add (new Expression (cell, parameter).reduce ());
|
||||||
|
|
||||||
if (remainder.length () == parameter.length ())
|
if (remainder.length () == parameter.length ())
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user