dmolony-DiskBrowser/src/com/bytezone/diskbrowser/visicalc/Sum.java
Denis Molony d09df374dc tidying
2017-03-26 20:16:36 +11:00

34 lines
560 B
Java

package com.bytezone.diskbrowser.visicalc;
class Sum extends ValueListFunction
{
public Sum (Cell cell, String text)
{
super (cell, text);
assert text.startsWith ("@SUM(") : text;
}
@Override
public void calculate ()
{
value = 0;
valueResult = ValueResult.VALID;
for (Value v : list)
{
v.calculate ();
if (v.getValueResult () == ValueResult.NA)
continue;
if (!v.isValid ())
{
valueResult = v.getValueResult ();
return;
}
value += v.getDouble ();
}
}
}