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

27 lines
464 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;
public Sum (Sheet parent, String text)
{
2016-03-09 10:38:53 +00:00
super (parent, text);
2016-03-07 12:16:11 +00:00
range = getRange (text);
2016-03-06 08:05:32 +00:00
}
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;
}
}