2016-03-06 08:05:32 +00:00
|
|
|
package com.bytezone.diskbrowser.visicalc;
|
|
|
|
|
2016-03-07 04:37:01 +00:00
|
|
|
public class Count extends Function
|
2016-03-06 08:05:32 +00:00
|
|
|
{
|
|
|
|
Range range;
|
|
|
|
|
|
|
|
public Count (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)
|
|
|
|
{
|
|
|
|
Cell cell = parent.getCell (address);
|
2016-03-06 23:52:46 +00:00
|
|
|
if (cell != null && cell.hasValue () && cell.getValue () != 0.0)
|
2016-03-06 08:05:32 +00:00
|
|
|
result += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|