mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-09-29 07:55:13 +00:00
40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
package com.bytezone.diskbrowser.visicalc;
|
|
|
|
// -----------------------------------------------------------------------------------//
|
|
class Sum extends ValueListFunction
|
|
// -----------------------------------------------------------------------------------//
|
|
{
|
|
// ---------------------------------------------------------------------------------//
|
|
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 ();
|
|
}
|
|
}
|
|
} |