dmolony-DiskBrowser/src/com/bytezone/diskbrowser/visicalc/Sum.java

28 lines
487 B
Java
Raw Normal View History

2016-03-06 08:05:32 +00:00
package com.bytezone.diskbrowser.visicalc;
2016-03-07 04:37:01 +00:00
public class Sum extends Function
2016-03-06 08:05:32 +00:00
{
Range range;
Sheet parent;
public Sum (Sheet parent, String text)
{
this.parent = parent;
range = parent.getRange (text);
}
2016-03-07 04:37:01 +00:00
@Override
2016-03-06 08:05:32 +00:00
public double getValue ()
{
double result = 0;
for (Address address : range)
2016-03-06 23:52:46 +00:00
{
Cell cell = parent.getCell (address);
if (cell != null && cell.hasValue ())
result += cell.getValue ();
}
2016-03-06 08:05:32 +00:00
return result;
}
}