2016-03-06 08:05:32 +00:00
|
|
|
package com.bytezone.diskbrowser.visicalc;
|
|
|
|
|
2017-02-18 09:54:24 +00:00
|
|
|
class Count extends Function
|
2016-03-06 08:05:32 +00:00
|
|
|
{
|
2017-02-18 09:54:24 +00:00
|
|
|
private final Range range;
|
|
|
|
|
2017-03-14 11:28:52 +00:00
|
|
|
public Count (Sheet parent, Cell cell, String text)
|
2016-03-06 08:05:32 +00:00
|
|
|
{
|
2017-03-14 11:28:52 +00:00
|
|
|
super (parent, cell, text);
|
2017-03-03 23:41:08 +00:00
|
|
|
|
2017-03-03 10:24:23 +00:00
|
|
|
range = new Range (parent, text);
|
2016-03-06 08:05:32 +00:00
|
|
|
}
|
|
|
|
|
2016-03-12 05:05:50 +00:00
|
|
|
@Override
|
2017-02-28 20:39:26 +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-17 04:40:43 +00:00
|
|
|
valueType = ValueType.VALUE;
|
|
|
|
|
2016-03-06 08:05:32 +00:00
|
|
|
for (Address address : range)
|
|
|
|
{
|
|
|
|
Cell cell = parent.getCell (address);
|
2017-03-03 23:41:08 +00:00
|
|
|
|
|
|
|
if (cell.isValueType (ValueType.NA))
|
2016-03-17 04:40:43 +00:00
|
|
|
continue;
|
|
|
|
|
2017-02-25 03:56:22 +00:00
|
|
|
if (!cell.isValueType (ValueType.VALUE))
|
2016-03-12 05:05:50 +00:00
|
|
|
{
|
2017-02-25 03:56:22 +00:00
|
|
|
valueType = cell.getValueType ();
|
2017-03-08 09:18:59 +00:00
|
|
|
return;
|
2016-03-12 05:05:50 +00:00
|
|
|
}
|
2016-03-16 06:15:39 +00:00
|
|
|
|
2017-03-08 09:18:59 +00:00
|
|
|
value++;
|
2016-03-06 08:05:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|