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

30 lines
546 B
Java
Raw Normal View History

2016-03-06 08:05:32 +00:00
package com.bytezone.diskbrowser.visicalc;
2016-03-12 22:38:03 +00:00
class Count extends Function
2016-03-06 08:05:32 +00:00
{
2016-03-12 05:05:50 +00:00
private final Range range;
2016-03-06 08:05:32 +00:00
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-12 05:05:50 +00:00
@Override
2016-03-16 06:15:39 +00:00
public void calculate ()
2016-03-12 05:05:50 +00:00
{
2016-03-16 06:15:39 +00:00
value = 0;
2016-03-06 08:05:32 +00:00
for (Address address : range)
{
Cell cell = parent.getCell (address);
2016-03-16 06:15:39 +00:00
if (cell == null || cell.isError () || cell.isNaN ())
2016-03-12 05:05:50 +00:00
{
2016-03-16 19:32:25 +00:00
valueType = ValueType.ERROR;
2016-03-16 06:15:39 +00:00
break;
2016-03-12 05:05:50 +00:00
}
2016-03-16 06:15:39 +00:00
if (cell.getValue () != 0.0)
value++;
2016-03-06 08:05:32 +00:00
}
}
}